On Tue, Aug 18, 2020 at 10:58:41PM +0200, Nicole Faerber wrote:
> Hi,
> first of all my apologies, I am not subscribed to the dev list and
> frankly do not intend to since my interest and question is very
> specific.
> 
> I just got myself a new camera, a Nikon Keymission 360, and was happy
> to see that it is already partially supported with Gphoto2.
> 
> But there are quite a number of properties which are not supported (or
> reported?) yet but which I think I can identify - by looking at the
> Android app and e.g. comparing values. For example I am pretty sure
> that:
> 
> Property 0xd323:(readwrite) (type=0x6) Enumeration [50,100,300,600]
> value: 50
> 
> is the movie loop length in 1/10 of a minute, i.e. 5, 10, 30 or 60
> minutes, and so on. I would very much like to contribute all my
> findings so that the output of Gphoto becomes overall more complete and
> more useful.
> 
> I looked at the sourcecode and have to admit to e a bit overwhelmed.
> The only reference to the KeyMission 360 camera I found was in
>       camlibs/ptp2/cameras/nikon-keymission360.txt
> But I was not able to find anything that would suggest that these files
> get parsed at any time? So I guess putting more property descriptions
> there will likely not end up in the library?
> 
> If someone could briefly explain to me how to add further properties
> for an existing camera (esp. the Nikon KeyMission 360) then I will
> gladly do and test this and then create a patch / merge request.

