Workaround for USB digital camera photo download problems

Bug #6602 reported by Hamish Cunningham
16
Affects Status Importance Assigned to Milestone
gphoto2 (Ubuntu)
Invalid
Medium
MOTU
libgphoto2 (Ubuntu)
Fix Released
Undecided
Hubert Figuiere

Bug Description

When plugging a digital camera (Canon IXUS 700) GNOME starts an application to allow download of pictures. On my system (Ubuntu
5.10 on an IBM X32 Thinkpad running an Emperor Linux 2.6.12 Kernel) the download doesn't work. The workaround is to log out of GNOME before plugging the camera, then use gphoto as root from a command-line login to do the download. E.g.:

sudo gphoto2 --camera "Canon Digital IXUS 700 (PTP mode)" -P

Changed in gphoto2:
assignee: nobody → motu
Revision history for this message
Aanjhan Ranganathan (aanjhan) wrote :

Need some more info. What happens when you try to download pics?

Revision history for this message
SVAKSHA (svaksha) wrote :

Thank you for reporting this bug.
Can you reproduce this problem with the latest Dapper source. Can you, if possible, attach the file causing the crash? The beta release of Dapper is scheduled for next Thursday, 20060420 and we would like to fix bugs before the beta is publicized. -Thanks!

Changed in gphoto2:
status: Unconfirmed → Needs Info
Revision history for this message
Hamish Cunningham (hamishagain) wrote : Re: [Bug 6602] Re: Workaround for USB digital camera photo download problems

Hi,

Could you tell me the synaptic repository settings that I need to
download the latest gphoto2? Then I can test it.

Best

Hamish

Svaksha wrote:

>Thank you for reporting this bug.
>Can you reproduce this problem with the latest Dapper source. Can you, if possible, attach the file causing the crash? The beta release of Dapper is scheduled for next Thursday, 20060420 and we would like to fix bugs before the beta is publicized. -Thanks!
>
>
>** Changed in: gphoto2 (Ubuntu)
> Status: Unconfirmed => Needs Info
>
>

___________________________________________________________
Yahoo! Photos � NEW, now offering a quality print service from just 7p a photo http://uk.photos.yahoo.com

Revision history for this message
JamesNorris (jiminorris) wrote :

could this be realted to bug 33310

soulds like a similar problem to me. But 33310 has the added problem of the Canon PowerShot 520 being detected as an IXUS in the first place.. Which might mean this is not just for your camera but IXUS ones in general

Revision history for this message
Hubert Figuiere (hub) wrote :

if it works as root but not as a standard user, then it is a permission problem.
The libgphoto2 package is supposed to take care of that, and any "PTP camera" is detected properly. Works fine in Dapper. Did you try with Dapper?
The version in 5.10 (Breezy) is a bit very old.

Revision history for this message
Hubert Figuiere (hub) wrote :

not a gphoto2 problem anyway

Changed in gphoto2:
status: Needs Info → Rejected
Revision history for this message
Hubert Figuiere (hub) wrote :

but eventually libgphoto2.

Changed in libgphoto2:
assignee: nobody → hub
status: Unconfirmed → Needs Info
Revision history for this message
Hamish Cunningham (hamishagain) wrote : Re: [Bug 6602] Re: Workaround for USB digital camera photo download problems

thanks; I will try it in dapper when I get around to upgrading

best
h

Hubert Figuiere wrote:

>if it works as root but not as a standard user, then it is a permission problem.
>The libgphoto2 package is supposed to take care of that, and any "PTP camera" is detected properly. Works fine in Dapper. Did you try with Dapper?
>The version in 5.10 (Breezy) is a bit very old.
>
>** Also affects: libgphoto2 (Ubuntu)
> Importance: Untriaged
> Status: Unconfirmed
>
>
>

___________________________________________________________
Yahoo! Messenger - with free PC-PC calling and photo sharing. http://uk.messenger.yahoo.com

Revision history for this message
Florent Mertens (givre) wrote :

