diff --git a/camlibs/konica/konica.c b/camlibs/konica/konica.c index 9f15fde9d..e49ea1cbc 100644 --- a/camlibs/konica/konica.c +++ b/camlibs/konica/konica.c @@ -1313,6 +1313,9 @@ k_localization_data_put (GPPort *device, static unsigned int packet_size = 1024; unsigned char sb[16 + packet_size]; + gp_log (GP_LOG_DEBUG, "konica", "Uploading %i bytes localization " + "data...", data_size); + CHECK_NULL (data); if (data_size < 512) return (GP_ERROR_BAD_PARAMETERS); diff --git a/camlibs/konica/library.c b/camlibs/konica/library.c index 2371af8ec..e2bccf646 100644 --- a/camlibs/konica/library.c +++ b/camlibs/konica/library.c @@ -211,7 +211,7 @@ init_serial_connection (Camera *camera) GPPortSettings settings; unsigned int speed; - CHECK (camera, gp_port_settings_get (camera->port, &settings)); + CHECK (camera, gp_port_get_settings (camera->port, &settings)); /* Speed: * @@ -244,7 +244,7 @@ init_serial_connection (Camera *camera) gp_log (GP_LOG_DEBUG, "konica", "Testing speed %d", test_bit_rate [i]); settings.serial.speed = test_bit_rate [i]; - gp_port_settings_set (camera->port, settings); + gp_port_set_settings (camera->port, settings); if (k_init (camera->port) == GP_OK) break; } @@ -366,7 +366,7 @@ init_serial_connection (Camera *camera) /* Reconnect */ gp_log (GP_LOG_DEBUG, "konica", "Reconnecting at speed %d", speed); settings.serial.speed = speed; - CHECK (camera, gp_port_settings_set (camera->port, settings)); + CHECK (camera, gp_port_set_settings (camera->port, settings)); CHECK (camera, k_init (camera->port)); return (GP_OK); @@ -962,9 +962,11 @@ camera_set_config (Camera *camera, CameraWidget *window) gp_widget_get_child_by_label (window, _("Localization"), §ion); /* Localization File */ - gp_widget_get_child_by_label (section, _("Language"), &widget); - if (gp_widget_changed (widget)) { - gp_widget_get_value (widget, &c); + CHECK (camera, gp_widget_get_child_by_label (section, _("Language"), + &widget)); + CHECK (camera, result = gp_widget_changed (widget)); + if (result) { + CHECK (camera, gp_widget_get_value (widget, &c)); if (strcmp (c, _("None selected"))) { data = NULL; data_size = 0; @@ -1099,9 +1101,13 @@ localization_file_read (Camera *camera, const char *file_name, strcpy (path, LOCALIZATION); strcat (path, "/"); strcat (path, file_name); + gp_log (GP_LOG_DEBUG, "konica", "Uploading '%s'...", path); file = fopen (path, "r"); - if (!file) + if (!file) { + gp_camera_set_error (camera, _("Could not find localization " + "data at '%s'"), path); return (GP_ERROR_FILE_NOT_FOUND); + } /* Allocate the memory */ *data_size = 0; @@ -1178,21 +1184,21 @@ localization_file_read (Camera *camera, const char *file_name, /* Calculate and check checksum. */ checksum = 0; - gp_debug_printf (GP_DEBUG_HIGH, "core", "Checksum not implemented!"); + gp_log (GP_LOG_DEBUG, "konica", "Checksum not implemented!"); /*FIXME: There's a checksum at (*data)[100]. I could not figure out how it is calculated. */ /* Calculate and check frame check sequence. */ fcs = 0; - gp_debug_printf (GP_DEBUG_LOW, "konica", "Frame check sequence " - "not implemented!"); + gp_log (GP_LOG_DEBUG, "konica", "Frame check sequence " + "not implemented!"); /* FIXME: There's a frame check sequence at (*data)[108] and (*data)[109]. I could not figure out how it is calculated. */ - gp_debug_printf (GP_DEBUG_LOW, "konica", "-> %i bytes read.\n", - (int) *data_size); - return (TRUE); + gp_log (GP_LOG_DEBUG, "konica", "-> %i bytes read.\n", + (int) *data_size); + return (GP_OK); } int @@ -1226,7 +1232,7 @@ camera_init (Camera* camera) outep = konica_cameras [i].outep; /* Initiate the connection */ - CHECK (camera, gp_port_settings_get (camera->port, &settings)); + CHECK (camera, gp_port_get_settings (camera->port, &settings)); switch (camera->port->type) { case GP_PORT_SERIAL: @@ -1234,7 +1240,7 @@ camera_init (Camera* camera) settings.serial.bits = 8; settings.serial.parity = 0; settings.serial.stopbits = 1; - CHECK (camera, gp_port_settings_set (camera->port, settings)); + CHECK (camera, gp_port_set_settings (camera->port, settings)); /* Initiate the serial connection */ CHECK (camera, init_serial_connection (camera)); @@ -1248,7 +1254,7 @@ camera_init (Camera* camera) settings.usb.config = 1; settings.usb.interface = 0; settings.usb.altsetting = 0; - CHECK (camera, gp_port_settings_set (camera->port, settings)); + CHECK (camera, gp_port_set_settings (camera->port, settings)); /* Initiate the connection */ CHECK (camera, k_init (camera->port)); diff --git a/frontends/command-line/gphoto2-cmd-config.c b/frontends/command-line/gphoto2-cmd-config.c index 65035e7d0..1af4f11a8 100644 --- a/frontends/command-line/gphoto2-cmd-config.c +++ b/frontends/command-line/gphoto2-cmd-config.c @@ -85,6 +85,7 @@ show_section (CmdConfig *cmd_config, CameraWidget *section) gp_widget_get_label (child, &label); items[x + 1] = copyChar ((char *) label); } + count++; scroll = newCDKScroll (cmd_config->screen, CENTER, CENTER, RIGHT, 10, 50, title, items, count, NUMBERS, A_REVERSE, TRUE, FALSE); @@ -163,17 +164,30 @@ show_radio (CmdConfig *cmd_config, CameraWidget *radio) CDKITEMLIST *list = NULL; const char *label, *value, *current_value; char title[1024], *items[100]; - int x, count, current = 0, selection; + int x, count, current = 0, selection, found; gp_widget_get_label (radio, &label); snprintf (title, sizeof (title), "%s", label); gp_widget_get_value (radio, ¤t_value); count = gp_widget_count_choices (radio); + + /* Check if the current value is in the list */ + current = found = 0; for (x = 0; x < count; x++) { gp_widget_get_choice (radio, x, &value); - items[x] = copyChar ((char *) value); - if (!strcmp (current_value, value)) + if (!strcmp (value, current_value)) { current = x; + found = 1; + break; + } + } + if (!found) + items[0] = copyChar ((char *) current_value); + + /* Add all items */ + for (x = 0; x < count; x++) { + gp_widget_get_choice (radio, x, &value); + items[x + 1 - found] = copyChar ((char *) value); } list = newCDKItemlist (cmd_config->screen, CENTER, CENTER, diff --git a/libgphoto2/gphoto2-camera.c b/libgphoto2/gphoto2-camera.c index de64baa8d..ae1215654 100644 --- a/libgphoto2/gphoto2-camera.c +++ b/libgphoto2/gphoto2-camera.c @@ -359,7 +359,7 @@ gp_camera_set_message_func (Camera *camera, CameraMessageFunc func, int gp_camera_status (Camera *camera, const char *format, ...) { - char buffer[1024]; + char buffer[2048]; va_list arg; CHECK_NULL (camera && format); diff --git a/libgphoto2/gphoto2-widget.c b/libgphoto2/gphoto2-widget.c index aea617e54..01eacaf3e 100644 --- a/libgphoto2/gphoto2-widget.c +++ b/libgphoto2/gphoto2-widget.c @@ -24,6 +24,7 @@ #include #include +#include #define CHECK_NULL(r) {if (!(r)) return (GP_ERROR_BAD_PARAMETERS);} @@ -349,8 +350,10 @@ gp_widget_set_value (CameraWidget *widget, void *value) case GP_WIDGET_MENU: case GP_WIDGET_RADIO: case GP_WIDGET_TEXT: + gp_log (GP_LOG_DEBUG, "gphoto2-widget", "Setting value to " + "'%s'...", (char*) value); if (widget->value_string) { - if (strcmp (widget->value_string, (char*)value) != 0) + if (strcmp (widget->value_string, (char*) value)) widget->changed = 1; free (widget->value_string); } else