add sony mode 300 detection and initialization (from NorthOfYou fork)

This commit is contained in:
Marcus Meissner
2023-08-17 10:30:11 +02:00
parent 3f6cd802da
commit fc92dda97c
2 changed files with 24 additions and 1 deletions

View File

@@ -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?");

View File

@@ -24,6 +24,7 @@
#define CAMLIBS_PTP2_PTP_H
#include <stdarg.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#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)