I've been working on debugging the issue and believe I have a root cause. For 
the Z7 Nikon uses a Vendor Extension ID of 0xffffffff rather than the expected 
PTP_VENDOR_NIKON (0xa). I saw this in the dump generated by 
print_debug_deviceinfo(), and confirmed that this is in fact the ID Nikon 
intended to send by reviewing Nikon's MTP spec for the Z7 (spec downloadable on 
Nikon's under NDA at https://sdk.nikonimaging.com/apply/).

To fix this I modified fixup_cached_deviceinfo() to detect an ID of 0xffffffff 
and change it to di->VendorExtensionID to PTP_VENDOR_NIKON. I'm not familiar 
enough with the libgphoto2 codebase to make an official change myself so 
perhaps one of the maintainers on this thread can do so? Here's the code I 
added, with some surrounding code for context (look for the "horshack-horshack" 
block):

if (di->VendorExtensionID == PTP_VENDOR_FUJI) {
        C_MEM (di->DevicePropertiesSupported = 
realloc(di->DevicePropertiesSupported,sizeof(di->DevicePropertiesSupported[0])*(di->DevicePropertiesSupported_len
 + 5)));
        di->DevicePropertiesSupported[di->DevicePropertiesSupported_len+0] = 
PTP_DPC_ExposureTime;
        di->DevicePropertiesSupported[di->DevicePropertiesSupported_len+1] = 
PTP_DPC_FNumber;
        di->DevicePropertiesSupported[di->DevicePropertiesSupported_len+2] = 
0xd38c;    /* PC Mode */
        di->DevicePropertiesSupported[di->DevicePropertiesSupported_len+3] = 
0xd171;    /* Focus control */
        di->DevicePropertiesSupported[di->DevicePropertiesSupported_len+4] = 
0xd21c;    /* Needed for X-T2? */
        di->DevicePropertiesSupported_len += 5;
    }

    /* Nikon DSLR hide its newer opcodes behind another vendor specific query,
     * do that and merge it into the generic PTP deviceinfo. */
    /* horshack-horshack */
    if (di->VendorExtensionID == 0xffffffff && di->Manufacturer && 
!strcmp(di->Manufacturer,"Nikon Corporation")) {
        GP_LOG_D("Changing Vendor Extension ID from 0xffffffff to 
PTP_VENDOR_NIKON");
        di->VendorExtensionID = PTP_VENDOR_NIKON;
    }
    /* horshack-horshack */

    if (di->VendorExtensionID == PTP_VENDOR_NIKON) {
        unsigned int i;
        unsigned int nikond;

        /* Nikon V* and J* advertise the new Nikon stuff, but only do the 
generic
         * PTP capture. FIXME: could use flags. */
        if (params->deviceinfo.Model && (



Adam

________________________________
From: Horshack ?? <horsh...@live.com>
Sent: Saturday, November 10, 2018 7:23 AM
To: gphoto-devel@lists.sourceforge.net
Subject: [gphoto-devel] Request to add Nikon Z7 camera

Hi,

Attached is the information needed to add the Nikon Z7 to the list of cameras 
supported by gphoto (as described here: 
http://gphoto.org/proj/libgphoto2/support.php).

The Z7 works with the existing gphoto but is not recognizing the Nikon-specific 
MTP opcodes. When I run list-config --debug I don't see the 
PTP_OC_NIKON_GetVendorPropCodes issued to the Z7, which causes the 
Nikon-specific MTP opcodes to be reported as "unknown" later in the debug 
output. Here's a snippet:

0.098128 print_debug_deviceinfo      (2):   0x90c0 (Unknown PTP_OC)
0.098136 print_debug_deviceinfo      (2):   0x90c1 (Unknown PTP_OC)
0.098145 print_debug_deviceinfo      (2):   0x90c2 (Unknown PTP_OC)
0.098153 print_debug_deviceinfo      (2):   0x90c3 (Unknown PTP_OC)

Thanks!

Adam

_______________________________________________
Gphoto-devel mailing list
Gphoto-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gphoto-devel

Reply via email to