summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2020-01-28 09:58:08 +0100
committerGitHub <noreply@github.com>2020-01-28 09:58:08 +0100
commite01f95b4bf415946b1f0883794c2af72cfbd9e1f (patch)
treeb9ba57011223d614c824fb9f69e2ce123415740a
parent19ecb40998101108d0b5fe984c84b7548ac9b7ef (diff)
parentaa28a526e956ea655fe6b1eacf03adac25e66d4c (diff)
downloadlibgphoto2-e01f95b4bf415946b1f0883794c2af72cfbd9e1f.tar.gz
Merge pull request #459 from tail-feather/support-fuji-iso
Support for Fujifilm ISO extension
-rw-r--r--camlibs/ptp2/config.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c
index 45f56432f..f24489218 100644
--- a/camlibs/ptp2/config.c
+++ b/camlibs/ptp2/config.c
@@ -2546,6 +2546,54 @@ _put_ISO32(CONFIG_PUT_ARGS)
}
static int
+_get_Fuji_ISO(CONFIG_GET_ARGS) {
+ int i;
+
+ if (!(dpd->FormFlag & PTP_DPFF_Enumeration))
+ return GP_ERROR;
+ if (dpd->DataType != PTP_DTC_INT32 && /* most camera return INT32 */
+ dpd->DataType != PTP_DTC_UINT16) /* ensure compatibility with UINT16 */
+ return GP_ERROR;
+
+ gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget);
+ gp_widget_set_name (*widget, menu->name);
+ for (i=0;i<dpd->FORM.Enum.NumberOfValues; i++) {
+ char buf[20];
+
+ sprintf(buf,"%d",dpd->FORM.Enum.SupportedValue[i].i32);
+ gp_widget_add_choice (*widget,buf);
+ if (dpd->FORM.Enum.SupportedValue[i].i32 == dpd->CurrentValue.i32)
+ gp_widget_set_value (*widget,buf);
+ }
+ return GP_OK;
+}
+
+static int
+_put_Fuji_ISO(CONFIG_PUT_ARGS)
+{
+ char *value;
+
+ CR (gp_widget_get_value(widget, &value));
+
+ /* most camera return INT32 */
+ if (dpd->DataType == PTP_DTC_INT32) {
+ int i;
+ if (sscanf(value, "%d", &i)) {
+ propval->i32 = i;
+ return GP_OK;
+ }
+ /* ensure compatibility with UINT16 */
+ } else if (dpd->DataType == PTP_DTC_UINT16) {
+ unsigned int u;
+ if (sscanf(value, "%d", &u)) {
+ propval->u16 = u;
+ return GP_OK;
+ }
+ }
+ return GP_ERROR;
+}
+
+static int
_get_Sony_ISO(CONFIG_GET_ARGS) {
int i,isset=0;
char buf[50];
@@ -8260,6 +8308,7 @@ static struct submenu image_settings_menu[] = {
{ N_("Image Size"), "imagesize", PTP_DPC_SONY_ImageSize, PTP_VENDOR_SONY, PTP_DTC_UINT8, _get_Sony_ImageSize, _put_Sony_ImageSize },
{ N_("Image Size"), "imagesize", PTP_DPC_CANON_ImageSize, PTP_VENDOR_CANON, PTP_DTC_UINT8, _get_Canon_Size, _put_Canon_Size },
{ N_("ISO Speed"), "iso", PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, PTP_DTC_UINT16, _get_Canon_ISO, _put_Canon_ISO },
+ { N_("ISO Speed"), "iso", PTP_DPC_ExposureIndex, PTP_VENDOR_FUJI, PTP_DTC_INT32, _get_Fuji_ISO, _put_Fuji_ISO },
{ N_("ISO Speed"), "iso", PTP_DPC_ExposureIndex, 0, PTP_DTC_UINT16, _get_ISO, _put_ISO },
{ N_("Movie ISO Speed"), "movieiso", PTP_DPC_NIKON_MovieISO, PTP_VENDOR_NIKON, PTP_DTC_UINT32, _get_ISO32, _put_ISO32 },
{ N_("ISO Speed"), "iso", PTP_DPC_CANON_EOS_ISOSpeed, PTP_VENDOR_CANON, PTP_DTC_UINT16, _get_Canon_ISO, _put_Canon_ISO },