Parsing unknown PTP options

Omri Sarig via Gphoto-devel <[email protected]> Tue, 27 Sep 2022 09:10:07 +0000
Newsgroups gmane.comp.multimedia.gphoto.devel
Message-ID <AM9PR10MB4452BFCAA7C031ABF4DEAA4981559@AM9PR10MB4452.EURPRD10.PROD.OUTLOOK.COM>
Hello,

I'm very new to libgphoto2 development, and would greatly appreciate some help or references.

In short:
I'm missing some functionality with my camera that I believe to be provided through unparsed PTP options. I'm looking into parsing the unknown PTP options to try and understand what option is relevant for the command I'm missing and add it.

Full description:

I have a camera (Nikon Z9<https://www.nikonusa.com/en/nikon-products/product/mirrorless-cameras/z-9.html>) that I'm trying to control remotely using a Linux machine.

Using libgphoto2 (both by writing my own code or the gphoto2 frontend), I can connect to the camera, print information about it and do basic actions (such as taking pictures or videos and doing file operations).

However, there is functionality that I'm missing.
The camera has a switch that controls the mode it is in (video or photos), the camera cannot take pictures while in video mode, and cannot take videos while in photos mode. When I'm using the camera's provided software (camera control pro 2<https://downloadcenter.nikonimglib.com/en/products/165/Camera_Control_Pro_2.html>, available only for Windows), I can change this mode, however, I cannot do it using libgphoto2.
My assumption is that one of the unknown PTP codes contains the command to change this mode.

When looking at the log of a connection to the camera (provided), I can see that there are quite a lot of PTP options that are unknown to libgphoto2 (lines 473 to 600). I want to try and understand what these options are in practice, and use the ones relevant to my needs.
I could not find any reference for the full commands, so I assume they were reverse-engineered out of the cameras? Are there any full documents that might include these commands?
My thoughts for reverse engineering the PTP commands:

  *   Bruteforcing - Since I know the option I want to change is binary, trying to send all the unknown commands as a command with a single parameter, changing this parameter and seeing whether I can see the change that I want in the camera.
  *   Sniffing - Using the windows program that changes this option while sniffing the USB communication, trying to figure out what command is sent while changing this option.

My main questions:

  *   As stated above, can there be any relevant documents that describe these commands, so I won't have to reverse-engineer them?
  *   Is there a standard operation for reverse engineering of PTP options? Are there any more solutions to figure out how these PTP options are set and can be controlled?
  *   How likely it is that I'm barking at the wrong tree? Meaning that there might be another layer of communication between the windows program and the camera, which is not through PTP commands, or that some of my assumptions are wrong, or I missed something fundamental and basic with libgphoto2 usage.

Any response and help will be greatly appreciated.

With Kind Regards,

Omri Sarig,

Software Engineer

[e-brev2]

Visit: Lyskær 3EF, DK-2730 Herlev

Mobile: +45 28 49 42 27

[email protected]

www.prevas.dk<http://www.prevas.dk>

_______________________________________________
Gphoto-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Outlook-e-brev2.png (image/png, 8.3 KB) - not displayed
summary_output.txt (text/plain, 103.3 KB) - not displayed