summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2010-01-24 15:13:38 +0000
committerMarcus Meissner <marcus@jet.franken.de>2010-01-24 15:13:38 +0000
commitad10c480cf664b671bbb2f27400755781fbcb6ab (patch)
tree8515f909c4b8d24fcb552c64c6aa84245a6f264c
parent626b6c944381e293665678528f92e3f9813907a1 (diff)
downloadlibgphoto2-ad10c480cf664b671bbb2f27400755781fbcb6ab.tar.gz
rewrote eos mf drive to just offer the 6 drive values + none
git-svn-id: https://svn.code.sf.net/p/gphoto/code/branches/libgphoto2-2_4/libgphoto2@12642 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r--camlibs/ptp2/config.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c
index 6ec1bcfa1..7b6ac5ae9 100644
--- a/camlibs/ptp2/config.c
+++ b/camlibs/ptp2/config.c
@@ -3414,17 +3414,25 @@ _put_Nikon_MFDrive(CONFIG_PUT_ARGS) {
static int
_get_Canon_EOS_MFDrive(CONFIG_GET_ARGS) {
- gp_widget_new (GP_WIDGET_RANGE, _(menu->label), widget);
+ gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget);
gp_widget_set_name (*widget,menu->name);
- gp_widget_set_range(*widget, -3, 3, 1.0);
+ gp_widget_add_choice (*widget, _("Near 1"));
+ gp_widget_add_choice (*widget, _("Near 2"));
+ gp_widget_add_choice (*widget, _("Near 3"));
+ gp_widget_add_choice (*widget, _("None"));
+ gp_widget_add_choice (*widget, _("Far 1"));
+ gp_widget_add_choice (*widget, _("Far 2"));
+ gp_widget_add_choice (*widget, _("Far 3"));
+
+ gp_widget_set_value (*widget, _("None"));
return (GP_OK);
}
static int
_put_Canon_EOS_MFDrive(CONFIG_PUT_ARGS) {
uint16_t ret;
- float val;
+ const char* val;
unsigned int xval;
PTPParams *params = &(camera->pl->params);
@@ -3432,13 +3440,16 @@ _put_Canon_EOS_MFDrive(CONFIG_PUT_ARGS) {
return (GP_ERROR_NOT_SUPPORTED);
gp_widget_get_value(widget, &val);
- if (val<0) {
- xval = 0x8000|((int)-val);
- } else {
- xval = val;
+ if (!strcmp (val, _("None"))) return GP_OK;
+
+ if (!sscanf (val, _("Near %d"), &xval)) {
+ if (!sscanf (val, _("Far %d"), &xval)) {
+ gp_log (GP_LOG_DEBUG, "ptp2/canon_eos_mfdrive", "Could not parse %s", val);
+ return GP_ERROR;
+ } else {
+ xval = (-xval) | 0x8000;
+ }
}
- if (!xval) /* nothing to do */
- return GP_OK;
ret = ptp_canon_eos_drivelens (params, xval);
if (ret != PTP_RC_OK) {
gp_log (GP_LOG_DEBUG, "ptp2/canon_eos_mfdrive", "Canon manual focus drive 0x%x failed: 0x%x", xval, ret);