gnome-bluetooth r462 - trunk/wizard



Author: hadess
Date: Thu Mar  5 17:13:32 2009
New Revision: 462
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=462&view=rev

Log:
Remove special-casing in the code for non-pairing devices

Remove the unneeded Apple mice special casing, and add
mice and the PS3 BD remote to the list. (Closes: #573141)



Modified:
   trunk/wizard/main.c
   trunk/wizard/pin-code-database.txt

Modified: trunk/wizard/main.c
==============================================================================
--- trunk/wizard/main.c	(original)
+++ trunk/wizard/main.c	Thu Mar  5 17:13:32 2009
@@ -88,7 +88,7 @@
 	return BLUETOOTH_TYPE_ANY;
 }
 
-static char *set_pincode_for_device(guint type, const char *address, const char *name)
+static char *get_pincode_for_device(guint type, const char *address, const char *name)
 {
 	char *contents, **lines;
 	char *ret_pin = NULL;
@@ -175,7 +175,7 @@
 	if (user_pincode != NULL && *user_pincode != '\0') {
 		pincode = g_strdup (user_pincode);
 	} else {
-		pincode = set_pincode_for_device(target_type, target_address, target_name);
+		pincode = get_pincode_for_device(target_type, target_address, target_name);
 		if (pincode == NULL)
 			pincode = g_strdup(target_pincode);
 		else
@@ -351,7 +351,7 @@
 	}
 
 	if (page == page_setup) {
-		gchar *text, *address, *name;
+		gchar *text, *address, *name, *pincode;
 		guint type;
 
 		/* Get the info about the device now,
@@ -383,16 +383,12 @@
 
 		g_object_ref(agent);
 
-		if (target_type == BLUETOOTH_TYPE_MOUSE)
-			path = NULL;
-
-		/* Sony PlayStation 3 Remote Control */
-		if (g_str_equal(target_name, "BD Remote Control") == TRUE &&
-					(g_str_has_prefix(target_address,
-							"00:19:C1:") == TRUE ||
-					g_str_has_prefix(target_address,
-							"00:1E:3D:") == TRUE))
+		/* Do we pair, or don't we? */
+		pincode = get_pincode_for_device (target_type, target_address, target_name);
+		g_message ("pincode for %s is %s", target_name, pincode);
+		if (pincode != NULL && g_str_equal (pincode, "NULL"))
 			path = NULL;
+		g_free (pincode);
 
 		bluetooth_client_create_device(client, target_address,
 					path, create_callback, assistant);

Modified: trunk/wizard/pin-code-database.txt
==============================================================================
--- trunk/wizard/pin-code-database.txt	(original)
+++ trunk/wizard/pin-code-database.txt	Thu Mar  5 17:13:32 2009
@@ -8,13 +8,15 @@
 # any, mouse, keyboard, headset, headphones
 # 
 # The bdaddr_prefix and device_name fields can be left empty
-
-# Apple Wireless and Mighty Mouse
-mouse	00:0A:95:		0000
-mouse	00:14:51:		0000
+#
+# If device_pin is NULL, then the device won't be paired, but
+# it will be setup, and set as trusted
 
 # TomTom Go remote
 keyboard	00:13:6C:	TomTom Remote	0000
+# Sony PlayStation 3 Remote Control
+any	00:19:C1:	BD Remote Control	NULL
+any	00:1E:3D:	BD Remote Control	NULL
 
 # GPS devices
 any	00:0D:B5:	TomTom Wireless GPS MkII	0000
@@ -71,3 +73,7 @@
 headphones			0000
 headset			0000
 audio			0000
+
+# Mice don't need pincodes
+mouse			NULL
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]