Skip to content

Commit

Permalink
handle Nikon D3x capture function detection better
Browse files Browse the repository at this point in the history
  • Loading branch information
msmeissn committed Sep 29, 2024
1 parent 4f1b3d4 commit 2956dc9
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions camlibs/ptp2/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -4220,13 +4220,21 @@ 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 */
if (!params->cmd9207_1arg) {
ret = ptp_nikon_capture2 (params, af, sdram);
if (ret == PTP_RC_ParameterNotSupported) { /* Nikon D3x */
params->cmd9207_1arg = 1;
ret = ptp_nikon_capture2_1 (params);
}
} else {
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);
if (params->cmd9207_1arg)
ret = ptp_nikon_capture2_1 (params);
else
ret = ptp_nikon_capture2 (params, 1, sdram);
if (ret == PTP_RC_OK)
break;
}
Expand Down Expand Up @@ -6241,16 +6249,24 @@ camera_trigger_capture (Camera *camera, GPContext *context)

tries = 200;
do {
ret = ptp_nikon_capture2 (params, af, sdram);
if (ret == PTP_RC_OK)
break;
if (ret == PTP_RC_ParameterNotSupported) { /* Nikon D3x */
if (params->cmd9207_1arg) {
ret = ptp_nikon_capture2_1 (params);
} else {
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);
params->cmd9207_1arg = 1;
}
}

/* 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);
if (params->cmd9207_1arg)
ret = ptp_nikon_capture2 (params, 1, sdram);
else
ret = ptp_nikon_capture2_1 (params);
if (ret == PTP_RC_OK)
break;
}
Expand Down

0 comments on commit 2956dc9

Please sign in to comment.