Skip to content

Commit

Permalink
Handle Nikon D3x, which only allows 1 argument to PTP_OC_NIKON_Initia…
Browse files Browse the repository at this point in the history
…teCaptureRecInMedia

gphoto/gphoto2#635
  • Loading branch information
msmeissn committed Sep 4, 2024
1 parent 77ba0ff commit b1da552
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions camlibs/ptp2/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -4235,6 +4235,9 @@ camera_nikon_capture (Camera *camera, CameraCaptureType type, CameraFilePath *pa
loops = 100;
do {
ret = ptp_nikon_capture2 (params, af, sdram);
if (ret == PTP_RC_ParameterNotSupported) { /* Nikon D3x */
ret = ptp_nikon_capture2_1 (params);
}
/* Nikon 1 ... if af is 0, it reports PTP_RC_NIKON_InvalidStatus */
if (!af && ((ret == PTP_RC_NIKON_InvalidStatus))) {
ret = ptp_nikon_capture2 (params, 1, sdram);
Expand Down Expand Up @@ -6256,6 +6259,9 @@ camera_trigger_capture (Camera *camera, GPContext *context)
ret = ptp_nikon_capture2 (params, af, sdram);
if (ret == PTP_RC_OK)
break;
if (ret == PTP_RC_ParameterNotSupported) { /* Nikon D3x */
ret = ptp_nikon_capture2_1 (params);
}

/* Nikon 1 ... if af is 0, it reports PTP_RC_NIKON_InvalidStatus */
if (!af && ((ret == PTP_RC_NIKON_InvalidStatus))) {
Expand Down
15 changes: 15 additions & 0 deletions camlibs/ptp2/ptp.h
Original file line number Diff line number Diff line change
Expand Up @@ -4677,6 +4677,21 @@ uint16_t ptp_sony_9281 (PTPParams* params, uint32_t param1);
* sdram=1, card=0
*/
#define ptp_nikon_capture2(params,af,target) ptp_generic_no_data(params,PTP_OC_NIKON_InitiateCaptureRecInMedia,2,af?0xfffffffe:0xffffffff,target)

/**
* ptp_nikon_capture2_1:
* For Nikon D3x
*
* This command captures a picture on the Nikon.
*
* params: PTPParams*
* opmode: real image or dustreference
*
* Return values: Some PTP_RC_* code.
* 0xffffffff == regular image, 0x00000010 == dust reference
*/
#define ptp_nikon_capture2_1(params) ptp_generic_no_data(params,PTP_OC_NIKON_InitiateCaptureRecInMedia,1,0xffffffff)

/**
* ptp_nikon_capture_sdram:
*
Expand Down

0 comments on commit b1da552

Please sign in to comment.