bluetooth: recognize another HSP HS UUID

There are actually two HSP HS UUIDs. My theory is that the second one
was added, because someone was not happy with the old UUID being used
for identifying two different things (the HSP profile as a whole, and
the HS role within the HSP profile). Some headsets only use the new
UUID, and those headsets won't work if we don't recognize the new UUID.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93898
This commit is contained in:
Tanu Kaskinen 2017-09-02 15:44:58 +03:00
parent 15386a710c
commit 9c7a9be7cd
4 changed files with 14 additions and 2 deletions

View file

@ -335,7 +335,7 @@ static void register_profile(pa_bluetooth_backend *b, const char *profile, const
pa_assert_se(dbus_message_iter_append_basic(&i, DBUS_TYPE_STRING, &uuid)); pa_assert_se(dbus_message_iter_append_basic(&i, DBUS_TYPE_STRING, &uuid));
dbus_message_iter_open_container(&i, DBUS_TYPE_ARRAY, DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING dbus_message_iter_open_container(&i, DBUS_TYPE_ARRAY, DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING
DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &d); DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &d);
if (pa_streq (uuid, PA_BLUETOOTH_UUID_HSP_HS)) { if (pa_bluetooth_uuid_is_hsp_hs(uuid)) {
/* In the headset role, the connection will only be initiated from the remote side */ /* In the headset role, the connection will only be initiated from the remote side */
autoconnect = 0; autoconnect = 0;
pa_dbus_append_basic_variant_dict_entry(&d, "AutoConnect", DBUS_TYPE_BOOLEAN, &autoconnect); pa_dbus_append_basic_variant_dict_entry(&d, "AutoConnect", DBUS_TYPE_BOOLEAN, &autoconnect);

View file

@ -176,6 +176,7 @@ static bool device_supports_profile(pa_bluetooth_device *device, pa_bluetooth_pr
return !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_A2DP_SOURCE); return !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_A2DP_SOURCE);
case PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT: case PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT:
return !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_HS) return !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_HS)
|| !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_HS_ALT)
|| !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HFP_HF); || !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HFP_HF);
case PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY: case PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY:
return !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_AG) return !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_AG)

View file

@ -24,7 +24,14 @@
#define PA_BLUETOOTH_UUID_A2DP_SOURCE "0000110a-0000-1000-8000-00805f9b34fb" #define PA_BLUETOOTH_UUID_A2DP_SOURCE "0000110a-0000-1000-8000-00805f9b34fb"
#define PA_BLUETOOTH_UUID_A2DP_SINK "0000110b-0000-1000-8000-00805f9b34fb" #define PA_BLUETOOTH_UUID_A2DP_SINK "0000110b-0000-1000-8000-00805f9b34fb"
/* There are two HSP HS UUIDs. The first one (older?) is used both as the HSP
* profile identifier and as the HS role identifier, while the second one is
* only used to identify the role. As far as PulseAudio is concerned, the two
* UUIDs mean exactly the same thing. */
#define PA_BLUETOOTH_UUID_HSP_HS "00001108-0000-1000-8000-00805f9b34fb" #define PA_BLUETOOTH_UUID_HSP_HS "00001108-0000-1000-8000-00805f9b34fb"
#define PA_BLUETOOTH_UUID_HSP_HS_ALT "00001131-0000-1000-8000-00805f9b34fb"
#define PA_BLUETOOTH_UUID_HSP_AG "00001112-0000-1000-8000-00805f9b34fb" #define PA_BLUETOOTH_UUID_HSP_AG "00001112-0000-1000-8000-00805f9b34fb"
#define PA_BLUETOOTH_UUID_HFP_HF "0000111e-0000-1000-8000-00805f9b34fb" #define PA_BLUETOOTH_UUID_HFP_HF "0000111e-0000-1000-8000-00805f9b34fb"
#define PA_BLUETOOTH_UUID_HFP_AG "0000111f-0000-1000-8000-00805f9b34fb" #define PA_BLUETOOTH_UUID_HFP_AG "0000111f-0000-1000-8000-00805f9b34fb"
@ -157,6 +164,10 @@ pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hoo
const char *pa_bluetooth_profile_to_string(pa_bluetooth_profile_t profile); const char *pa_bluetooth_profile_to_string(pa_bluetooth_profile_t profile);
static inline bool pa_bluetooth_uuid_is_hsp_hs(const char *uuid) {
return pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS) || pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS_ALT);
}
#define HEADSET_BACKEND_OFONO 0 #define HEADSET_BACKEND_OFONO 0
#define HEADSET_BACKEND_NATIVE 1 #define HEADSET_BACKEND_NATIVE 1
#define HEADSET_BACKEND_AUTO 2 #define HEADSET_BACKEND_AUTO 2

View file

@ -1960,7 +1960,7 @@ static int uuid_to_profile(const char *uuid, pa_bluetooth_profile_t *_r) {
*_r = PA_BLUETOOTH_PROFILE_A2DP_SINK; *_r = PA_BLUETOOTH_PROFILE_A2DP_SINK;
else if (pa_streq(uuid, PA_BLUETOOTH_UUID_A2DP_SOURCE)) else if (pa_streq(uuid, PA_BLUETOOTH_UUID_A2DP_SOURCE))
*_r = PA_BLUETOOTH_PROFILE_A2DP_SOURCE; *_r = PA_BLUETOOTH_PROFILE_A2DP_SOURCE;
else if (pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS) || pa_streq(uuid, PA_BLUETOOTH_UUID_HFP_HF)) else if (pa_bluetooth_uuid_is_hsp_hs(uuid) || pa_streq(uuid, PA_BLUETOOTH_UUID_HFP_HF))
*_r = PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT; *_r = PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT;
else if (pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_AG) || pa_streq(uuid, PA_BLUETOOTH_UUID_HFP_AG)) else if (pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_AG) || pa_streq(uuid, PA_BLUETOOTH_UUID_HFP_AG))
*_r = PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY; *_r = PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY;