gphoto/libgphoto2

Unable to correctly set Exposure Delay Mode on PTP / Nikon DSLR

NateEaton opened this issue · 0 comments

Describe the bug
As written, libgphoto2 code for PTP cameras including Nikon DSLRs like my D750, appears to be using incorrect parameters. Here are the current parameter codes and assigned meanings (per github):
Choice 0: On
Choice 1: Off

Per Nikon SDK documentation, here are the proper parameters (sourced from Nikon SDK document D750UsbMtpE_01.pdf):
Choice 0: 3 second delay
Choice 1: 2 second delay
Choice 2: 1 second delay
Choice 3: Off

Based on this, it appears:

  1. When a gphoto2 command is sent to set exposure delay On (0), the code is telling a Nikon camera to set delay to 3 seconds*.
  2. When a gphoto2 command is sent to set delay Off (1), the code is telling Nikon camera to set delay to 2 seconds*.
  3. There is currently no way to actually turn exposure delay mode off on a Nikon camera using gphoto2.
  • For reasons I cannot explain, what I actually observe on my camera is that when gphoto2 command is sent to set exposure delay mode parameter to 0, the actual setting on the D750 is 2 seconds and when the command is sent to set exposure delay mode parameter to 1, the actual setting on the camera is 3 seconds.

Name the camera

$ gphoto2 --auto-detect
Model                          Port                                            
----------------------------------------------------------
Nikon DSC D750                 usb:001,004    

libgphoto2 and gphoto2 version

$ gphoto2 --version
gphoto2 2.5.27

Copyright (c) 2000-2021 Marcus Meissner and others

gphoto2 comes with NO WARRANTY, to the extent permitted by law. You may
redistribute copies of gphoto2 under the terms of the GNU General Public
License. For more information about these matters, see the files named COPYING.

This version of gphoto2 is using the following software versions and options:
gphoto2         2.5.27         gcc, popt(m), exif, cdk, aa, jpeg, readline
libgphoto2      2.5.31.1       standard camlibs, gcc, no ltdl, EXIF
libgphoto2_port 0.12.2         iolibs: disk ptpip serial usb1 usbdiskdirect usbscsi, gcc, no ltdl, EXIF, USB, serial without locking

To Reproduce
Although I initially discovered this issue using INDI and INDI client EKOS, I reproduced all the same conditions using gphoto2 at commandline. The following steps cover that but I've added comments at points where I manually checked the state of my camera.

On boot of the computer (Raspberry Pi 4 running StellerMate OS) with the Nikon D750 connected via USB cable and powered on, first step is checking the initial state of exposuredelaymode. I went through on the camera and set each of the supported exposure delay modes and ran the following command:

gphoto2 --get-config exposuredelaymode

Here is the result of those checks:

State of camera Nikon SDK parameter Current state reported by gphoto2
Off 3 On
1 Sec 2 On
2 sec 1 On
3 sec 0 Off
  • This is similar to the inconsistency I noted above. In this case, even though libgphoto2 in github shows that 0 is supposed to map to On and 1 is supposed to map to Off, using get-config 0 appears mapped to Off and 1 appears mapped to On.

Here are the rest of the steps to reproduce the issue.

  1. Set exposure delay mode On
$ gphoto2 --set-config exposuredelaymode=0 --debug --debug-logfile=exposuredelaymode_0_debug.log
$ gphoto2 --get-config exposuredelaymode           
Label: Exposure Delay Mode                                                     
Readonly: 0
Type: RADIO
Current: On
Choice: 0 On
Choice: 1 Off
END

Checking camera, delay is 2 seconds

  1. Set exposure delay mode Off
$ gphoto2 --set-config exposuredelaymode=1 --debug --debug-logfile=exposuredelaymode_1_debug.log
$ gphoto2 --get-config exposuredelaymode           
Label: Exposure Delay Mode                                                     
Readonly: 0
Type: RADIO
Current: Off
Choice: 0 On
Choice: 1 Off
END

Checking camera, delay is 3 seconds

I am also attaching the debug logs.

exposuredelaymode_0_debug.log
exposuredelaymode_1_debug.log