From: <mar...@us...> - 2008-11-23 12:29:21
|
Revision: 11566 http://gphoto.svn.sourceforge.net/gphoto/?rev=11566&view=rev Author: marcusmeissner Date: 2008-11-23 12:29:18 +0000 (Sun, 23 Nov 2008) Log Message: ----------- rewrote hidden Nikon property code to handle various sets of hidden properties. Modified Paths: -------------- trunk/libgphoto2/camlibs/ptp2/library.c Modified: trunk/libgphoto2/camlibs/ptp2/library.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/library.c 2008-11-23 12:17:50 UTC (rev 11565) +++ trunk/libgphoto2/camlibs/ptp2/library.c 2008-11-23 12:29:18 UTC (rev 11566) @@ -236,22 +236,38 @@ } } -const static uint16_t nikon_extra_props[] = { -0xd10b, -0xd017, 0xd018, 0xd019, 0xd01a, 0xd01b, 0xd01c, 0xd01d, -0xd02a, 0xd02b, 0xd02c, 0xd02d, -0xd054, -0xd062, 0xd064, 0xd066, 0xd06b, -0xd091, 0xd092, +/* Observed on Nikon D80, just probing 0xd000 - 0xd1ff. See #if 0'ed code + * below. -Marcus */ +const static uint16_t nikon_d80_extra_props[] = { +0xd017, 0xd018, 0xd019, 0xd01a, 0xd01b, 0xd01c, 0xd01d, 0xd01e, 0xd01f, +0xd025, 0xd026, 0xd02a, 0xd02b, 0xd02c, 0xd02d, +0xd045, 0xd04f, +0xd052, 0xd054, 0xd056, 0xd058, 0xd059, 0xd05e, 0xd05f, +0xd062, 0xd063, 0xd064, 0xd06a, 0xd06b, 0xd06c, 0xd06f, +0xd070, 0xd075, 0xd077, 0xd078, 0xd07a, +0xd084, 0xd086, 0xd08a, +0xd090, 0xd091, 0xd092, +0xd0c0, 0xd0c1, 0xd0c2, 0xd0c3, 0xd0c4, 0xd0c5, 0xd0e0, 0xd0e1, 0xd0e2, 0xd0e3, 0xd0e4, 0xd0e5, 0xd0e6, -0xd100, 0xd101, 0xd102, 0xd103, 0xd105, 0xd108, 0xd109, 0xd10e, -0xd120, 0xd124, 0xd126, -0xd140, 0xd142, -0xd161, 0xd16a, -0xd1b0, 0xd1b1, 0xd1b2, -0xd1c0, 0xd1e1 +0xd100, 0xd101, 0xd102, 0xd103, 0xd104, 0xd105, 0xd106, 0xd108, 0xd109, 0xd10b, 0xd10d, 0xd10e, +0xd120, 0xd121, 0xd122, 0xd124, 0xd125, 0xd126, +0xd140, 0xd142, 0xd143, 0xd144, 0xd145, 0xd146, +0xd160, 0xd161, 0xd163, 0xd164, 0xd165, 0xd166, 0xd167, 0xd169, 0xd16a, 0xd16b, 0xd16c, 0xd16d, 0xd16f, +0xd181, 0xd182, 0xd183, +0xd1b0, 0xd1b1, +0xd1c0, 0xd1c1, +0xd1d0, 0xd1d1, 0xd1d2, 0xd1d3, 0xd1d4, 0xd1d5, 0xd1d6, 0xd1d7, 0xd1d8, 0xd1d9, 0xd1da, 0xd1db, 0xd1dc }; +static const struct { + uint16_t productid; + const uint16_t *extraprops; + int nrextraprops; +} nikon_extra_props[] = { + /* D80 - confirmed by Marcus */ + { 0x412, nikon_d80_extra_props, sizeof(nikon_d80_extra_props)/sizeof(nikon_d80_extra_props[0]) } +}; + void fixup_cached_deviceinfo (Camera *camera, PTPDeviceInfo *di) { CameraAbilities a; @@ -278,13 +294,21 @@ if ( (di->VendorExtensionID == PTP_VENDOR_NIKON) && (camera->pl->bugs & PTP_NIKON_SUPPRESSED_PROPS) ) { - int i; - di->DevicePropertiesSupported = realloc(di->DevicePropertiesSupported,sizeof(di->DevicePropertiesSupported[0])*(di->DevicePropertiesSupported_len + sizeof(nikon_extra_props)/sizeof(nikon_extra_props[0]))); - for (i=0;i<sizeof(nikon_extra_props)/sizeof(nikon_extra_props[0]);i++) - di->DevicePropertiesSupported[i+di->DevicePropertiesSupported_len] = nikon_extra_props[i]; - di->DevicePropertiesSupported_len += sizeof(nikon_extra_props)/sizeof(nikon_extra_props[0]); + int i,j; + + for (j=0;j<sizeof(nikon_extra_props)/sizeof(nikon_extra_props[0]);j++) { + if (nikon_extra_props[j].productid == a.usb_product) + break; + } + if (j==sizeof(nikon_extra_props)/sizeof(nikon_extra_props[0])) + j=0; /* just use the first one as default */ + + di->DevicePropertiesSupported = realloc(di->DevicePropertiesSupported,sizeof(di->DevicePropertiesSupported[0])*(di->DevicePropertiesSupported_len + nikon_extra_props[j].nrextraprops)); + for (i=0;i<nikon_extra_props[j].nrextraprops;i++) + di->DevicePropertiesSupported[i+di->DevicePropertiesSupported_len] = nikon_extra_props[j].extraprops[i]; + di->DevicePropertiesSupported_len += nikon_extra_props[j].nrextraprops; #if 0 - /* hardcore hack ... just query d000 -> d1ff */ + /* hardcore hack ... just query d000 -> d1ff ... */ di->DevicePropertiesSupported = realloc(di->DevicePropertiesSupported,sizeof(di->DevicePropertiesSupported[0])*(di->DevicePropertiesSupported_len + 2*256)); for (i=0;i<2*256;i++) di->DevicePropertiesSupported[i+di->DevicePropertiesSupported_len] = 0xD000 | i; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |