Bug 311393

Summary: cannot import photos from autodetected Canon PowerShot A1300 [patch]
Product: [Applications] digikam Reporter: kavol <kavol>
Component: Import-Gphoto2Assignee: Digikam Developers <digikam-bugs-null>
Severity: normal CC: caulier.gilles, maxantispam, nicofo, rdieter, sreedharpalayil, tpr
Priority: NOR    
Version: 3.1.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 3.2.0
Attachments: fix for the regression

Description kavol 2012-12-09 09:17:56 UTC
I cannot import photos from Canon PowerShot A1300.

Reproducible: Always

Steps to Reproduce:
1. connect the camera, turn it on
2. choose Importovat [Import] => Fotoaparáty [Cameras] => Canon Inc. Canon Digital Camera (automaticky detekované) [... (autodetected)]
3. wait until eternity
Actual Results:  
nothing happens, it fails silently

if you run digikam from konsole (not expected in normal operation, right?) you get:

$ digikam 
QSqlDatabasePrivate::removeDatabase: connection 'ConnectionTest' is still in use, all queries will cease to work.
digikam(24953)/digikam (core): Failed to get information for the listed camera 
digikam(24953)/digikam (core): Failed to detect camera with GPhoto2 from Solid information

Expected Results:  
you get the window which shows the photos in the camera and allows you to choose what to download

note that bug #199197 looks similar, but I *do* have gphoto2

trying to add the camera manually, it gets detected as "USB PTP Class Camera"; if I try to modify the record, the list of known cameras does not include this particular model (the closest is Canon PowerShot A1100), but it doesn't seem to prevent it from working - if I choose the manually added "USB PTP Class Camera" entry from the import menu, the import works as expected

from dmesg:

[4216137.345617] hub 2-0:1.0: state 7 ports 8 chg 0000 evt 0010
[4216137.345632] ehci_hcd 0000:00:1d.7: GetStatus port:4 status 001803 0  ACK POWER sig=j CSC CONNECT
[4216137.345643] hub 2-0:1.0: port 4, status 0501, change 0001, 480 Mb/s
[4216137.449469] hub 2-0:1.0: debounce: port 4: total 100ms stable 100ms status 0x501
[4216137.500704] ehci_hcd 0000:00:1d.7: port 4 reset complete, port enabled
[4216137.500714] ehci_hcd 0000:00:1d.7: GetStatus port:4 status 001005 0  ACK POWER sig=se0 PE CONNECT
[4216137.551399] usb 2-4: new high-speed USB device number 27 using ehci_hcd
[4216137.602632] ehci_hcd 0000:00:1d.7: port 4 reset complete, port enabled
[4216137.602641] ehci_hcd 0000:00:1d.7: GetStatus port:4 status 001005 0  ACK POWER sig=se0 PE CONNECT
[4216137.665666] ehci_hcd 0000:00:1d.7: set dev address 27 for port 4
[4216137.665673] ehci_hcd 0000:00:1d.7: LPM: no device attached
[4216137.666536] usb 2-4: default language 0x0409
[4216137.667288] usb 2-4: udev 27, busnum 2, minor = 154
[4216137.667294] usb 2-4: New USB device found, idVendor=04a9, idProduct=323e
[4216137.667302] usb 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[4216137.667308] usb 2-4: Product: Canon Digital Camera
[4216137.667311] usb 2-4: Manufacturer: Canon Inc.
[4216137.667315] usb 2-4: SerialNumber: 7D68B4DFDD12462E965439A4F2ED277E
[4216137.667392] usb 2-4: usb_probe_device
[4216137.667397] usb 2-4: configuration #1 chosen from 1 choice
[4216137.667547] usb 2-4: adding 2-4:1.0 (config #1, interface 0)
Comment 1 caulier.gilles 2012-12-17 05:04:33 UTC
Sound like a failure from GPhoto2 shared lib or KDE Solid API to detect camera model...

Gilles Caulier
Comment 2 caulier.gilles 2012-12-17 05:05:07 UTC
*** Bug 311394 has been marked as a duplicate of this bug. ***
Comment 3 Rex Dieter 2013-02-03 14:13:22 UTC
User in question here is on fedora18 with gphoto-2.5, may be some side effect of porting to the newer api (see bug #303427)

I'm trying to come up with some minimal test case to verify that or not (help welcome)
Comment 4 Nicofo 2013-02-18 20:35:06 UTC
Same problem for me (with a nikon coolpix) (see digikam output below)
- Fedora 18 (KDE 4.9.5) as well
- libgphoto2-2.5.0-7.fc18.i686
- digikam-2.9.0-3.fc18.i686

1) after the reading previous comment, I have tried to downgrade (*) libgphoto2 and use the version of Fedora 16 or 17 (libgphoto2-2.4.11-1.fc16.i686.rpm or libgphoto2-2.4.14-1.fc17.i686.rpm) -> same problem: the output of digikam (see below) is exactly the same.
( (*) downgrade using rpm --nodeps --force and linking libgphoto2.so.6 and libgphoto2_port.so.10: quite dirty, but just to test an older version of ligphoto2)

2) I have not tried digikam 3.0: any chance it is solved in that version ?

