The patch of Nikon 1 V3 trigger-capture fails

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The patch of Nikon 1 V3 trigger-capture fails

Gavin 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.

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

------------------------------------------------------------------------------

_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel

camlibs-ptp2-library-fix-nikon-trigger_capture.patch (666 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The patch of Nikon 1 V3 trigger-capture fails

Marcus Meissner-4
Hi,

On Wed, Nov 23, 2016 at 03:58:01PM +0000, Gavin (Xingsheng) Wan wrote:
> 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 <[hidden email]>
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);

------------------------------------------------------------------------------
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: The patch of Nikon 1 V3 trigger-capture fails

Gavin Wan
Hi Marcus,

Could you tell me the URL of git? Thanks.

Gavin Wan
Embedded Systems Developer, PrecisionHawk
www.precisionhawk.com
Reply | Threaded
Open this post in threaded view
|

Re: The patch of Nikon 1 V3 trigger-capture fails

Marcus Meissner
On Thu, Nov 24, 2016 at 06:53:14AM -0700, Gavin Wan wrote:
> Hi Marcus,
>
> Could you tell me the URL of git? Thanks.

https://github.com/gphoto/libgphoto2

The git repo itself is [hidden email]:gphoto/libgphoto2.git or https://github.com/gphoto/libgphoto2.git

Ciao, Marcus

------------------------------------------------------------------------------
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: The patch of Nikon 1 V3 trigger-capture fails

Gavin Wan
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