rpms/bluez-gnome/F-10 0001-Add-other-audio-devices.patch, NONE, 1.1 0001-Move-the-PIN-quirks-to-an-external-database.patch, NONE, 1.1 0002-Handle-printers-in-the-wizard.patch, NONE, 1.1 0003-Add-quirks-for-loads-of-GPS-devices.patch, NONE, 1.1 0004-Add-more-PIN-quirks.patch, NONE, 1.1 bluez-gnome.spec, 1.70, 1.71

Bastien Nocera hadess at fedoraproject.org
Mon Dec 1 10:22:38 UTC 2008


Author: hadess

Update of /cvs/pkgs/rpms/bluez-gnome/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv6064

Modified Files:
	bluez-gnome.spec 
Added Files:
	0001-Add-other-audio-devices.patch 
	0001-Move-the-PIN-quirks-to-an-external-database.patch 
	0002-Handle-printers-in-the-wizard.patch 
	0003-Add-quirks-for-loads-of-GPS-devices.patch 
	0004-Add-more-PIN-quirks.patch 
Log Message:
* Mon Dec 01 2008 - Bastien Nocera <bnocera at redhat.com> - 1.8-9
- Add patches to move the PIN quirks to an external database


0001-Add-other-audio-devices.patch:

--- NEW FILE 0001-Add-other-audio-devices.patch ---
>From e3419bae8524e86902b69c7d9bfdd580ea394786 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess at hadess.net>
Date: Sat, 29 Nov 2008 16:18:46 +0000
Subject: [PATCH] Add other audio devices

And special-case them in the wizard.
---
 common/bluetooth-client.c    |    4 ++++
 common/bluetooth-client.h    |   13 +++++++------
 wizard/main.c                |    1 +
 wizard/pin-code-database.txt |    1 +
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/common/bluetooth-client.c b/common/bluetooth-client.c
index 5c55a00..bd42132 100644
--- a/common/bluetooth-client.c
+++ b/common/bluetooth-client.c
@@ -92,6 +92,8 @@ const gchar *bluetooth_type_to_string(guint type)
 		return N_("Headset");
 	case BLUETOOTH_TYPE_HEADPHONE:
 		return N_("Headphone");
+	case BLUETOOTH_TYPE_OTHER_AUDIO:
+		return N_("Audio device");
 	case BLUETOOTH_TYPE_KEYBOARD:
 		return N_("Keyboard");
 	case BLUETOOTH_TYPE_MOUSE:
@@ -134,6 +136,8 @@ static guint class_to_type(guint32 class)
 			return BLUETOOTH_TYPE_HEADSET;
 		case 0x06:
 			return BLUETOOTH_TYPE_HEADPHONE;
+		default:
+			return BLUETOOTH_TYPE_OTHER_AUDIO;
 		}
 		break;
 	case 0x05:
diff --git a/common/bluetooth-client.h b/common/bluetooth-client.h
index 09f91ab..5c35213 100644
--- a/common/bluetooth-client.h
+++ b/common/bluetooth-client.h
@@ -112,12 +112,13 @@ enum {
 	BLUETOOTH_TYPE_NETWORK		= 1 << 4,
 	BLUETOOTH_TYPE_HEADSET		= 1 << 5,
 	BLUETOOTH_TYPE_HEADPHONE	= 1 << 6,
-	BLUETOOTH_TYPE_KEYBOARD		= 1 << 7,
-	BLUETOOTH_TYPE_MOUSE		= 1 << 8,
-	BLUETOOTH_TYPE_CAMERA		= 1 << 9,
-	BLUETOOTH_TYPE_PRINTER		= 1 << 10,
-	BLUETOOTH_TYPE_JOYPAD		= 1 << 11,
-	BLUETOOTH_TYPE_TABLET		= 1 << 12,
+	BLUETOOTH_TYPE_OTHER_AUDIO	= 1 << 7,
+	BLUETOOTH_TYPE_KEYBOARD		= 1 << 8,
+	BLUETOOTH_TYPE_MOUSE		= 1 << 9,
+	BLUETOOTH_TYPE_CAMERA		= 1 << 10,
+	BLUETOOTH_TYPE_PRINTER		= 1 << 11,
+	BLUETOOTH_TYPE_JOYPAD		= 1 << 12,
+	BLUETOOTH_TYPE_TABLET		= 1 << 13,
 };
 
 #define _BLUETOOTH_TYPE_NUM_TYPES 12
