diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2020-05-10 18:27:49 +0200 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2020-05-10 18:27:49 +0200 |
commit | e4b6c0e73f6f40d2a9f0bb9c9e780ec07a7ec98c (patch) | |
tree | 5f42f6f0351a84c72dcdab200f74231078e2c2da | |
parent | 2f727b20463c3f396a672a67db3faca998fa1a4b (diff) | |
download | libgphoto2-e4b6c0e73f6f40d2a9f0bb9c9e780ec07a7ec98c.tar.gz |
move the liveview prohibit check a bit lower
-rw-r--r-- | camlibs/ptp2/library.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index a5e80fe2a..023b685c0 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -3136,24 +3136,6 @@ 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")); @@ -3175,6 +3157,25 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context) value.u8 = 0; enable_liveview: + if (have_prop(camera, params->deviceinfo.VendorExtensionID, PTP_DPC_NIKON_LiveViewProhibitCondition)) { + PTPPropertyValue cond; + C_PTP (ptp_getdevicepropvalue (params, PTP_DPC_NIKON_LiveViewProhibitCondition, &cond, PTP_DTC_UINT32)); + + if (cond.u32) { + /* we could have multiple reasons, but just report the first one. by decreasing order of possibility */ + if (cond.u32 & (1<<8)) { gp_context_error (context, _("Liveview cannot start: Battery exhausted")); return GP_ERROR; } + if (cond.u32 & (1<<17)){ gp_context_error (context, _("Liveview cannot start: Temperature too high")); return GP_ERROR; } + if (cond.u32 & (1<<9)) { gp_context_error (context, _("Liveview cannot start: TTL error")); return GP_ERROR; } + if (cond.u32 & (1<<22)){ gp_context_error (context, _("Liveview cannot start: In Mirror-up operation")); return GP_ERROR; } + if (cond.u32 & (1<<24)){ gp_context_error (context, _("Liveview cannot start: Lens is retracting")); return GP_ERROR; } + if (cond.u32 & (1<<5)) { gp_context_error (context, _("Liveview cannot start: Minimum aperture warning")); return GP_ERROR; } + if (cond.u32 & (1<<15)){ gp_context_error (context, _("Liveview cannot start: Processing of shooting operation")); return GP_ERROR; } + if (cond.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"), cond.u32); + return GP_ERROR; + } + } + if (!value.u8) { value.u8 = 1; if (have_prop(camera, params->deviceinfo.VendorExtensionID, PTP_DPC_NIKON_RecordingMedia)) |