Skip to content

Commit

Permalink
add fixes in case PTP_DPC_FUJI_PriorityMode not available (e.g. Fuj…
Browse files Browse the repository at this point in the history
…ifilm X100V) (#986)

* guards around PTP_DPC_FUJI_PriorityMode in case not available for camera
  • Loading branch information
ciaron authored Jul 16, 2024
1 parent db4bc3d commit 3bbbce4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
13 changes: 9 additions & 4 deletions camlibs/ptp2/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,10 @@ camera_prepare_capture (Camera *camera, GPContext *context)
propval.u16 = 0x0001;
LOG_ON_PTP_E (ptp_setdevicepropvalue (params, 0xd38c, &propval, PTP_DTC_UINT16));

propval.u16 = 0x0002;
LOG_ON_PTP_E (ptp_setdevicepropvalue (params, PTP_DPC_FUJI_PriorityMode, &propval, PTP_DTC_UINT16));
if (have_prop(camera, params->deviceinfo.VendorExtensionID, PTP_DPC_FUJI_PriorityMode)) {
propval.u16 = 0x0002;
LOG_ON_PTP_E (ptp_setdevicepropvalue (params, PTP_DPC_FUJI_PriorityMode, &propval, PTP_DTC_UINT16));
}

return GP_OK;
}
Expand Down Expand Up @@ -628,8 +630,11 @@ camera_unprepare_capture (Camera *camera, GPContext *context)
params->inliveview = 0;
}

propval.u16 = 0x0001;
C_PTP (ptp_setdevicepropvalue (params, PTP_DPC_FUJI_PriorityMode, &propval, PTP_DTC_UINT16));
if (have_prop(camera, params->deviceinfo.VendorExtensionID, PTP_DPC_FUJI_PriorityMode)) {
propval.u16 = 0x0001;
C_PTP (ptp_setdevicepropvalue (params, PTP_DPC_FUJI_PriorityMode, &propval, PTP_DTC_UINT16));
}

return GP_OK;
}
break;
Expand Down
22 changes: 16 additions & 6 deletions camlibs/ptp2/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -5259,8 +5259,10 @@ camera_fuji_capture (Camera *camera, CameraCaptureType type, CameraFilePath *pat
C_PTP (ptp_terminateopencapture (params,params->opencapture_transid));
}

propval.u16 = 0x0002;
LOG_ON_PTP_E (ptp_setdevicepropvalue (params, PTP_DPC_FUJI_PriorityMode, &propval, PTP_DTC_UINT16));
if (have_prop(camera, params->deviceinfo.VendorExtensionID, PTP_DPC_FUJI_PriorityMode)) {
propval.u16 = 0x0002;
LOG_ON_PTP_E (ptp_setdevicepropvalue (params, PTP_DPC_FUJI_PriorityMode, &propval, PTP_DTC_UINT16));
}

C_PTP (ptp_getobjecthandles (params, PTP_HANDLER_SPECIAL, 0x000000, 0x000000, &beforehandles));

Expand Down Expand Up @@ -5310,8 +5312,12 @@ camera_fuji_capture (Camera *camera, CameraCaptureType type, CameraFilePath *pat
propval.u16 = 0x0004;
C_PTP_REP (ptp_setdevicepropvalue (params, 0xd208, &propval, PTP_DTC_UINT16));
C_PTP_REP (ptp_initiatecapture(params, 0x00000000, 0x00000000));
propval.u16 = 0x0001;
LOG_ON_PTP_E (ptp_setdevicepropvalue (params, PTP_DPC_FUJI_PriorityMode, &propval, PTP_DTC_UINT16));

if (have_prop(camera, params->deviceinfo.VendorExtensionID, PTP_DPC_FUJI_PriorityMode)) {
propval.u16 = 0x0001;
LOG_ON_PTP_E (ptp_setdevicepropvalue (params, PTP_DPC_FUJI_PriorityMode, &propval, PTP_DTC_UINT16));
}

return GP_ERROR;
}

Expand Down Expand Up @@ -6516,10 +6522,12 @@ camera_trigger_capture (Camera *camera, GPContext *context)
propval.u16 = 0x0004;
C_PTP_REP (ptp_setdevicepropvalue (params, 0xd208, &propval, PTP_DTC_UINT16));
C_PTP_REP (ptp_initiatecapture(params, 0x00000000, 0x00000000));

if (have_prop(camera, params->deviceinfo.VendorExtensionID, PTP_DPC_FUJI_PriorityMode)) {
propval.u16 = 0x0001;
LOG_ON_PTP_E (ptp_setdevicepropvalue (params, PTP_DPC_FUJI_PriorityMode, &propval, PTP_DTC_UINT16));
}

return GP_ERROR;
}

Expand Down Expand Up @@ -7159,8 +7167,10 @@ camera_wait_for_event (Camera *camera, int timeout,
PTPPropertyValue propval;

/* reenable event wait mode */
propval.u16 = 0x0001;
LOG_ON_PTP_E (ptp_setdevicepropvalue (params, PTP_DPC_FUJI_PriorityMode, &propval, PTP_DTC_UINT16));
if (have_prop(camera, params->deviceinfo.VendorExtensionID, PTP_DPC_FUJI_PriorityMode)) {
propval.u16 = 0x0001;
LOG_ON_PTP_E (ptp_setdevicepropvalue (params, PTP_DPC_FUJI_PriorityMode, &propval, PTP_DTC_UINT16));
}

/* current strategy ... as the camera (currently) does not send us ObjectAdded events for some reason...
* we just synthesize them for the generic PTP event handler code */
Expand Down

0 comments on commit 3bbbce4

Please sign in to comment.