[gnome-bluetooth] Bug 594055 - applet fails to connect to any disconnected audio device
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] Bug 594055 - applet fails to connect to any disconnected audio device
- Date: Thu, 3 Sep 2009 17:20:46 +0000 (UTC)
commit b4b046cd37324454c7125d345cceabb5c6f61612
Author: Bastien Nocera <hadess hadess net>
Date: Thu Sep 3 18:17:43 2009 +0100
Bug 594055 - applet fails to connect to any disconnected audio device
Hunted down by Peter Hurley <phurley charter net>.
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]