I've been using the r795 release on my Raspberry Pi for some time now and have not had any notable issues. Today, I tried the (relatively) new release r921 on the same Pi and I'm running into a weird connection problems. After connecting the camera via USB, I can connect with no problem (see command below). Without touching the camera or USB, if I repeat that same command, I get the error shown below. The only way I've found to overcome this error is by manually restarting the camera via the power button. I can of course continue using r795 and avoid this problem; this is simply a journey of curiosity (and maybe bug fixing?).
>> sudo ./chdkptp.sh -c
connected: Canon PowerShot S110, max packet size 512
>> sudo ./chdkptp.sh -c
open_camera_dev_usb: ptp_opensession failed 0x2ff
Device status OK
open_camera_dev_usb: ptp_opensession 2 failed: 0x2ff
ERROR: connection failed
My kernel is: 4.19.97-v7l+
My rasbian release is: 10 (buster)
That's odd. I haven't seen that issue on any of the OSes I use, including raspbian 9 and 10.
Some information that might help:
Is the camera connected directly to the pi, or through a USB hub?
What model is the pi?
Is the pi running a GUI desktop?
Check the kernel log (dmesg output) after you get the failed case.
One change that might be related is that chdkptp before 921 sends a device reset when closing the connection. 921 does not by default. You can get the old behavior with
set usb_reset_on_close=true
To have this set on startup, you can add it to the user.chdkptp file. The default location for this is in .chdkptp in the current users's $HOME, but you can override that with CHDKPTP_HOME
FWIW, you should not need to use sudo if you set permissions as described at the end of
https://app.assembla.com/spaces/chdkptp/wiki/Install but I don't see the problem if I use sudo either.