diff --git a/wizard/main.c b/wizard/main.c
index b29552c..2342040 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -68,6 +68,7 @@ static guint string_to_type(const char *type)
 	TYPE_IS ("keyboard", BLUETOOTH_TYPE_KEYBOARD);
 	TYPE_IS ("headset", BLUETOOTH_TYPE_HEADSET);
 	TYPE_IS ("headphone", BLUETOOTH_TYPE_HEADPHONE);
+	TYPE_IS ("audio", BLUETOOTH_TYPE_OTHER_AUDIO);
 
 	g_warning ("unhandled type '%s'", type);
 	return BLUETOOTH_TYPE_ANY;
diff --git a/wizard/pin-code-database.txt b/wizard/pin-code-database.txt
index 653fc2c..a12dcb4 100644
--- a/wizard/pin-code-database.txt
+++ b/wizard/pin-code-database.txt
@@ -22,3 +22,4 @@ any	00:0D:B5:	GPS-GW-005	0000
 # Headphones and headsets
 headphone			0000
 headset			0000
+audio			0000
-- 
1.6.0.4


0001-Move-the-PIN-quirks-to-an-external-database.patch:

--- NEW FILE 0001-Move-the-PIN-quirks-to-an-external-database.patch ---
>From a09d96d61f1fdf691abd9a35ade5151c466992d1 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess at hadess.net>
Date: Fri, 28 Nov 2008 15:27:54 +0000
Subject: [PATCH] Move the PIN quirks to an external database

Move the PIN quirks to a simple tab-separated text file.
---
 wizard/Makefile.am           |    7 ++-
 wizard/main.c                |  112 ++++++++++++++++++++++++++++++++++--------
 wizard/pin-code-database.txt |   24 +++++++++
 3 files changed, 120 insertions(+), 23 deletions(-)
 create mode 100644 wizard/pin-code-database.txt

diff --git a/wizard/Makefile.am b/wizard/Makefile.am
index 0a2ba45..ddf2cab 100644
--- a/wizard/Makefile.am
+++ b/wizard/Makefile.am
@@ -6,12 +6,15 @@ bluetooth_wizard_SOURCES = main.c
 bluetooth_wizard_LDADD = $(top_builddir)/common/libcommon.a \
 						@GTK_LIBS@ @DBUS_LIBS@
 
-AM_CFLAGS = @DBUS_CFLAGS@ @GTK_CFLAGS@
+AM_CFLAGS = -DPKGDATADIR="\"$(pkgdatadir)\"" @DBUS_CFLAGS@ @GTK_CFLAGS@
 
 INCLUDES = -I$(top_srcdir)/common
 
+pin_DATA = pin-code-database.txt
+pindir = $(pkgdatadir)
+
 man_MANS = bluetooth-wizard.1
 
-EXTRA_DIST = $(man_MANS)
+EXTRA_DIST = $(man_MANS) $(pin_DATA)
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/wizard/pin-code-database.txt b/wizard/pin-code-database.txt
new file mode 100644
index 0000000..653fc2c
--- /dev/null
+++ b/wizard/pin-code-database.txt
@@ -0,0 +1,24 @@
+# This is a PIN code database for use in the Bluetooth wizard.
+#
+# The syntax is a simple tab-separated file with 4 fields:
+# type	bdaddr_prefix	device_name	device_pin
+# 
+# Lines starting with # (such as this one) and empty lines are ignored
+# Recognised types are:
+# 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
+
+# GPS devices
+any	00:0D:B5:	TomTom Wireless GPS MkII	0000
+any	00:0D:B5:	GPS-GW-005	0000
+
+######## Generic type ########
+
+# Headphones and headsets
+headphone			0000
+headset			0000
-- 
1.6.0.4

--- bluez-gnome-1.8/wizard/main.c.quirks	2008-12-01 10:14:30.000000000 +0000
+++ bluez-gnome-1.8/wizard/main.c	2008-12-01 10:16:59.000000000 +0000
@@ -37,6 +37,7 @@
 #include "helper.h"
 
 #define AGENT_PATH "/org/bluez/agent/wizard"
+#define PIN_CODE_DB "pin-code-database.txt"
 
 static BluetoothClient *client;
 static BluetoothAgent *agent;
@@ -56,30 +57,100 @@ static GtkWidget *label_passkey = NULL;
 
 static GtkTreeSelection *search_selection = NULL;
 
