rpms/bluez/F-11 bluez-no-unplug-on-disconnect.patch, NONE, 1.1 bluez-pass-removal-flag.patch, NONE, 1.1 bluez.spec, 1.63, 1.64

Bastien Nocera hadess at fedoraproject.org
Fri May 8 01:02:57 UTC 2009


Author: hadess

Update of /cvs/pkgs/rpms/bluez/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv6726

Modified Files:
	bluez.spec 
Added Files:
	bluez-no-unplug-on-disconnect.patch 
	bluez-pass-removal-flag.patch 
Log Message:
* Fri May 08 2009 Bastien Nocera <bnocera at redhat.com> 4.37-3
- Hopefully fix HID device not reconnecting properly after
  they've been disconnected (#485927)

bluez-no-unplug-on-disconnect.patch:

--- NEW FILE bluez-no-unplug-on-disconnect.patch ---
From: Luiz Augusto von Dentz <luiz.dentz at openbossa.org>
Date: Fri, 24 Apr 2009 21:06:22 +0000 (-0300)
Subject: Fix bug which prevent input devices to work if bluetoothd is restarted.
X-Git-Tag: 4.38~30
X-Git-Url: http://git.kernel.org/?p=bluetooth%2Fbluez.git;a=commitdiff_plain;h=8ca76f2e9cf85ff39adc8bfa68627b8c4d9512cc

Fix bug which prevent input devices to work if bluetoothd is restarted.

In case of bluetoothd being restart or adapter unplugged the devices driver
callback .remove is called to free any data, but the input driver was also
sending the virtual cable unplug which is only necessary for permanent
removal.
---

diff --git a/input/device.c b/input/device.c
index 9f13cd5..aaf478b 100644
--- a/input/device.c
+++ b/input/device.c
@@ -781,10 +781,13 @@ static void disconnect_cb(struct btd_device *device, gboolean removal,
 				void *user_data)
 {
 	struct input_device *idev = user_data;
+	int flags;
 
 	info("Input: disconnect %s", idev->path);
 
-	disconnect(idev, 0);
+	flags = removal ? (1 << HIDP_VIRTUAL_CABLE_UNPLUG) : 0;
+
+	disconnect(idev, flags);
 }
 
 static int input_device_connected(struct input_device *idev,
@@ -1004,8 +1007,6 @@ static void device_unregister(void *data)
 	debug("Unregistered interface %s on path %s", INPUT_DEVICE_INTERFACE,
 								idev->path);
 
-	/* Disconnect if applied */
-	disconnect(idev, (1 << HIDP_VIRTUAL_CABLE_UNPLUG));
 	devices = g_slist_remove(devices, idev);
 	input_device_free(idev);
 }

bluez-pass-removal-flag.patch:

--- NEW FILE bluez-pass-removal-flag.patch ---
From: Luiz Augusto von Dentz <luiz.dentz at openbossa.org>
Date: Mon, 27 Apr 2009 13:43:29 +0000 (-0300)
Subject: Make disconnect watch callback to take removal flag.
X-Git-Tag: 4.38~31
X-Git-Url: http://git.kernel.org/?p=bluetooth%2Fbluez.git;a=commitdiff_plain;h=a381d5342d27b99612fd31dc9cc80b01f412ad39

Make disconnect watch callback to take removal flag.

This should make watches aware of a force disconnection for permanent device
removal making possible to remove any persistent data associate with the
device.
---

diff --git a/audio/headset.c b/audio/headset.c
index 686d727..1966a25 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -2387,7 +2387,8 @@ static int headset_close_rfcomm(struct audio_device *dev)
 	return 0;
 }
 
