From 2138f9bba2376cedba29cd9530623bb86d55955a Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 3 Sep 2009 17:31:32 +0000 Subject: [PATCH] - Fix connecting to audio devices not working when disconnected at start --- ...plet-fails-to-connect-to-any-disconn.patch | 66 +++++++++++++++++++ gnome-bluetooth.spec | 11 +++- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 0001-Bug-594055-applet-fails-to-connect-to-any-disconn.patch diff --git a/0001-Bug-594055-applet-fails-to-connect-to-any-disconn.patch b/0001-Bug-594055-applet-fails-to-connect-to-any-disconn.patch new file mode 100644 index 0000000..f59c9f3 --- /dev/null +++ b/0001-Bug-594055-applet-fails-to-connect-to-any-disconn.patch @@ -0,0 +1,66 @@ +From b4b046cd37324454c7125d345cceabb5c6f61612 Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Thu, 3 Sep 2009 18:17:43 +0100 +Subject: [PATCH] =?utf-8?q?Bug=C2=A0594055=20-=20applet=20fails=20to=20connect=20to=20any=20disconnected=20audio=20device?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Hunted down by Peter Hurley . + +Description +If the remote device is disconnected when the applet starts, the applet +will be unable to initiate connection to the audio interface of the +device. + +Cause +Incorrect use of g_hash_table_lookup in the device_list_nodes() function +in lib/bluetooth-client.c + +Discussion +For a given device, device_list_nodes() loops through the known +detectable interfaces (those in detectable_interfaces[]) and adds +them to the returned hash table if calling the interfaces's +.GetProperties dbus method returns true. + +The value of the "Connected" property is then stored as the associated +value with the interface name as the key in the hash table. + +The *connectable* interface "org.bluez.Audio" is only added if at least +either of the *detectable* interfaces "org.bluez.Headset" or +"org.bluez.AudioSink" were added the the hash table in previous +iterations within device_list_nodes(). + +However, the test for whether those *detectable* interfaces were added +is not correct. Currently, g_hash_table_lookup() is used to determine +if the interface names are in the hash table. g_hash_table_lookup() +will return NULL if the the key is not present in the hash table, +OTHERWISE IT RETURNS THE VALUE ASSOCIATED WITH THE KEY. If that value +is 0 (== BLUETOOTH_STATUS_DISCONNECTED), the logic mistakenly believes +that the key is not present in the hash table, and as a result, fails +to add the only connectable audio interface "org.bluez.Audio". + +Recommend +Either use g_hash_table_lookup_extended() to test for key presence +or change enum BLUET00TH_STATUS_DISCONNECTED to be != 0. +--- + lib/bluetooth-enums.h | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/lib/bluetooth-enums.h b/lib/bluetooth-enums.h +index 7563c4c..450c38c 100644 +--- a/lib/bluetooth-enums.h ++++ b/lib/bluetooth-enums.h +@@ -80,7 +80,8 @@ typedef enum { + } BluetoothColumn; + + typedef enum { +- BLUETOOTH_STATUS_DISCONNECTED = 0, ++ BLUETOOTH_STATUS_INVALID = 0, ++ BLUETOOTH_STATUS_DISCONNECTED, + BLUETOOTH_STATUS_CONNECTED, + BLUETOOTH_STATUS_CONNECTING, + BLUETOOTH_STATUS_PLAYING +-- +1.6.2.5 + diff --git a/gnome-bluetooth.spec b/gnome-bluetooth.spec index c7e4c84..ae7e208 100644 --- a/gnome-bluetooth.spec +++ b/gnome-bluetooth.spec @@ -1,6 +1,6 @@ Name: gnome-bluetooth Version: 2.27.90 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Bluetooth graphical utilities Group: Applications/Communications @@ -34,6 +34,9 @@ Requires: pulseaudio-module-bluetooth Requires(post): desktop-file-utils Requires(postun): desktop-file-utils +# http://bugzilla.gnome.org/show_bug.cgi?id=594055 +Patch0: 0001-Bug-594055-applet-fails-to-connect-to-any-disconn.patch + %description The gnome-bluetooth package contains graphical utilities to setup, monitor and use Bluetooth devices. @@ -63,6 +66,8 @@ for writing applications that require a Bluetooth device selection widget. %prep %setup -q -n gnome-bluetooth-%{version} +%patch0 -p1 -b .connect + %build %configure --disable-desktop-update --disable-icon-update make %{?_smp_mflags} @@ -194,6 +199,10 @@ fi %{_datadir}/gtk-doc/html/gnome-bluetooth/ %changelog +* Thu Sep 03 2009 Bastien Nocera 2.27.90-2 +- Fix connecting to audio devices not working when disconnected + at start + * Wed Sep 02 2009 Bastien Nocera 2.27.90-1 - Update to 2.27.90