diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index 523875f11..8652d72b8 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -4509,7 +4509,11 @@ ptp_sony_get_vendorpropcodes (PTPParams* params, uint16_t **props, unsigned int *props = NULL; *size = 0; - PTP_CNT_INIT(ptp, PTP_OC_SONY_GetSDIOGetExtDeviceInfo, 0xc8 /* unclear */); + if(has_sony_mode_300(params)) { + PTP_CNT_INIT(ptp, PTP_OC_SONY_GetSDIOGetExtDeviceInfo, 0x12c /* newer mode (300) */); + } else { + PTP_CNT_INIT(ptp, PTP_OC_SONY_GetSDIOGetExtDeviceInfo, 0x0c8 /* older mode (200) */); + } CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &xdata, &xsize)); if (xsize == 0) { ptp_debug (params, "No special operations sent?"); diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h index 38499112d..5c650599a 100644 --- a/camlibs/ptp2/ptp.h +++ b/camlibs/ptp2/ptp.h @@ -24,6 +24,7 @@ #define CAMLIBS_PTP2_PTP_H #include +#include #include #include #if defined(HAVE_ICONV) && defined(HAVE_LANGINFO_H) @@ -4678,6 +4679,24 @@ uint16_t ptp_olympus_getcameraid (PTPParams*, unsigned char**, unsigned int *); uint16_t ptp_olympus_omd_capture (PTPParams* params); uint16_t ptp_olympus_omd_move_focus (PTPParams* params, uint32_t direction, uint32_t step_size); +/* Internal function for SONY */ +static inline int +has_sony_mode_300(PTPParams *params) { + if (params->deviceinfo.VendorExtensionID != PTP_VENDOR_SONY) return 0; + if (!strcmp(params->deviceinfo.Model, "ILCE-7SM3")) return 1; + if (!strcmp(params->deviceinfo.Model, "ILCE-7RM4")) return 1; + if (!strcmp(params->deviceinfo.Model, "ILCE-7RM4A")) return 1; + if (!strcmp(params->deviceinfo.Model, "ILCE-7C")) return 1; + if (!strcmp(params->deviceinfo.Model, "ILCE-9M2")) return 1; + if (!strcmp(params->deviceinfo.Model, "ILCE-1")) return 1; + if (!strcmp(params->deviceinfo.Model, "ILCE-7M4")) return 1; + if (!strcmp(params->deviceinfo.Model, "ILCE-7RM5")) return 1; + if (!strcmp(params->deviceinfo.Model, "ZV-E1")) return 1; + // TODO add other mode 300 camera models + return 0; +} + + /* Non PTP protocol functions */ static inline int ptp_operation_issupported(PTPParams* params, uint16_t operation)