I can confirm that it works for dapper but no more for edgy.
It is a permission problem. When i run digikam as root, i can import my photos, but not as a simple user.
I ran gphoto to have some debug information, and i get this error :

0.018045 gphoto2-port(2): Opening USB port...
0.018093 gphoto2-port(0): Could not query kernel driver of device.
0.018115 gphoto2-port(0): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device.
0.018152 context(0): An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device.

*** Error ***
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device.
*** Error (-53: 'Could not claim the USB device') ***

I attach the all output i get with the command :
env LANG=C gphoto2 --debug --camera "USB PTP Class Camera" -P 2> error_gphoto

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Please somebody with such a camera, run these two commands in a terminal just after plugging in the camera:

eval `grep PHYSDEVPATH= /var/log/udev`
more /sys$PHYSDEVPATH/* > camera-sys.txt

And attach the file camera-sys.txt here.

Revision history for this message
Dan Bishop (danbishop) wrote :

I have a PowerShot A630 and have the same problem.

I have done as requested and attached camera-sys.txt

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Thanks, Dan. But something went wrong, this looks more like a sound card than a camera :) Can you try to check inside /var/log/udev yourself (probably towards the end) and see if you can find the PHYSDEVPATH corresponding to your camera? If this is difficult, attach your /var/log/udev file here. We are interested in what is added to it after plugging in the camera.

Then, copy the right PHYSDEVPATH= line to the command line and do the "more" line again.

Revision history for this message
Dan Bishop (danbishop) wrote :

I've had a look in the file but couldn't find anything. I am a linux n00b though so this is a little over my head. I have attached the file as requested, maybe you can find it. If there is anything else I can do, let me know.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Please check with: tail -f /var/log/udev
(and then plug in your camera) to see if anything at all get added when you plug the camera.

Revision history for this message
Dan Bishop (danbishop) wrote :

No, nothing is added.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Can you try "tail -f /var/log/syslog" and then plug it, and attach what comes out.

Revision history for this message
Dan Bishop (danbishop) wrote :

That produces the following:

Oct 22 21:54:19 lime kernel: [17196414.940000] usb 2-9: new high speed USB device using ehci_hcd and address 11
Oct 22 21:54:19 lime kernel: [17196415.096000] usb 2-9: configuration #1 chosen from 1 choice

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Can you attach the output from "cat /proc/bus/usb/devices" and "lsusb" (when the camera is plugged in of course) ? I am out of ideas for the moment.

Revision history for this message
Dan Bishop (danbishop) wrote :
Download full text (3.6 KiB)

Is it not just some sort of permission error since everything works fine as root?

here are the outputs as asked for:

lsusb
Bus 002 Device 012: ID 04a9:313a Canon, Inc.
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 004: ID 046d:0a01 Logitech, Inc.
Bus 001 Device 003: ID 04b8:0005 Seiko Epson Corp. Stylus Printer
Bus 001 Device 002: ID 046d:c513 Logitech, Inc.
Bus 001 Device 001: ID 0000:0000

cat /proc/bus/usb/devices
T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh=10
B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 2.06
S: Manufacturer=Linux 2.6.17-10-generic ehci_hcd
S: Product=EHCI Host Controller
S: SerialNumber=0000:00:02.1
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=256ms

T: Bus=02 Lev=01 Prnt=01 Port=08 Cnt=01 Dev#= 12 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=04a9 ProdID=313a Rev= 0.02
S: Manufacturer=Canon Inc.
S: Product=Canon Digital Camera
S: SerialNumber=A1CA5758961F4A30AE53D6A786A65DDD
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 2mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=06(still) Sub=01 Prot=01 Driver=(none)
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=83(I) Atr=03(Int.) MxPS= 8 Ivl=64ms

T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh=10
B: Alloc= 4/900 us ( 0%), #Int= 2, #Iso= 0
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 2.06
S: Manufacturer=Linux 2.6.17-10-generic ohci_hcd
S: Product=OHCI Host Controller
S: SerialNumber=0000:00:02.0
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms

T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=046d ProdID=c513 Rev=32.00
S: Manufacturer=Logitech
S: Product=USB Receiver
C:* #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr= 98mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=01 Driver=usbhid
E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=8ms
I: If#= 1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=usbhid
E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=8ms

T: Bus=01 Lev=01 Prnt=01 Port=02 Cnt=02 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=04b8 ProdID=0005 Rev= 1.00
S: Manufacturer=EPSON
S: Product=USB Printer
S: SerialNumber=M58P10411262147300
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 2mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=07(print) Sub=01 Prot=02 Driver=usblp
E: Ad=01(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms

T: Bus=01 Lev=01 Prnt=01 Port=05 Cnt=03 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=046d ProdID=0a01 Rev= 0.21
S: Manufacturer=Logitech
S: Product=Logitech USB Headset
C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
I: If#= 1 Alt= 0 #EPs= 0 Cls=...

Read more...

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Thanks. Yes, it is a permission problems. Usually, the /etc/udev/rules.d/45-libgphoto2.rules takes care of setting right permissions on the device (you can find a class="06" rule near the end of that file). My line of thought was that this rule does not exactly match, hence the need to see the exact parameters of the usb device. Moreover, the class="06" rule is duplicated in the file, so I got suspicious there might be a typo or similar.

However my lack of knowledge about PTP stops me here, I don't know how the PTP code tries to access the device, nor how udev is proceeding when there is no kernel driver claiming the device.

Revision history for this message
Joachim Beckers (jbeckers) wrote :

I have this bug with a canon eos 400D, which makes me think this is a general bug that applies to every possible camera.

I'm attaching the files asked for.

Revision history for this message
Hubert Figuiere (hub) wrote :

given that my 20D works without a glitch in PTP....

make sure you are in the "plugdev" group.

Revision history for this message
Dan Bishop (danbishop) wrote :

There doesn't seem to be such a group on my computer? I am a member of all existing groups though.

Revision history for this message
Hubert Figuiere (hub) wrote :

define all.

what does "id" return?

Revision history for this message
Joachim Beckers (jbeckers) wrote :
Revision history for this message
Joachim Beckers (jbeckers) wrote :
Revision history for this message
Joachim Beckers (jbeckers) wrote :
Revision history for this message
Joachim Beckers (jbeckers) wrote :

output from id:

uid=1000(joachim) gid=1000(joachim) groups=24(cdrom),25(floppy),29(audio),44(video),46(plugdev),107(lpadmin),108(scanner),500(ipod),501(digicam),1000(joachim)

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Hubert, how can we verify that Joachim's camera device has group access for plugdev?

Revision history for this message
Dan Bishop (danbishop) wrote :

Here is the output of id, plugdev is there.

uid=1000(dan) gid=1000(dan) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),108(lpadmin),111(scanner),113(admin),1000(dan)

Revision history for this message
Hubert Figuiere (hub) wrote :

ls -lR /proc/bus/usb

Revision history for this message
Dan Bishop (danbishop) wrote :

Here's the output for me.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Hubert, does the PTP code talk directly to /proc/bus/usb, and not via some /dev device? AFAIK, udev only sets permissions on /dev devices.

Revision history for this message
Hubert Figuiere (hub) wrote :

Sorry it is /dev/bus/usb

I get lost when they change everything.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

So, if dmesg or syslog reports for instance "usb 5-6: new high speed USB device using ehci_hcd and address 7", we should look up "5" and "7" like this: ls -l /dev/bus/usb/005/007
And the group should be "plugdev" and not "root". Can everybody try this, please?

Revision history for this message
Tormod Volden (tormodvolden) wrote :

From what I can see in the /proc/bus/usb/devices outputs kindly posted here their camera device class is not "06". I guess a subdevice of it is. (This should be checked by the /lib/udev/check_ptp_camera script, called by the udev rules file.) Can people try this:
find /sys/devices -name bInterfaceClass -print|xargs grep 06

Alternatively, if anyone is able to find their camera in /sys/devices, please tell us what's in the bInterfaceClass file (of the subdevice).

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Sorry I didn't see this before, but I was sitting on a Dapper machine without access to Edgy. Back on a Edgy machine, things are getting clearer: There is no check_ptp_camera script on Edgy, and the print-camera-list does not seem to produce anything equivalent. It's that simple, print-camera-list is broken^Wreduced in Edgy.

In Dapper, the old "print-udev-rules" produced this line: "PROGRAM="check_ptp_camera", GROUP="plugdev", MODE="0660"

Now what would be interesting is if someone can add the above line to /etc/udev/rules.d/45-libgphoto2.rules and copy over the old check-ptp from Dapper (I'll attach it in case you have lost it on an upgrade).

Revision history for this message
Tormod Volden (tormodvolden) wrote :

A little quotation mark slipped into that line in the previous comment, it should be:
PROGRAM="check_ptp_camera", GROUP="plugdev", MODE="0660"

Revision history for this message
Spano (fauxlklore45) wrote :

Hello,
I had this bug with an HP Photosmart R607.
I am running Edgy Beta currently. Tried what Mr. Volden suggested above and added
 PROGRAM="check_ptp_camera", GROUP="plugdev", MODE="0660"
to the file /etc/udev/rules.d/45-libgphoto2 and inserted the check_ptp_camera script to
/lib/udev It works for me! Attached is my modified /etc/udev/rules.d/45-libgphoto2
Swapped location of group and mode, but don't know if that matters. New line is at very end of file.

Also had camera problem in Debian Etch. Attached are notes for hack that worked in Etch and Edgy Beta.

Regards,
Dan

Revision history for this message
Spano (fauxlklore45) wrote :

Also had camera problem in Debian Etch. Attached are notes for hack that worked in Etch and Edgy Beta.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Spano, the order of GROUP and MODE doesn't matter. Thanks for testing it out!

Revision history for this message
Joachim Beckers (jbeckers) wrote :

I did the check_ptp_camera stuff, and nothing seems to have changed.

some more info:

root@madkeunnen:/home/joachim # dmesg
...
[17180265.340000] usb 4-4: new high speed USB device using ehci_hcd and address 8
[17180265.508000] usb 4-4: configuration #1 chosen from 1 choice

root@madkeunnen:/home/joachim # ls -lR /dev/bus/usb/004/008
crw-rw---- 1 root plugdev 189, 391 Oct 25 14:40 /dev/bus/usb/004/008

root@madkeunnen:/home/joachim # find /sys/devices -name bInterfaceClass -print|xargs grep 06
/sys/devices/pci0000:00/0000:00:10.3/usb4/4-4/4-4:1.0/bInterfaceClass:06

root@madkeunnen:/home/joachim # cat /sys/devices/pci0000\:00/0000\:00\:10.3/usb4/4-4/4-4\:1.0/bInterfaceClass
06

Revision history for this message
Marcus Meissner (meissner) wrote :

argh, dont tell me yoiu have an extra binary...

udev supports als interface class matches which should work here.

The print-camera-list helper in 2..2.1 supports it, if you have older versions use:

SYSFS{bInterfaceClass}=="06", SYSFS{bInterfaceSubClass}=="01", SYSFS{bInterfaceProtocol}=="01", ..your stuff from above...

or:
ATTRS{bInterfaceClass}=="06", ATTRS{bInterfaceSubClass}=="01", ATTRS{bInterfaceProtocol}=="01", ...your stuff from above...

for udev >= 0.98

Ciao, Marcus

Revision history for this message
Joachim Beckers (jbeckers) wrote :

I just found out something really weird. It seems that I/g-s-t has reset the list of groups I'm in. So while id said I was in plugdev, I really wasn't.

Still that doesn't seem to be the issue. I've added myself to plugdev again, but the error is still there.

But, as a positive sign: the check_ptp_camera hack does fix something, since I can access my camera again. gtkam even transfers thumbnails from it. On the other hand, it seems I can't download the full pictures...

Revision history for this message
Marcus Meissner (meissner) wrote :

if it can download thumbnails it can download images too.

if it can't its a gtkam bug ;)

Revision history for this message
Dan Bishop (danbishop) wrote :

Any chance some of these fixes will get into edgy or are we going to have to wait 6months to be able to use our cameras properly? :(

Revision history for this message
Hubert Figuiere (hub) wrote :

for edgy-updates, I don't know. I'm not even sure there is one.

FWIW, mine works fine. both are canon

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Joachim, your usb device has now got the right permissions:
root@madkeunnen:/home/joachim # ls -lR /dev/bus/usb/004/008
crw-rw---- 1 root plugdev 189, 391 Oct 25 14:40 /dev/bus/usb/004/008

Did you log in again after adding yourself to the plugdev group?

Marcus, do you have the possibility to verify the rules vs. versions in Edgy? I think the rules made on Edgy only check Class="6" and not bInterfaceClass="06", but I can not verify this here and now.

Revision history for this message
Marcus Meissner (meissner) wrote :

i am not a Ubuntu user, just a GPHOTO developer, sorry :)

Revision history for this message
Tormod Volden (tormodvolden) wrote :

In Edgy the rules are already like Marcus suggested:

SYSFS{bInterfaceClass}=="06", SYSFS{bInterfaceSubClass}=="01", SYSFS{bInterfaceProtocol}=="01", MODE="0660", GROUP="plugdev"

But they don't seem to work. udev is 0.93. OTOH the script check_ptp_camera apparently works, and consists of this one-liner:
grep -q -F 06 /sys/$PHYSDEVPATH/*/bInterfaceClass