-static void disconnect_cb(struct btd_device *btd_dev, void *user_data)
+static void disconnect_cb(struct btd_device *btd_dev, gboolean removal,
+				void *user_data)
 {
 	struct audio_device *device = user_data;
 
diff --git a/audio/sink.c b/audio/sink.c
index 679e0ee..e8b96ab 100644
--- a/audio/sink.c
+++ b/audio/sink.c
@@ -167,7 +167,8 @@ static void pending_request_free(struct audio_device *dev,
 	g_free(pending);
 }
 
-static void disconnect_cb(struct btd_device *btd_dev, void *user_data)
+static void disconnect_cb(struct btd_device *btd_dev, gboolean removal,
+				void *user_data)
 {
 	struct audio_device *device = user_data;
 	struct sink *sink = device->sink;
diff --git a/input/device.c b/input/device.c
index 69c1b16..9f13cd5 100644
--- a/input/device.c
+++ b/input/device.c
@@ -777,7 +777,8 @@ static int disconnect(struct input_device *idev, uint32_t flags)
 	return connection_disconnect(iconn, flags);
 }
 
-static void disconnect_cb(struct btd_device *device, void *user_data)
+static void disconnect_cb(struct btd_device *device, gboolean removal,
+				void *user_data)
 {
 	struct input_device *idev = user_data;
 
diff --git a/network/connection.c b/network/connection.c
index 83377f6..a02e233 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -211,7 +211,8 @@ static void connection_destroy(DBusConnection *conn, void *user_data)
 		cancel_connection(nc, NULL);
 }
 
-static void disconnect_cb(struct btd_device *device, void *user_data)
+static void disconnect_cb(struct btd_device *device, gboolean removal,
+				void *user_data)
 {
 	struct network_conn *nc = user_data;
 
diff --git a/src/adapter.c b/src/adapter.c
index 40c5ab0..8278b39 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1603,10 +1603,11 @@ static DBusMessage *remove_device(DBusConnection *conn,
 				ERROR_INTERFACE ".DoesNotExist",
 				"Device creation in progress");
 
-	if (device_is_connected(device)) {
-		device_set_temporary(device, TRUE);
+	device_set_temporary(device, TRUE);
+
+	if (device_is_connected(device))
 		device_disconnect(device);
-	} else
+	else
 		adapter_remove_device(conn, adapter, device);
 
 	return dbus_message_new_method_return(msg);
diff --git a/src/device.c b/src/device.c
index e969a6c..e999c95 100644
--- a/src/device.c
+++ b/src/device.c
@@ -543,7 +543,9 @@ void device_disconnect(struct btd_device *device)
 		l = l->next;
 
 		if (data->watch)
-			data->watch(device, data->user_data);
+			/* temporary is set if device is going to be removed */
+			data->watch(device, device->temporary,
+					data->user_data);
 	}
 
 	g_slist_foreach(device->watches, (GFunc) g_free, NULL);
diff --git a/src/device.h b/src/device.h
index 2a56e66..de61e0c 100644
--- a/src/device.h
+++ b/src/device.h
@@ -83,7 +83,8 @@ void device_remove_connection(struct btd_device *device, DBusConnection *conn,
 gboolean device_has_connection(struct btd_device *device, uint16_t handle);
 void device_disconnect(struct btd_device *device);
 
-typedef void (*disconnect_watch) (struct btd_device *device, void *user_data);
+typedef void (*disconnect_watch) (struct btd_device *device, gboolean removal,
+					void *user_data);
 
 guint device_add_disconnect_watch(struct btd_device *device,
 				disconnect_watch watch, void *user_data,


Index: bluez.spec
===================================================================
RCS file: /cvs/pkgs/rpms/bluez/F-11/bluez.spec,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -p -r1.63 -r1.64
--- bluez.spec	5 May 2009 14:29:06 -0000	1.63
+++ bluez.spec	8 May 2009 01:02:27 -0000	1.64
@@ -1,7 +1,7 @@
 Summary: Bluetooth utilities
 Name: bluez
 Version: 4.37
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: GPLv2+
 Group: Applications/System
 Source: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.gz
@@ -17,6 +17,11 @@ Patch3: bluez-activate-wacom-mode2.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=498756
 Patch4: bluez-socket-mobile-cf-connection-kit.patch
 
+# http://git.kernel.org/?p=bluetooth/bluez.git;a=commitdiff;h=a381d5342d27b99612fd31dc9cc80b01f412ad39
+Patch5: bluez-pass-removal-flag.patch
+# http://git.kernel.org/?p=bluetooth/bluez.git;a=commitdiff;h=8ca76f2e9cf85ff39adc8bfa68627b8c4d9512cc
+Patch6: bluez-no-unplug-on-disconnect.patch
+
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 URL: http://www.bluez.org/
 
@@ -105,6 +110,8 @@ use in Bluetooth applications.
 %patch2 -p1 -b .non-utf8-name
 %patch3 -p1 -b .wacom
 %patch4 -p1 -b .socket-mobile
+%patch5 -p1 -b .removal
+%patch6 -p1 -b .unplug
 
 %build
 %configure --enable-cups --enable-hid2hci --enable-dfutool --enable-tools --enable-bccmd --enable-gstreamer --enable-hidd --enable-pand --enable-dund
@@ -198,6 +205,10 @@ fi
 %{_sysconfdir}/alsa/bluetooth.conf
 
 %changelog
+* Fri May 08 2009 Bastien Nocera <bnocera at redhat.com> 4.37-3
+- Hopefully fix HID device not reconnecting properly after
+  they've been disconnected (#485927)
+
 * Tue May 05 2009 Bastien Nocera <bnocera at redhat.com> 4.37-2
 - Add patch to activate the Socket Mobile CF kit (#498756)
 




More information about the scm-commits mailing list