diff options
author | Bastien Nocera <hadess@hadess.net> | 2009-06-16 16:50:04 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2009-06-16 16:50:04 +0100 |
commit | 021942c148c893aae0a7abd461afb136e3bbe2fd (patch) | |
tree | 9fcdeaa76626fae00d6acaaff926a4552d6431f9 /wizard | |
parent | 9fbcfcd45d054dd91edc1adc536206f95e69daf3 (diff) | |
download | gnome-bluetooth-021942c148c893aae0a7abd461afb136e3bbe2fd.tar.gz |
Fix handling of legacy pairing devices with fixed PIN
Fixed pairing my mouse!
Diffstat (limited to 'wizard')
-rw-r--r-- | wizard/main.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/wizard/main.c b/wizard/main.c index af77a324..b18d9033 100644 --- a/wizard/main.c +++ b/wizard/main.c @@ -143,6 +143,9 @@ update_random_pincode (void) { target_pincode = g_strdup_printf ("%d", g_random_int_range (pow (10, PIN_NUM_DIGITS - 1), pow (10, PIN_NUM_DIGITS) - 1)); + automatic_pincode = FALSE; + g_free (user_pincode); + user_pincode = NULL; } static gboolean @@ -564,27 +567,6 @@ void prepare_callback (GtkWidget *assistant, } if (page == page_setup) { - g_free (pincode); - pincode = NULL; - - - if (user_pincode != NULL && *user_pincode != '\0') { - pincode = g_strdup (user_pincode); - } else { - guint max_digits; - - pincode = get_pincode_for_device(target_type, target_address, target_name, &max_digits); - if (pincode == NULL) { - /* Truncate the default pincode if the device doesn't like long - * PIN codes */ - if (max_digits != PIN_NUM_DIGITS && max_digits > 0) - pincode = g_strndup(target_pincode, max_digits); - else - pincode = g_strdup(target_pincode); - } else if (target_ssp == FALSE) { - automatic_pincode = TRUE; - } - } if (automatic_pincode == FALSE && target_ssp == FALSE) { gtk_widget_show (label_passkey_help); @@ -812,6 +794,27 @@ select_device_changed (BluetoothChooser *selector, target_ssp = !legacypairing; g_message ("address %s name %s ssp %d", target_address, target_name, target_ssp); + + g_free (pincode); + pincode = NULL; + + if (user_pincode != NULL && *user_pincode != '\0') { + pincode = g_strdup (user_pincode); + } else { + guint max_digits; + + pincode = get_pincode_for_device(target_type, target_address, target_name, &max_digits); + if (pincode == NULL) { + /* Truncate the default pincode if the device doesn't like long + * PIN codes */ + if (max_digits != PIN_NUM_DIGITS && max_digits > 0) + pincode = g_strndup(target_pincode, max_digits); + else + pincode = g_strdup(target_pincode); + } else if (target_ssp == FALSE) { + automatic_pincode = TRUE; + } + } } void @@ -859,7 +862,7 @@ page_func (gint current_page, gpointer data) { if (current_page == PAGE_SEARCH) { - if (target_ssp != FALSE) + if (target_ssp != FALSE || automatic_pincode != FALSE) return PAGE_CONNECTING; else return PAGE_SETUP; |