I'm using CHDKPTP to control two Canon A2200s to capture images of books.
For this, I wrote a small
program that (among a bunch of other stuff) wraps the 'chdkptp' CLI utility, sets up the cameras and controls the triggering.
My problem is this: When I trigger both cameras simultaneously, using two separate 'chdkptp' processes, each directly connecting to the desired device via the '-c' flag, the triggering goes well for up 40 captures on each camera, but inevitably at some point in the process I get a
"WARNING: capture_get_data error timed out" message and a subsequent
"ERROR: timed out" message, after which the program exits without a picture being taken. After this has taken place, I can no longer perform PTP actions on the device and have to reset it by powering it on and off.
Some facts/observations from my debugging sessions:
- Both devices are on the same USB-Bus, directly attached to the host machines. I cannot use separate buses as none of my machines expose more than one bus to the outside.
- While control via USB fails, the UI is still responsive on the timed out device
- The error seems to be machine-independent: I tried with two different Raspberry Pis and my Thinkpad S430 (running Raspbian/Debian), all of which exhibited the problem
- The error seems to be independent from the individual cameras: During some sessions I get the timeout from the first, during others from the second. Until I plug/unplug the devices it is the same camera that times out, though.
- The number of shots it takes for one device to time out differs from host to host: My first Raspberry usually times out after 20-40 shots, the second one after ~5, while my laptop usually manages around 10 shots before the inevitable happens.
- On each device, I get USB resets in the kernel message log. This happens on every shot, though, not just the ones that time out. Also, it resets on both devices, not just the one that later has the timeout.
Here's one example log entry from one of the Raspberry Pis:
usb 1-1.2: reset high-speed USB device number 4 using dwc_otg
On the Thinkpad it looks like this:
usb 1-3: reset high-speed USB device number 9 using xhci_hcd
Some information on my setup:
- Raspberry Pi #1/#2: Model B, Latest raspbian update (Kernel 3.10.24) with fresh firmware, no USB-Hub, powered by a 2A power supply
- Thinkpad S430: Debian unstable, latest updates, Kernel 3.12.0
- Cameras: Two Canon A2200s, powered by two third-party power supplies
- CHDK: CHDK 1.2.0, Build Revision 3262
- CHDKPTP: r468, tried with latest SVN, too, made no difference
Any help with this would be greatly appreciated, be it hints on how to debug this further or alternate approaches to the triggering of multiple devices, anything :-)
======
Update:Some further debugging revelead that the timeouts also appear when using only one camera. Interestingly enough, one of the cameras will reliably timeout 100% of the time, after roughly 60 shots, while the other only times out in roughly 1 of 5 cases (tested by shooting 5x200 images).