CHDKPTP r921 (Raspberry Pi) - Camera connection failing - General Discussion and Assistance - CHDK Forum

CHDKPTP r921 (Raspberry Pi) - Camera connection failing

  • 3 Replies
  • 598 Views
CHDKPTP r921 (Raspberry Pi) - Camera connection failing
« on: 15 / February / 2020, 22:01:09 »
Advertisements
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)

*

Online reyalp

  • ******
  • 12593
Re: CHDKPTP r921 (Raspberry Pi) - Camera connection failing
« Reply #1 on: 16 / February / 2020, 00:20:38 »
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
Code: [Select]
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.
Don't forget what the H stands for.

Re: CHDKPTP r921 (Raspberry Pi) - Camera connection failing
« Reply #2 on: 16 / February / 2020, 02:04:41 »
Thanks for the prompt and helpful reply!

Quote
Is the camera connected directly to the pi, or through a USB hub?

Connected directly

Quote
What model is the pi?

Raspberry Pi 4 Model B

Quote
Is the pi running a GUI desktop?

No, it's headless

Quote
Check the kernel log (dmesg output) after you get the failed case

The log only changes when I initially plug in the camera; no change occurs as I get the error. Below are the additions to the log file from the moment of plugging in the camera until after the two commands I had previously:
Code: [Select]
[  417.911340] usb 1-1.3: new high-speed USB device number 5 using xhci_hcd
[  418.043054] usb 1-1.3: New USB device found, idVendor=04a9, idProduct=325b, bcdDevice= 0.02
[  418.043070] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  418.043083] usb 1-1.3: Product: Canon Digital Camera
[  418.043096] usb 1-1.3: Manufacturer: Canon Inc.
[  418.043108] usb 1-1.3: SerialNumber: 110F664D4F364581A15FCA947FF71530


Code: [Select]
set usb_reset_on_close=true
Did the trick! Looks like that was the issue!


Thank you for the help!
« Last Edit: 16 / February / 2020, 02:46:25 by repurposeresearch »

*

Online reyalp

  • ******
  • 12593
Re: CHDKPTP r921 (Raspberry Pi) - Camera connection failing
« Reply #3 on: 16 / February / 2020, 02:43:42 »
Did the trick! Looks like that was the issue!

Thank you for the help!
I'm glad to hear that fixes it, and thanks for the detailed response.

Would be nice to figure out why the reset is required. I'd be interested to know if other pi 4 users see this problem, I've only tested on an original B and 3B+

Don't forget what the H stands for.


 

Related Topics