summaryrefslogtreecommitdiff
path: root/src/profile.c
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2020-04-13 18:25:12 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-04-13 17:06:59 -0700
commit040bd56a948f4d1ecd6987cdf0ba51779dc0c02a (patch)
tree1a04e94eb91cd1a31c7cb9bc544dd5b63dc08bce /src/profile.c
parentb84bd5ee0b76155c3d3acc2d70e10a020ccf1bbb (diff)
downloadbluez-040bd56a948f4d1ecd6987cdf0ba51779dc0c02a.tar.gz
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.
Diffstat (limited to 'src/profile.c')
-rw-r--r--src/profile.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/profile.c b/src/profile.c
index 9ccdd90ee..e94f28675 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -920,10 +920,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;
@@ -974,7 +986,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;