diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2020-05-10 16:28:05 +0200 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2020-05-10 16:28:05 +0200 |
commit | 0decaa66f3079c211d4b31749ed523bba39579d0 (patch) | |
tree | dd0af28a23101c59303e78c7f3f348a6b2f2034d /camlibs | |
parent | 0fe915beb87abf68ec82aead60b3d75d2c36259a (diff) | |
download | libgphoto2-0decaa66f3079c211d4b31749ed523bba39579d0.tar.gz |
report nikon liveview prohibit conditions.
Diffstat (limited to 'camlibs')
-rw-r--r-- | camlibs/ptp2/library.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index 6f793a3ba..a5e80fe2a 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -3136,6 +3136,24 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context) PTPPropertyValue value; int tries, firstimage = 0; + if (have_prop(camera, params->deviceinfo.VendorExtensionID, PTP_DPC_NIKON_LiveViewProhibitCondition)) { + C_PTP (ptp_getdevicepropvalue (params, PTP_DPC_NIKON_LiveViewProhibitCondition, &value, PTP_DTC_UINT32)); + + if (value.u32) { + /* we could have multiple reasons, but just report the first one. by decreasing order of possibility */ + if (value.u32 & (1<<8)) { gp_context_error (context, _("Liveview cannot start: Battery exhausted")); return GP_ERROR; } + if (value.u32 & (1<<17)){ gp_context_error (context, _("Liveview cannot start: Temperature too high")); return GP_ERROR; } + if (value.u32 & (1<<9)) { gp_context_error (context, _("Liveview cannot start: TTL error")); return GP_ERROR; } + if (value.u32 & (1<<22)){ gp_context_error (context, _("Liveview cannot start: In Mirror-up operation")); return GP_ERROR; } + if (value.u32 & (1<<24)){ gp_context_error (context, _("Liveview cannot start: Lens is retracting")); return GP_ERROR; } + if (value.u32 & (1<<5)) { gp_context_error (context, _("Liveview cannot start: Minimum aperture warning")); return GP_ERROR; } + if (value.u32 & (1<<15)){ gp_context_error (context, _("Liveview cannot start: Processing of shooting operation")); return GP_ERROR; } + if (value.u32 & (1<<2)) { gp_context_error (context, _("Liveview cannot start: Sequence error")); return GP_ERROR; } + gp_context_error (context, _("Liveview cannot start: code 0x%08x"), value.u32); + return GP_ERROR; + } + } + if (!ptp_operation_issupported(params, PTP_OC_NIKON_StartLiveView)) { gp_context_error (context, _("Sorry, your Nikon camera does not support LiveView mode")); |