Skip to content

gphoto2 usb transfer fails with USB timeouts #218

Closed
@drott

Description

@drott

I am using latest gphoto2 2.5.1, compiled against libusb 1.0.11-dev to transfer data between the Raspberry Pi (Model B) and a Canon EOS 7D.

Latest Raspbian kernel, firmware up to date according to rpi-update. Issue is reproducible 100%, even if the camera is the only connected device.

Any larger transfers fail. Using the usbreset tool I can get smaller transfers to work, like getting the camera identification and the list of files. However, any larger transfer fails with gphoto2 reporting:
"PTP I/O error"

After doing my research in the forums, etc. I believe this is down to the USB driver.

The camera is not charging over the bus, so I don't think it's a problem with the power supply.

$ lsusb -v -d 04a9:319a
[...]
bmAttributes 0xc0
Self Powered
MaxPower 2mA
[...]

The initial successful run of
$ strace gphoto2 --summary
looks like this:
open("/dev/bus/usb/001/006", O_RDWR) = 3
ioctl(3, USBDEVFS_GETDRIVER, 0xbee2e7a0) = -1 ENODATA (No data available)
ioctl(3, USBDEVFS_CLAIMINTERFACE, 0xbee2e89c) = 0
brk(0x5b4000) = 0x5b4000
gettimeofday({1360545142, 358972}, NULL) = 0
ioctl(3, USBDEVFS_SUBMITURB or USBDEVFS_SUBMITURB32, 0xbee2db00) = 0
ioctl(3, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbee2db44) = -1 EAGAIN (Resource temporarily unavailable)
select(4, NULL, [3], NULL, {0, 1000}) = 1 (out [3], left {0, 668})
gettimeofday({1360545142, 360720}, NULL) = 0
ioctl(3, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbee2db44) = 0
gettimeofday({1360545142, 361438}, NULL) = 0
ioctl(3, USBDEVFS_SUBMITURB or USBDEVFS_SUBMITURB32, 0xbee2daf0) = 0
ioctl(3, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbee2db34) = -1 EAGAIN (Resource temporarily unavailable)
select(4, NULL, [3], NULL, {0, 1000}) = 1 (out [3], left {0, 526})
gettimeofday({1360545142, 363257}, NULL) = 0
ioctl(3, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbee2db34) = 0
gettimeofday({1360545142, 363958}, NULL) = 0
ioctl(3, USBDEVFS_SUBMITURB or USBDEVFS_SUBMITURB32, 0xbee2dae0) = 0
ioctl(3, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbee2db24) = -1 EAGAIN (Resource temporarily unavailable)
select(4, NULL, [3], NULL, {0, 1000}) = 1 (out [3], left {0, 669})
gettimeofday({1360545142, 365747}, NULL) = 0
ioctl(3, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbee2db24) = 0
gettimeofday({1360545142, 366404}, NULL) = 0
ioctl(3, USBDEVFS_SUBMITURB or USBDEVFS_SUBMITURB32, 0xbee2da90) = 0
ioctl(3, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbee2dad4) = -1 EAGAIN (Resource temporarily unavailable)
select(4, NULL, [3], NULL, {0, 1000}) = 1 (out [3], left {0, 545})
gettimeofday({1360545142, 368154}, NULL) = 0

So, there are some EAGAIN errors, mixed with no-error return values, some transfer happens.

When running
$ strace gphoto2 --summary
the second time the trace shows gphoto2 running into a loop retrying the USBDEVFS_REAPURBNDELAY ioctl:

open("/dev/bus/usb/001/004", O_RDWR) = 3
ioctl(3, USBDEVFS_GETDRIVER, 0xbeb177a0) = -1 ENODATA (No data available)
ioctl(3, USBDEVFS_CLAIMINTERFACE, 0xbeb1789c) = 0
brk(0x1e1b000) = 0x1e1b000
gettimeofday({1360544691, 758533}, NULL) = 0
ioctl(3, USBDEVFS_SUBMITURB or USBDEVFS_SUBMITURB32, 0xbeb16b00) = 0
ioctl(3, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbeb16b44) = 0
gettimeofday({1360544691, 759605}, NULL) = 0
ioctl(3, USBDEVFS_SUBMITURB or USBDEVFS_SUBMITURB32, 0xbeb16af0) = 0
ioctl(3, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbeb16b34) = -1 EAGAIN (Resource temporarily unavailable)
select(4, NULL, [3], NULL, {0, 1000}) = 0 (Timeout)
gettimeofday({1360544691, 762015}, NULL) = 0
ioctl(3, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbeb16b34) = -1 EAGAIN (Resource temporarily unavailable)
select(4, NULL, [3], NULL, {0, 1000}) = 0 (Timeout)
gettimeofday({1360544691, 763995}, NULL) = 0
[...]

I have not managed to retrieve any files from the camera.

Testing this on an X86 debian system with the same software (i.e. gphoto2 2.5.1, libusb 1.0.11 works fine).

Please let me know if you need more info or if I can help with doing additional diagnosis/debugging with different tools using my setup here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions