add olympus init function
This commit is contained in:
committed by
Marcus Meissner
parent
a3d8178375
commit
2318d4ac43
@@ -8419,7 +8419,6 @@ camera_init (Camera *camera, GPContext *context)
|
||||
if (params->deviceinfo.VendorExtensionID != PTP_VENDOR_SONY)
|
||||
ptp_list_folder (params, PTP_HANDLER_SPECIAL, PTP_HANDLER_SPECIAL);
|
||||
|
||||
|
||||
{
|
||||
unsigned int k;
|
||||
|
||||
@@ -8429,6 +8428,36 @@ camera_init (Camera *camera, GPContext *context)
|
||||
ptp_list_folder (params, params->storageids.Storage[k], PTP_HANDLER_SPECIAL);
|
||||
}
|
||||
}
|
||||
/* moved down here in case the filesystem needs to first be initialized as the Olympus app does */
|
||||
if (params->deviceinfo.VendorExtensionID == PTP_VENDOR_GP_OLYMPUS_OMD) {
|
||||
GP_LOG_D ("Initializing Olympus ... ");
|
||||
ptp_olympus_init_pc_mode(params);
|
||||
|
||||
/*
|
||||
if(params->storageids.n > 0) { // Olympus app gets storage info for first item, so emulating here
|
||||
PTPStorageInfo storageinfo;
|
||||
ptp_getstorageinfo(params, params->storageids.Storage[0], &storageinfo);
|
||||
}
|
||||
|
||||
PTPPropertyValue propval;
|
||||
if (!strncmp(params->deviceinfo.Model,"E-M5",4)) {
|
||||
ptp_olympus_init_pc_mode(params);
|
||||
}
|
||||
ptp_olympus_omd_init(params);
|
||||
propval.u16 = 2;
|
||||
ptp_setdevicepropvalue(params, 0xD078, &propval, PTP_DTC_UINT16);
|
||||
if (!strncmp(params->deviceinfo.Model,"E-M1",4)) {
|
||||
propval.u16 = 2; // save to camera's card
|
||||
ptp_setdevicepropvalue(params, 0xD0DC, &propval, PTP_DTC_UINT16);
|
||||
//propval.u16 = 1;
|
||||
//ptp_setdevicepropvalue(params, 0xD052, &propval, PTP_DTC_UINT16);
|
||||
ptp_check_event_handle (params, 0);
|
||||
ptp_olympus_init_pc_mode(params);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
SET_CONTEXT(camera, NULL);
|
||||
return GP_OK;
|
||||
|
||||
@@ -874,6 +874,34 @@ ptp_panasonic_liveview_image (PTPParams* params, unsigned char **data, unsigned
|
||||
return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
ptp_olympus_init_pc_mode (PTPParams* params)
|
||||
{
|
||||
uint16_t ret;
|
||||
PTPPropertyValue propval;
|
||||
PTPContainer event;
|
||||
int i;
|
||||
|
||||
ptp_debug (params,"PTP: (Olympus Init) switching to PC mode...");
|
||||
|
||||
propval.u16 = 1;
|
||||
ret = ptp_setdevicepropvalue (params, 0xD052, &propval, PTP_DTC_UINT16);
|
||||
usleep(100000);
|
||||
|
||||
for(i = 0; i < 2; i++) {
|
||||
ptp_debug (params,"PTP: (Olympus Init) checking events...");
|
||||
/* Just busy loop until the camera is ready again. */
|
||||
ptp_check_event (params);
|
||||
if (ptp_get_one_event(params, &event)) break;
|
||||
usleep(100000);
|
||||
}
|
||||
//ptp_debug (params,"PTP: (Olympus Init) getting response...");
|
||||
//gp_port_set_timeout (camera->port, timeout);
|
||||
//ret=ptp_transaction(params, &ptp, PTP_DP_RESPONSEONLY, size, &data, NULL);
|
||||
//if(data) free(data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
ptp_olympus_liveview_image (PTPParams* params, unsigned char **data, unsigned int *size)
|
||||
{
|
||||
@@ -993,7 +1021,6 @@ ptp_panasonic_getdeviceproperty (PTPParams *params, uint32_t propcode, uint16_t
|
||||
if(size < 8) return PTP_RC_GeneralError;
|
||||
*valuesize = dtoh32a( (data + 4) );
|
||||
|
||||
|
||||
if(size < 8 + (*valuesize)) return PTP_RC_GeneralError;
|
||||
if(*valuesize == 4) {
|
||||
*currentValue = dtoh32a( (data + 8) );
|
||||
|
||||
@@ -3711,6 +3711,8 @@ uint16_t ptp_panasonic_getdevicepropertysize (PTPParams *params, uint32_t propco
|
||||
uint16_t ptp_olympus_liveview_image (PTPParams* params, unsigned char **data, unsigned int *size);
|
||||
#define ptp_olympus_omd_move_focus(params,direction,step_size) ptp_generic_no_data(params,PTP_OC_OLYMPUS_OMD_MFDrive,2,direction,step_size)
|
||||
uint16_t ptp_olympus_omd_capture (PTPParams* params);
|
||||
uint16_t ptp_olympus_init_pc_mode (PTPParams* params);
|
||||
|
||||
|
||||
#define ptp_panasonic_capture(params) ptp_generic_no_data(params,PTP_OC_PANASONIC_InitiateCapture,1,0x3000011)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user