3) I guess bug #307839 is a duplicate of this one ?

Output of digikam when importing photos (which does nothing):
$ digikam 
QSqlDatabasePrivate::removeDatabase: connection 'ConnectionTest' is still in use, all queries will cease to work.
digikam(11595)/digikam (core): Failed to get information for the listed camera 
digikam(11595)/digikam (core): Failed to detect camera with GPhoto2 from Solid information
Comment 5 Nicofo 2013-03-07 19:09:43 UTC
For me this is not an issue anymore with digikam 3.0
Comment 6 MaxiPunkt 2013-03-17 14:33:28 UTC
I experienced same problem on my system (Fedora 18, 64bit) and my PTP-camera (Canon PowerShot A495).

On konsole, I get the following errors:
digikam(17515)/digikam (core): Failed to get information for the listed camera 
digikam(17515)/digikam (core): Failed to detect camera with GPhoto2 from Solid information 

Importing pictures with Dolphin does work as expected.

Then I came across this bug-report: https://bugs.mageia.org/show_bug.cgi?id=8838
The described workaround  does work for me:
* manually adding USB PTP-camera in digikam
* launching digikam-importer in combination with manually added camera
Comment 7 MaxiPunkt 2013-03-18 19:09:57 UTC
Today there where updates on FC18 to KDE 4.10.1 & digikam 3.0.0
No changes regarding this bug - the problem still does exist here.
Comment 8 MaxiPunkt 2013-03-29 14:19:03 UTC
Now there were updates on Fedora FC18 to digikam 3.1.0
This bug still exists in new digikam-version...
Comment 9 Teemu Rytilahti 2013-03-31 10:14:14 UTC
This bug happens when the camera is being detected as a generic (PTP) device by gphoto2. In that case vendor_id and product_id are set to 0 and thus it fails when checking against the IDs given by Solid, inside GPCamera::findConnectedUsbCamera().

As long as the camera is detected to be something else than generic one (even though the name might be wrong, as it is the case with my Olympus E-PL3 which gets detected as mju 500), the IDs match and everything works just fine.

The autodetect inside the options window works because it relies on gphoto2's detection instead of using the same way to check for the connected devices.
Comment 10 Teemu Rytilahti 2013-03-31 11:59:33 UTC
Have an experimental, hacky patch for this, which relies on parsing Solid::Block's device and comparing that for the found cameras. Fixes the problem for my Coolpix S2500

The hack converts the device address given by Solid to the format gphoto2 gives out (usb:001,003 etc.), and is not really portable. Trying to look for another way to do it properly.
Comment 11 caulier.gilles 2013-03-31 12:40:56 UTC
But the question is. why in the past this feature work properly ? What has changed ? Perhaps it's in Solid API ?

Gilles Caulier
Comment 12 Teemu Rytilahti 2013-03-31 13:11:32 UTC
Maybe commit b224133f53e8428da7162c604374c7f73283d215 from the last July, adding support for gphoto2 api?
Comment 13 caulier.gilles 2013-03-31 13:21:28 UTC
Perhaps. If you revert this commit, it work better ?

Gilles Caulier
Comment 14 Marcus Meissner 2013-04-01 11:14:37 UTC
Created attachment 78539 [details]
fix for the regression

I did a compile-tested but otherwise untested patch for this isuse.
Comment 15 caulier.gilles 2013-04-01 12:39:20 UTC
Many thanks Marcus for your patch. I will review it now...

Gilles Caulier
Comment 16 Marcus Meissner 2013-04-01 12:44:36 UTC
Created attachment 78541 [details]

patch against master... last was gaainst development/3.0.0
Comment 17 caulier.gilles 2013-04-01 13:00:42 UTC
Git commit 1f0dbbd3b3a6246e8c66b038a3f1e06af2f5ee11 by Gilles Caulier.
Committed on 01/04/2013 at 14:59.
Pushed by cgilles into branch 'master'.

Apply patch #78541 from Marcus Meissner about to find devices by usb vendor and product id, also if libgphoto2
just finds them by interface class.
FIXED-IN: 3.2.0

M  +58   -19   utilities/importui/backend/gpcamera.cpp

Comment 18 Teemu Rytilahti 2013-04-01 13:04:13 UTC
Tested the patch, works fine for the setup where it didn't do before (generic PTP, coolpix s2500).