From 15ed6000c87ad5a4e314afb86fb98ea8b2dd76c6 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 11 Jan 2008 11:19:00 +0000 Subject: Make sure the correct handle value gets updated when parsing HSP/HFP records --- audio/headset.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'audio') diff --git a/audio/headset.c b/audio/headset.c index cef32250..73c832f2 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -696,7 +696,6 @@ static void get_record_reply(DBusPendingCall *call, void *data) struct device *device = data; struct headset *hs = device->headset; struct pending_connect *c; - unsigned int id; c = hs->pending->data; @@ -741,17 +740,23 @@ static void get_record_reply(DBusPendingCall *call, void *data) memcpy(&uuid, classes->data, sizeof(uuid)); - if (!sdp_uuid128_to_uuid(&uuid)) { + if (!sdp_uuid128_to_uuid(&uuid) || uuid.type != SDP_UUID16) { error("Not a 16 bit UUID"); goto failed_not_supported; } - id = hs->search_hfp ? HANDSFREE_SVCLASS_ID : HEADSET_SVCLASS_ID; - - if ((uuid.type == SDP_UUID32 && uuid.value.uuid32 != id) - || (uuid.type == SDP_UUID16 && uuid.value.uuid16 != id)) { - error("Service classes did not contain the expected UUID"); - goto failed_not_supported; + if (hs->search_hfp) { + if (uuid.value.uuid16 != HANDSFREE_SVCLASS_ID) { + error("Service record didn't contain the HFP UUID"); + goto failed_not_supported; + } + hs->hfp_handle = record->handle; + } else { + if (uuid.value.uuid16 != HEADSET_SVCLASS_ID) { + error("Service record didn't contain the HSP UUID"); + goto failed_not_supported; + } + hs->hsp_handle = record->handle; } if (!sdp_get_access_protos(record, &protos)) { -- cgit