From 27f5acc892aa25386fe11945e31b24f81a0443c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Mon, 13 Apr 2020 18:25:12 +0200 Subject: [PATCH] profile: Export Remote Audio Volume Control SDP value Remote Audio Volume Control property in SDP record for HSP HS role indicates if device supports volume control. It is required for D-Bus agents which implements audio part of HSP profile to know if remote device supports volume control or not. With this change bluez exports status of this SDP property via firt bit in Features entry in NewConnection() DBus callback method, like for HFP profile. Signed-off-by: Anuj Jain Signed-off-by: Ayush Garg --- src/profile.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/profile.c b/src/profile.c index 5cda568..0b5bef9 100644 --- a/src/profile.c +++ b/src/profile.c @@ -1215,10 +1215,22 @@ static void append_prop(gpointer a, gpointer b) dbus_message_iter_close_container(dict, &entry); } -static int get_supported_features(const sdp_record_t *rec) +static int get_supported_features(const sdp_record_t *rec, const char *uuid) { sdp_data_t *data; + if (strcasecmp(uuid, HSP_AG_UUID) == 0) { + /* HSP AG role does not provide any features */ + return 0; + } else if (strcasecmp(uuid, HSP_HS_UUID) == 0) { + /* HSP HS role provides Remote Audio Volume Control */ + data = sdp_data_get(rec, SDP_ATTR_REMOTE_AUDIO_VOLUME_CONTROL); + if (!data || data->dtd != SDP_BOOL) + return -ENOENT; + else + return data->val.int8 ? 0x1 : 0x0; + } + data = sdp_data_get(rec, SDP_ATTR_SUPPORTED_FEATURES); if (!data || data->dtd != SDP_UINT16) { return -ENOENT; @@ -1269,7 +1281,7 @@ static bool send_new_connection(struct ext_profile *ext, struct ext_io *conn) if (remote_uuid) { rec = btd_device_get_record(conn->device, remote_uuid); if (rec) { - features = get_supported_features(rec); + features = get_supported_features(rec, remote_uuid); if (features >= 0) { conn->features = features; has_features = true; -- 2.7.4