Is the problem that udev doesn't match on the interfaces?

Revision history for this message
Jon Leighton (jonleighton) wrote :

I am affected by this bug. I have a Canon EOS 400D. Tormod Volden's fix works for me, but not always. It seems I can connect to the camera and import photos (using F-Spot) initially, but if I try to do a second import I get the error. A workaround for this is to turn the camera off and on again, effectively resetting the connection.

Let me know if I can provide any info.

Revision history for this message
Jordy Potman (jordypotman) wrote :

I see the same thing as Jon Leighton with my Fuji FinePix F30. After applying Tormod Volden's fix importing pictures works, without it I also get the error. I can also import only one time in F-Spot, but I think that might be an F-Spot bug because after closing and opening F-Spot I can import one time again (probably F-Spot bug http://bugzilla.gnome.org/show_bug.cgi?id=168091). With gThumb I can import two times in a row without problems.

Revision history for this message
Hamish Cunningham (hamishagain) wrote :

Hi,

I originally opened this bug in relation to 5.10 / Breezy with
a Canon IXUS 7. Just thought I'd let you know that this works fine
for me under 6.06/Dapper.

Probably too late to be any use :-(

Best

Hamish Cunningham
Send instant messages to your online friends http://uk.messenger.yahoo.com

Revision history for this message
Hubert Figuiere (hub) wrote :

then since it works for reporter, consider released
for the other, please file new bugs.

Changed in libgphoto2:
status: Needs Info → Fix Released
Revision history for this message
Tormod Volden (tormodvolden) wrote :

I believe these problems (all but the original reporter's) are taken care of in bug #63473.

Revision history for this message
Joachim Beckers (jbeckers) wrote :

I can confirm that the check_ptp_camera workaround fixes this bug.

Revision history for this message
Scott Lewin (sclewin) wrote :

My HP M22 also does not work under Edgy. It is identified correctly, but upon trying to get the pictres I get this error message:

 "An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device."

If I select disk drive under the camera's setting on the camera, Edgy sees the camera as a pictre storage device and I am able to get the pictures from the camera.

----
Scott

Revision history for this message
Hubert Figuiere (hub) wrote :

this is ultimately a dupe of bug 67532

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.