Discussion:
[gphoto-devel] The patch of Nikon 1 V3 trigger-capture fails
Gavin (Xingsheng) Wan
2016-11-23 15:58:01 UTC
Permalink
Hi gphoto2 devs,

The trigger-capture fails on Nikon V3 (firmware v1.11). I made a patch based on libgphoto2-2.5.10 and it fixed the issue. We only tested the patch on another two Nikon camera (Nikon 1 J4 and Nikon 1 S2) since we only have the 3 Nikon camera. Please review the patch.

Gavin Wan
Embedded Systems Developer, PrecisionHawk
www.precisionhawk.com
Marcus Meissner
2016-11-24 09:04:18 UTC
Permalink
Hi,
Post by Gavin (Xingsheng) Wan
Hi gphoto2 devs,
The trigger-capture fails on Nikon V3 (firmware v1.11). I made a patch based on libgphoto2-2.5.10 and it fixed the issue. We only tested the patch on another two Nikon camera (Nikon 1 J4 and Nikon 1 S2) since we only have the 3 Nikon camera. Please review the patch.
So basically the non-autofocus mode does not seem to work there.

One thing is that I can autofallback like I just committed... can you check current git?

(Alternatively I could set "af" = 1 on all Nikon 1 cameras.)

Ciao, Marcus

commit bc2dc40859941f1b0559d5ee19d163635e9b1605
Author: Marcus Meissner <***@jet.franken.de>
Date: Thu Nov 24 09:50:10 2016 +0100

The Nikon 1 V3 reports InvalidStatus on non-autofocus capture,
so fallback to autofocus capture.

diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c
index fa2ec51..7b553bb 100644
--- a/camlibs/ptp2/library.c
+++ b/camlibs/ptp2/library.c
@@ -2929,7 +2929,14 @@ camera_nikon_capture (Camera *camera, CameraCaptureType type, CameraFilePath *pa
if (ptp_operation_issupported(params, PTP_OC_NIKON_InitiateCaptureRecInMedia)) {
int loops = 100;
do {
- ret = ptp_nikon_capture2(params,af,sdram);
+ ret = ptp_nikon_capture2 (params, af, sdram);
+ /* 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 (ret == PTP_RC_OK)
+ break;
+ }
+
if ( (ret == PTP_RC_DeviceBusy) ||
/* this is seen on Nikon V3 */
(ret == PTP_RC_NIKON_InvalidStatus)
@@ -4107,6 +4114,13 @@ camera_trigger_capture (Camera *camera, GPContext *context)
if (ret == PTP_RC_OK)
break;

+ /* 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 (ret == PTP_RC_OK)
+ break;
+ }
+
/* busy means wait and the invalid status might go away */
if ((ret != PTP_RC_DeviceBusy) && (ret != PTP_RC_NIKON_InvalidStatus))
return translate_ptp_result (ret);

------------------------------------------------------------------------------
Gavin Wan
2016-11-24 13:53:14 UTC
Permalink
Hi Marcus,

Could you tell me the URL of git? Thanks.

Gavin Wan
Embedded Systems Developer, PrecisionHawk
www.precisionhawk.com




--
View this message in context: http://gphoto-software.10949.n7.nabble.com/The-patch-of-Nikon-1-V3-trigger-capture-fails-tp16422p16424.html
Sent from the gphoto-devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Marcus Meissner
2016-11-24 15:57:39 UTC
Permalink
Post by Gavin Wan
Hi Marcus,
Could you tell me the URL of git? Thanks.
https://github.com/gphoto/libgphoto2

The git repo itself is ***@github.com:gphoto/libgphoto2.git or https://github.com/gphoto/libgphoto2.git

Ciao, Marcus

------------------------------------------------------------------------------
Gavin Wan
2016-11-25 16:28:48 UTC
Permalink
Hi Marcus,

Your patch works on Nikon V3.

BTW, In your patch email, the line:
(ret == PTP_RC_NIKON_InvalidStatus) @@ -4107,6 +4114,13 @@
camera_trigger_capture (Camera *camera, GPContext *context)

should be two lines:

(ret == PTP_RC_NIKON_InvalidStatus)
@@ -4107,6 +4114,13 @@ camera_trigger_capture (Camera *camera, GPContext
*context)

It think it is the issue of email application.

Thanks.

Gavin Wan
Embedded Systems Developer, PrecisionHawk
www.precisionhawk.com




--
View this message in context: http://gphoto-software.10949.n7.nabble.com/The-patch-of-Nikon-1-V3-trigger-capture-fails-tp16422p16426.html
Sent from the gphoto-devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Loading...