gphoto / libgphoto2

The libgphoto2 camera access and control library.
GNU Lesser General Public License v2.1
989 stars 316 forks source link

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

Open NateEaton opened 4 months ago

NateEaton commented 4 months ago

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.

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

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

  2. 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