Skip to content

Commit

Permalink
add sony mode 300 detection and initialization (from NorthOfYou fork)
Browse files Browse the repository at this point in the history
  • Loading branch information
msmeissn committed Aug 17, 2023
1 parent 3f6cd80 commit fc92dda
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
6 changes: 5 additions & 1 deletion camlibs/ptp2/ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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?");
Expand Down
19 changes: 19 additions & 0 deletions camlibs/ptp2/ptp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fc92dda

Please sign in to comment.