The cameras/* files are debug files and not used during build of the library.

To get them in

- you can either add it to the code yourself and send a patch,
- or describe the property and I can turn it into code.

  E.g. I could work with what you describe already and put it into code.

  (I am fine with doing that.)

To add it to the code:

So unknown properties to the code:

- add #defines by name to ptp.h

  (search for PTP_DPC_NIKON_  and put them into the list, sorted by the numeric 
value).

  You will need to invent a name, like e.g. PTP_DPC_NIKON_MovieLoopLength


- Name decoding for --summary ... 

  This is done via a ptp.c mapping entry, look for the 
ptp_device_properties_Nikon[] = 
  table.

  This will only change the output of summary. (and the generic property 
handling in set-config / get-config)


- Hook it up as configurable in config.c

  This is for --set-config and --list-config availability. 

  There are various decoder tables in config.c, this seems a capture setting, 
so look for

  nikon_generic_capture_settings

  and add a line with "movielooplength" 

                                                                                
        v the name you used in ptp.h                                    v this 
is 6 for the data type
          { N_("Movie Loop Length"),                  "movielooplength",        
     PTP_DPC_NIKON_MovieLoopLength,            PTP_VENDOR_NIKON,   
PTP_DTC_UINT32,  _get_INT,            _put_INT },

  This will just reflect this as number directly. For correct decoding it needs 
an own function ... 
  You can use either an existing one, or write a new one.

I wrote some code by your description and put it into libgphoto2 GIT and also 
attached the patch here.

Ciao, Marcus
commit 3c38f273dfd8678db6e5e8abc7d7357c7a02f4c9
Author: Marcus Meissner <mar...@jet.franken.de>
Date:   Wed Aug 19 08:49:02 2020 +0200

    added nikon keymission 0xd323 property for movielooplength

diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c
index 34ccba7de..e45697582 100644
--- a/camlibs/ptp2/config.c
+++ b/camlibs/ptp2/config.c
@@ -1904,6 +1904,48 @@ _put_Nikon_HueAdjustment(CONFIG_PUT_ARGS)
        return (GP_ERROR);
 }
 
+static int
+_get_Nikon_MovieLoopLength(CONFIG_GET_ARGS) {
+
+       if (dpd->DataType != PTP_DTC_UINT32)
+               return GP_ERROR;
+
+       if (dpd->FormFlag & PTP_DPFF_Enumeration) {
+               char buf[20];
+               int i, isset = FALSE;
+
+               gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget);
+               gp_widget_set_name (*widget,menu->name);
+               for (i = 0; i<dpd->FORM.Enum.NumberOfValues; i++) {
+
+                       sprintf (buf, "%d", 
dpd->FORM.Enum.SupportedValue[i].u32/10);
+                       gp_widget_add_choice (*widget, buf);
+                       if (dpd->FORM.Enum.SupportedValue[i].u32 == 
dpd->CurrentValue.u32) {
+                               gp_widget_set_value (*widget, buf);
+                               isset = TRUE;
+                       }
+               }
+               if (!isset && (dpd->FORM.Enum.NumberOfValues > 0)) {
+                       sprintf (buf, "%d", 
dpd->FORM.Enum.SupportedValue[0].u32/10);
+                       gp_widget_set_value (*widget, buf);
+               }
+               return GP_OK;
+       }
+       return GP_ERROR;
+}
+
+static int
+_put_Nikon_MovieLoopLength(CONFIG_PUT_ARGS)
+{
+       char *val;
+       int ival;
+
+       CR (gp_widget_get_value(widget, &val));
+       sscanf (val, "%d", &ival);
+       propval->u32 = ival*10;
+       return GP_OK;
+}
+
 
 static struct deviceproptableu8 canon_quality[] = {
        { N_("undefined"),      0x00, 0 },
@@ -9479,6 +9521,7 @@ static struct submenu nikon_generic_capture_settings[] = {
        { N_("Maximum continuous release"),     "maximumcontinousrelease",  
PTP_DPC_NIKON_D2MaximumShots,           PTP_VENDOR_NIKON,   PTP_DTC_UINT8,  
_get_Range_UINT8,                   _put_Range_UINT8 },
        { N_("Movie Quality"),                  "moviequality",             
PTP_DPC_NIKON_MovScreenSize,            PTP_VENDOR_NIKON,   PTP_DTC_UINT8,  
_get_Nikon_MovieQuality,            _put_Nikon_MovieQuality },
        { N_("Movie Quality"),                  "moviequality",             
PTP_DPC_NIKON_1_MovQuality,             PTP_VENDOR_NIKON,   PTP_DTC_UINT8,  
_get_Nikon_1_MovieQuality,          _put_Nikon_1_MovieQuality },
+       { N_("Movie Loop Length"),              "movielooplength",          
PTP_DPC_NIKON_MovieLoopLength,          PTP_VENDOR_NIKON,   PTP_DTC_UINT32, 
_get_Nikon_MovieLoopLength,         _put_Nikon_MovieLoopLength },
        { N_("High ISO Noise Reduction"),       "highisonr",                
PTP_DPC_NIKON_1_HiISONoiseReduction,    PTP_VENDOR_NIKON,   PTP_DTC_UINT8,  
_get_Nikon_1_HighISONR,             _put_Nikon_1_HighISONR },
 
        { N_("Raw Compression"),                "rawcompression",           
PTP_DPC_NIKON_RawCompression,           PTP_VENDOR_NIKON,   PTP_DTC_UINT8,  
_get_Nikon_RawCompression,          _put_Nikon_RawCompression },
diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c
index e02dc32c9..752b0e296 100644
--- a/camlibs/ptp2/ptp.c
+++ b/camlibs/ptp2/ptp.c
@@ -6203,6 +6203,7 @@ ptp_get_property_description(PTPParams* params, uint16_t 
dpc)
                {PTP_DPC_NIKON_LiveViewTFTStatus,"LiveViewTFTStatus"},
                {PTP_DPC_NIKON_MovieAutoDxCrop,"MovieAutoDxCrop"},
                {PTP_DPC_NIKON_MovieChangePicCtrlItem,"MovieChangePicCtrlItem"},
+               {PTP_DPC_NIKON_MovieLoopLength,"MovieLoopLength"},
                {0,NULL}
        };
         struct {
diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h
index 4fd6ae256..b544bb4bc 100644
--- a/camlibs/ptp2/ptp.h
+++ b/camlibs/ptp2/ptp.h
@@ -2591,6 +2591,7 @@ typedef struct _PTPCanonEOSDeviceInfo {
 #define PTP_DPC_NIKON_FacePriority                     0xD316
 #define PTP_DPC_NIKON_LensTypeNikon1                   0xD317
 #define PTP_DPC_NIKON_ISONoiseReduction                        0xD318
+#define PTP_DPC_NIKON_MovieLoopLength                  0xD323
 
 
 /* Nikon V1 (or WU adapter?) Trace */
_______________________________________________
Gphoto-devel mailing list
Gphoto-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gphoto-devel

Reply via email to