+#define TYPE_IS(x, r) {				\
+	if (g_str_equal(type, x)) return r;	\
+}
+
+static guint string_to_type(const char *type)
+{
+	TYPE_IS ("any", BLUETOOTH_TYPE_ANY);
+	TYPE_IS ("mouse", BLUETOOTH_TYPE_MOUSE);
+	TYPE_IS ("keyboard", BLUETOOTH_TYPE_KEYBOARD);
+	TYPE_IS ("headset", BLUETOOTH_TYPE_HEADSET);
+	TYPE_IS ("headphone", BLUETOOTH_TYPE_HEADPHONE);
+
+	g_warning ("unhandled type '%s'", type);
+	return BLUETOOTH_TYPE_ANY;
+}
+
+static char *set_pincode_for_device(guint type, const char *address, const char *name)
+{
+	char *contents, **lines;
+	char *ret_pin = NULL;
+	guint i;
+
+	/* Load the PIN database and split it in lines */
+	if (!g_file_get_contents(PIN_CODE_DB, &contents, NULL, NULL)) {
+		char *filename;
+
+		filename = g_build_filename(PKGDATADIR, PIN_CODE_DB, NULL);
+		if (!g_file_get_contents(filename, &contents, NULL, NULL)) {
+			g_warning("Could not load "PIN_CODE_DB);
+			g_free (filename);
+			return NULL;
+		}
+		g_free (filename);
+	}
+
+	lines = g_strsplit(contents, "\n", -1);
+	g_free (contents);
+	if (lines == NULL) {
+		g_warning("Could not parse "PIN_CODE_DB);
+		return NULL;
+	}
+
+	/* And now process each line */
+	for (i = 0; lines[i] != NULL; i++) {
+		char **items;
+		guint ltype;
+		const char *laddress, *lname, *lpin;
+
+		/* Ignore comments and empty lines */
+		if (lines[i][0] == '#' || lines[i][0] == '\0')
+			continue;
+
+		items = g_strsplit(lines[i], "\t", 4);
+		ltype = string_to_type(items[0]);
+
+		if (ltype != BLUETOOTH_TYPE_ANY && ltype != type) {
+			g_strfreev (items);
+			continue;
+		}
+		laddress = items[1];
+		lname = items[2];
+		lpin = items[3];
+
+		/* If we have an address, does the OUI prefix match? */
+		if (strlen(laddress) > 0 && g_str_has_prefix(address, laddress) == FALSE) {
+			g_strfreev (items);
+			continue;
+		}
+
+		/* If we have a name, does it match? */
+		if (strlen(lname) > 0 && g_str_equal(name, lname) == FALSE) {
+			g_strfreev (items);
+			continue;
+		}
+
+		/* Everything matches, we have a pincode */
+		ret_pin = g_strdup(lpin);
+		g_strfreev(items);
+		break;
+	}
+
+	g_strfreev(lines);
+	return ret_pin;
+}
+
 static gboolean pincode_callback(DBusGMethodInvocation *context,
 					DBusGProxy *device, gpointer user_data)
 {
-	const char *pincode = target_pincode;
+	char *pincode;
 	gchar *text;
 
-	/* Apple Wireless and Mighty Mouse, and just the mice */
-	if ((g_str_has_prefix(target_address, "00:0A:95:") == TRUE ||
-			g_str_has_prefix(target_address, "00:14:51:") == TRUE) &&
-	    target_type == BLUETOOTH_TYPE_MOUSE)
-		pincode = "0000";
-
-	/* Most headsets are using 0000 as pincode */
-	if (target_type == BLUETOOTH_TYPE_HEADSET ||
-				target_type == BLUETOOTH_TYPE_HEADPHONE)
-		pincode = "0000";
-
-	/* Most GPS devices also use 0000 as pincode */
-	if (g_str_has_prefix(target_address, "00:0D:B5") == TRUE &&
-				(g_str_equal(target_name,
-							"TomTom Wireless GPS MkII") == TRUE ||
-				g_str_equal(target_name,
-							"GPS-GW-005") == TRUE))
-		pincode = "0000";
+	pincode = set_pincode_for_device(target_type, target_address, target_name);
+	if (pincode == NULL)
+		pincode = g_strdup(target_pincode);
 
 	text = g_strdup_printf(_("Please enter the following PIN code: %s"),
 								pincode);
@@ -87,6 +158,7 @@ static gboolean pincode_callback(DBusGMe
 	g_free(text);
 
 	dbus_g_method_return(context, pincode);
+	g_free(pincode);
 
 	return TRUE;
 }

0002-Handle-printers-in-the-wizard.patch:

--- NEW FILE 0002-Handle-printers-in-the-wizard.patch ---
>From 9890adcebaf94a8051d948e215d752e3b22a2f3b Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess at hadess.net>
Date: Sat, 29 Nov 2008 16:20:33 +0000
Subject: [PATCH] Handle printers in the wizard

.
---
 wizard/main.c                |    1 +
 wizard/pin-code-database.txt |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/wizard/main.c b/wizard/main.c
index 2342040..763d5e3 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -69,6 +69,7 @@ static guint string_to_type(const char *type)
 	TYPE_IS ("headset", BLUETOOTH_TYPE_HEADSET);
 	TYPE_IS ("headphone", BLUETOOTH_TYPE_HEADPHONE);
 	TYPE_IS ("audio", BLUETOOTH_TYPE_OTHER_AUDIO);
+	TYPE_IS ("printer", BLUETOOTH_TYPE_PRINTER);
 
 	g_warning ("unhandled type '%s'", type);
 	return BLUETOOTH_TYPE_ANY;
diff --git a/wizard/pin-code-database.txt b/wizard/pin-code-database.txt
index a12dcb4..4eaf23c 100644
--- a/wizard/pin-code-database.txt
+++ b/wizard/pin-code-database.txt
@@ -19,6 +19,9 @@ any	00:0D:B5:	GPS-GW-005	0000
 
 ######## Generic type ########
 
+# Printers
+printer			0000
+
 # Headphones and headsets
 headphone			0000
 headset			0000
-- 
1.6.0.4


0003-Add-quirks-for-loads-of-GPS-devices.patch:

--- NEW FILE 0003-Add-quirks-for-loads-of-GPS-devices.patch ---
>From 90d37d576e95685f0d46be13008cea2f5a0b85b6 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess at hadess.net>
Date: Sat, 29 Nov 2008 16:28:25 +0000
Subject: [PATCH] Add quirks for loads of GPS devices

All from the GNOME bugzilla.
---
 wizard/pin-code-database.txt |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/wizard/pin-code-database.txt b/wizard/pin-code-database.txt
index 4eaf23c..773d69b 100644
--- a/wizard/pin-code-database.txt
+++ b/wizard/pin-code-database.txt
@@ -16,6 +16,22 @@ mouse	00:14:51:		0000
 # GPS devices
 any	00:0D:B5:	TomTom Wireless GPS MkII	0000
 any	00:0D:B5:	GPS-GW-005	0000
+# http://bugzilla.gnome.org/show_bug.cgi?id=560870
+any	00:0A:3A:	BT GPS	0000
+# http://bugzilla.gnome.org/show_bug.cgi?id=560606
+any	00:1B:C1:	HOLUX_M-241	0000
+# http://bugzilla.gnome.org/show_bug.cgi?id=560713
+any	00:0B:24:	Triceiver	0000
+# http://bugzilla.gnome.org/show_bug.cgi?id=560715
+any	00:00:00:	BT-Q880	0000
+# http://bugzilla.gnome.org/show_bug.cgi?id=560625
+any	00:11:67:	eGPS-397	0000
+# http://bugzilla.gnome.org/show_bug.cgi?id=560604
+any	00:1B:C1:	HOLUX_M-1000	0000
+# http://bugzilla.gnome.org/show_bug.cgi?id=561326
+any	00:0B:0D:	G-Rays1	0000
+# http://bugzilla.gnome.org/show_bug.cgi?id=561327
+any	00:0A:3A:	HUDGPS	0000
 
 ######## Generic type ########
 
-- 
1.6.0.4


0004-Add-more-PIN-quirks.patch:

--- NEW FILE 0004-Add-more-PIN-quirks.patch ---
>From 7e0ec64061abb7b17a6d7dbe9cbbd2a6036e857a Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess at hadess.net>
Date: Sat, 29 Nov 2008 16:34:41 +0000
Subject: [PATCH] Add more PIN quirks

>From GNOME bugzilla again.
---
 wizard/main.c                |    1 +
 wizard/pin-code-database.txt |   12 ++++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/wizard/main.c b/wizard/main.c
index 763d5e3..f165778 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -70,6 +70,7 @@ static guint string_to_type(const char *type)
 	TYPE_IS ("headphone", BLUETOOTH_TYPE_HEADPHONE);
 	TYPE_IS ("audio", BLUETOOTH_TYPE_OTHER_AUDIO);
 	TYPE_IS ("printer", BLUETOOTH_TYPE_PRINTER);
+	TYPE_IS ("network", BLUETOOTH_TYPE_NETWORK);
 
 	g_warning ("unhandled type '%s'", type);
 	return BLUETOOTH_TYPE_ANY;
diff --git a/wizard/pin-code-database.txt b/wizard/pin-code-database.txt
index 773d69b..3971ae2 100644
--- a/wizard/pin-code-database.txt
+++ b/wizard/pin-code-database.txt
@@ -32,6 +32,18 @@ any	00:1B:C1:	HOLUX_M-1000	0000
 any	00:0B:0D:	G-Rays1	0000
 # http://bugzilla.gnome.org/show_bug.cgi?id=561327
 any	00:0A:3A:	HUDGPS	0000
+# http://bugzilla.gnome.org/show_bug.cgi?id=562479
+any	00:0B:0D:	iBT-GPS	0000
+
+# Audio devices
+# http://bugzilla.gnome.org/show_bug.cgi?id=560315
+headset		X3 micro	1234
+# http://bugzilla.gnome.org/show_bug.cgi?id=561324
+headset	00:03:C9:	BT Headset	1111
+
+# Network devices
+# http://bugzilla.gnome.org/show_bug.cgi?id=561325
+network	00:06:66:	OBDPros scantool	1234
 
 ######## Generic type ########
 
-- 
1.6.0.4



Index: bluez-gnome.spec
===================================================================
RCS file: /cvs/pkgs/rpms/bluez-gnome/F-10/bluez-gnome.spec,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- bluez-gnome.spec	26 Oct 2008 12:41:44 -0000	1.70
+++ bluez-gnome.spec	1 Dec 2008 10:22:37 -0000	1.71
@@ -1,6 +1,6 @@
 Name:		bluez-gnome
 Version:	1.8
-Release:	8%{?dist}
+Release:	9%{?dist}
 Summary:	Bluetooth pairing and control applet
 
 Group:		Applications/System
@@ -23,6 +23,13 @@
 Patch7:		0001-Add-support-for-pairing-a-few-GPS-devices.patch
 # http://thread.gmane.org/gmane.linux.bluez.kernel/650
 Patch8:		0001-Sort-devices-by-type-in-the-treeviews.patch
+# http://thread.gmane.org/gmane.linux.bluez.kernel/812
+Patch9:		0001-Move-the-PIN-quirks-to-an-external-database.patch
+# http://marc.info/?l=linux-bluetooth&m=122797676711812&w=2
+Patch10:	0001-Add-other-audio-devices.patch
+Patch11:	0002-Handle-printers-in-the-wizard.patch
+Patch12:	0003-Add-quirks-for-loads-of-GPS-devices.patch
+Patch13:	0004-Add-more-PIN-quirks.patch
 
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -32,6 +39,7 @@
 BuildRequires:	dbus-glib-devel perl-XML-Parser intltool
 BuildRequires:	desktop-file-utils gettext
 BuildRequires:	hal-devel
+BuildRequires:	automake
 
 Obsoletes:	bluez-pin
 Provides:	dbus-bluez-pin-helper
@@ -69,8 +77,14 @@
 %patch6 -p1 -b .wizard-crash
 %patch7 -p1 -b .gps
 %patch8 -p1 -b .sorting
+%patch9 -p1 -b .quirks
+%patch10 -p1
+%patch11 -p1
+%patch12 -p1
+%patch13 -p1
 
 %build
+automake
 %configure --disable-mime-update --disable-desktop-update --disable-icon-update
 make %{?_smp_mflags}
 
@@ -147,6 +161,7 @@
 %{_datadir}/applications/bluetooth-properties.desktop
 %{_datadir}/mime/packages/bluetooth-manager.xml
 %{_datadir}/icons/hicolor/*/apps/*
+%{_datadir}/bluez-gnome/pin-code-database.txt
 %{_mandir}/man1/bluetooth-applet.1.gz
 %{_mandir}/man1/bluetooth-properties.1.gz
 %{_mandir}/man1/bluetooth-wizard.1.gz
@@ -160,6 +175,9 @@
 %{_mandir}/man1/bluetooth-analyzer.1.gz
 
 %changelog
+* Mon Dec 01 2008 - Bastien Nocera <bnocera at redhat.com> - 1.8-9
+- Add patches to move the PIN quirks to an external database
+
 * Sun Oct 26 2008 - Bastien Nocera <bnocera at redhat.com> - 1.8-8
 - Avoid the devices jumping around in the treeview
 




More information about the fedora-extras-commits mailing list