Add support for Sony properties:

- silent mode: on/off
- shutter type: electrical / mechanical
- focusindication: unlocked/focused/low contrast etc
- shutterlagtiming: fastest / stable
- focal distance: approx readout of focal distance
This commit is contained in:
Mark Watson
2026-04-07 16:54:18 -07:00
parent ad69533138
commit b0f87fdfcf
2 changed files with 67 additions and 0 deletions

View File

@@ -4871,6 +4871,32 @@ _get_Sony_FocalPosition(CONFIG_GET_ARGS) {
return GP_OK;
}
static int
_get_Sony_FocalDistanceMeters(CONFIG_GET_ARGS)
{
char text[32];
text[0] = 0;
uint32_t value = dpd->CurrentValue.u32;
// 'value' is in millimeters but only accurate to .1m
uint32_t valueWhole = value / 1000;
uint32_t valueDecimal = (value % 1000) / 100; // single decimal
if (value == 0xffffffff) {
snprintf(text, sizeof(text), "Infinity");
} else {
if (valueDecimal) {
snprintf(text, sizeof(text), "%u.%um", valueWhole, valueDecimal);
} else {
snprintf(text, sizeof(text), "%um", valueWhole);
}
}
gp_widget_new (GP_WIDGET_TEXT, _(menu->label), widget);
gp_widget_set_name (*widget, menu->name);
gp_widget_set_value (*widget, text);
return GP_OK;
}
static int
_get_VideoFormat(CONFIG_GET_ARGS) {
int i, valset = 0;
@@ -7373,6 +7399,38 @@ static struct deviceproptableu8 sony_image_stabilization[] = {
};
GENERIC8TABLE(Sony_ImageStabilization,sony_image_stabilization)
static struct deviceproptableu8 sony_shutter_lag_timing[] = {
{ N_("Off"), 0x01, 0 },
{ N_("Stable") , 0x02, 0 },
{ N_("Fastest"), 0x03, 0 },
};
GENERIC8TABLE(Sony_ShutterLagTiming,sony_shutter_lag_timing)
static struct deviceproptableu8 sony_focus_indication[] = {
{ N_("Unlock"), 0x01, 0 },
{ N_("Focus Locked"), 0x02, 0 },
{ N_("No Focus - Low Contrast"), 0x03, 0 },
{ N_("Tracking Acquire"), 0x05, 0 },
{ N_("Tracking Focused"), 0x06, 0 },
{ N_("Tracking No Focus - Low Contrast"), 0x07, 0 },
{ N_("Unpause"), 0x08, 0 },
{ N_("Pause"), 0x09, 0 },
};
GENERIC8TABLE(Sony_FocusIndication,sony_focus_indication)
static struct deviceproptableu8 sony_shutter_type[] = {
{ N_("Auto"), 0x01, 0 },
{ N_("Mechanical"), 0x02, 0 },
{ N_("Electronic"), 0x03, 0 },
};
GENERIC8TABLE(Sony_ShutterType,sony_shutter_type)
static struct deviceproptableu8 sony_silent_mode[] = {
{ N_("Off"), 0x01, 0 },
{ N_("On"), 0x02, 0 },
};
GENERIC8TABLE(Sony_SilentMode,sony_silent_mode)
/* Sony specific, we need to wait for it settle (around 1 second), otherwise we get trouble later on */
static int
_put_Sony_CompressionSetting(CONFIG_PUT_ARGS) {
@@ -11794,6 +11852,11 @@ static struct submenu capture_settings_menu[] = {
{ N_("Face Detection"), "facedetection", PTP_DPC_NIKON_FaceDetection, PTP_VENDOR_NIKON, PTP_DTC_UINT8, _get_Nikon_FaceDetection, _put_Nikon_FaceDetection },
{ N_("Movie Servo AF"), "movieservoaf", PTP_DPC_CANON_EOS_MovieServoAF, PTP_VENDOR_CANON, PTP_DTC_UINT32, _get_Canon_EOS_MovieServoAF, _put_Canon_EOS_MovieServoAF },
{ N_("Image Stabilization"), "imagestabilization", PTP_DPC_SONY_ImageStabilization, PTP_VENDOR_SONY, PTP_DTC_UINT8, _get_Sony_ImageStabilization, _put_Sony_ImageStabilization },
{ N_("Shutter Type"), "shuttertype", PTP_DPC_SONY_ShutterType, PTP_VENDOR_SONY, PTP_DTC_UINT8, _get_Sony_ShutterType, _put_Sony_ShutterType },
{ N_("Focal Distance Meters"), "focaldistancemeters", PTP_DPC_SONY_FocalDistanceInMeter, PTP_VENDOR_SONY, PTP_DTC_UINT32, _get_Sony_FocalDistanceMeters, _put_None },
{ N_("Silent Mode"), "silentmode", PTP_DPC_SONY_SilentMode, PTP_VENDOR_SONY, PTP_DTC_UINT8, _get_Sony_SilentMode, _put_Sony_SilentMode },
{ N_("Shutter Lag Timing"), "shutterlagtiming", PTP_DPC_SONY_ShutterLagTiming, PTP_VENDOR_SONY, PTP_DTC_UINT8, _get_Sony_ShutterLagTiming, _put_Sony_ShutterLagTiming },
{ N_("Focus Indication"), "focusindication", PTP_DPC_SONY_FocusFound, PTP_VENDOR_SONY, PTP_DTC_UINT8, _get_Sony_FocusIndication, _put_Sony_FocusIndication },
{ 0,0,0,0,0,0,0 },
};

View File

@@ -3212,6 +3212,10 @@ typedef struct _PTPCanonEOSDeviceInfo {
#define PTP_DPC_SONY_FocusModeSetting 0xD007
#define PTP_DPC_SONY_ImageStabilization 0xD0D9
#define PTP_DPC_SONY_SilentMode 0xD0DB
#define PTP_DPC_SONY_ShutterType 0xD0DF
#define PTP_DPC_SONY_ShutterLagTiming 0xD156
#define PTP_DPC_SONY_DPCCompensation 0xD200
#define PTP_DPC_SONY_DRangeOptimize 0xD201
#define PTP_DPC_SONY_ImageSize 0xD203