diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2022-01-23 17:12:12 +0100 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2022-01-23 17:12:49 +0100 |
commit | fca76c5bd7d0c2e35806d5d8f300904992f5b70a (patch) | |
tree | 8b0ed290c810f90cf4752be86cf5f088fd219f6d /camlibs/ptp2/config.c | |
parent | 6d7ed0ea2175fc311c6b8ff2fe3374be157f8be0 (diff) | |
download | libgphoto2-fca76c5bd7d0c2e35806d5d8f300904992f5b70a.tar.gz |
sony fnumber needs to return the current setting even if not in list
Diffstat (limited to 'camlibs/ptp2/config.c')
-rw-r--r-- | camlibs/ptp2/config.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c index 17d878149..cf8eac1b5 100644 --- a/camlibs/ptp2/config.c +++ b/camlibs/ptp2/config.c @@ -3376,7 +3376,8 @@ static int sony_fnumbers[] = { static int _get_Sony_FNumber(CONFIG_GET_ARGS) { - unsigned int i; + unsigned int i, isset = 0; + char buf[20]; GP_LOG_D ("get_Sony_FNumber"); if (!(dpd->FormFlag & (PTP_DPFF_Enumeration|PTP_DPFF_Range))) @@ -3392,12 +3393,16 @@ _get_Sony_FNumber(CONFIG_GET_ARGS) { gp_widget_set_name (*widget, menu->name); for (i=0;i<sizeof(sony_fnumbers)/sizeof(sony_fnumbers[0]); i++) { - char buf[20]; - sprintf(buf,"f/%g",sony_fnumbers[i]/100.0); gp_widget_add_choice (*widget,buf); - if (sony_fnumbers[i] == dpd->CurrentValue.u16) + if (sony_fnumbers[i] == dpd->CurrentValue.u16) { + isset = 1; gp_widget_set_value (*widget,buf); + } + } + if (!isset) { + sprintf(buf,"f/%g",dpd->CurrentValue.u16/100.0); + gp_widget_set_value (*widget,buf); } GP_LOG_D ("get_Sony_FNumber via range and table"); return GP_OK; |