Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4387170ybb; Tue, 14 Apr 2020 06:22:48 -0700 (PDT) X-Google-Smtp-Source: APiQypKiCTSFDOXEloqKu0K7YFC4SEQfzwo3IMsqkxR6FJFsykNjJXsGb6QvC0RbZZ2cPr9hm1hY X-Received: by 2002:aa7:d2da:: with SMTP id k26mr19414821edr.376.1586870568114; Tue, 14 Apr 2020 06:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586870568; cv=none; d=google.com; s=arc-20160816; b=VEa29PDrCQQVERO3wuzWy0pQIW/NzzI3/VD9FWhz0edn9i3q50zy0KLTtkX0gPh7JK 4WiSOZ0PzStLZAoqmh4/whz1MeF/mmQvoo++9J0OhHLRzFHEjTG63XjJxxovMMknWJAm UTsJEuj3qj0jP7qOp4ww/viszMjG0uwMlOqdLHMr2jEg4m6IxJTuSZsTe5wxoeOgonBk cnZNq7c8kl0EI66oiX2FqfeXniaZldnOUZQOpPBwVSjgfdiZl2H1gfs0FXf4Gh7TWV4w ugl8qOaBoDoBn3nHadNV5C6INAqGRvnJOFxgsHtHYbMR+kEhbELky+TGeHOrvGQaPaxx oHdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ifidQR91L56HygTjmGzaJyftdneiLaujdeTDfHWROEg=; b=jk4h25x5yaJbCJD7+Oj+ofOx4oOfiJM1R4mna40zCt6PbVLrLi64221bWbphYO1+p+ VrNLjC6pz24cAra+ugHsSTk0cmrMcLa3kp4/B4UilD3r8IsO9W/dH3gYjFerxYe/Pf8b kSm4VHjgG15xssNU9l6ejQs/CNUewHLLHK3vTGCYOKLkQ3TYZukaYvWS5rCmzT0kbBKf Q1f6lGD+PLpBGr+G4L+Wc4F+3o6FTYf2pfaFYdTYDXRibIq5zd8C5PqBdI3ZgW+zNSml vV1fzv7NSiDZFq0h2mHKwM7305JQOPTP1W7mGwG3nlV+RUYC1+R/hXAJvtKmDo7B7XJa XE9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dvUXlrRl; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j8si8141854edl.317.2020.04.14.06.22.23; Tue, 14 Apr 2020 06:22:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dvUXlrRl; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731515AbgDMQZq (ORCPT + 99 others); Mon, 13 Apr 2020 12:25:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:52076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731525AbgDMQZo (ORCPT ); Mon, 13 Apr 2020 12:25:44 -0400 Received: from pali.im (pali.im [31.31.79.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6706A20732; Mon, 13 Apr 2020 16:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586795144; bh=KA9JqUSkIVZR20ZIJ8nmwFuRrBx6hlCxjpYK9LdmC3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dvUXlrRlqdxvqR560uP8Rullx9LUMWaDEBs+06w1zBf8ix/aPePBfNbvvQPZrpCA7 7WmKP7RPDBpwhGdxqPCPYJbmUPBdUh+I7GwafoOjaeDPLNq3i56UD42GQMuTXeExtP 0jlJ5kz4NOkK2lkcAbGGCbJefFssCNHU/GKNS96g= Received: by pali.im (Postfix) id 828E7EC3; Mon, 13 Apr 2020 18:25:42 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Luiz Augusto von Dentz Cc: linux-bluetooth@vger.kernel.org, David Heidelberg Subject: [PATCH 2/3] src/profile: Export Remote Audio Volume Control SDP value for HSP HS role via first bit in features value Date: Mon, 13 Apr 2020 18:25:12 +0200 Message-Id: <20200413162513.2221-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200413162513.2221-1-pali@kernel.org> References: <20200321195404.fvyku5hmcuqxt7sg@pali> <20200413162513.2221-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Remote Audio Volume Control property in SDP record for HSP HS role indicates if device supports volume control. It is required for DBus 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: Pali Rohár --- src/profile.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/profile.c b/src/profile.c index 884440408..3b7e08f26 100644 --- a/src/profile.c +++ b/src/profile.c @@ -923,10 +923,26 @@ static void append_prop(gpointer a, gpointer b) } static uint16_t get_supported_features(const sdp_record_t *rec, - bool *have_features) + const char *uuid, bool *have_features) { sdp_data_t *data; + if (strcasecmp(uuid, HSP_AG_UUID) == 0) { + /* HSP AG role does not provide any features */ + *have_features = false; + 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) { + *have_features = false; + return 0; + } else { + *have_features = true; + return data->val.int8 ? 0x1 : 0x0; + } + } + data = sdp_data_get(rec, SDP_ATTR_SUPPORTED_FEATURES); if (!data || data->dtd != SDP_UINT16) { *have_features = false; @@ -979,7 +995,7 @@ static bool send_new_connection(struct ext_profile *ext, struct ext_io *conn) rec = btd_device_get_record(conn->device, remote_uuid); if (rec) { conn->features = get_supported_features(rec, - &conn->have_features); + remote_uuid, &conn->have_features); conn->version = get_profile_version(rec); } } @@ -1596,7 +1612,7 @@ static void record_cb(sdp_list_t *recs, int err, gpointer user_data) if (conn->psm == 0 && sdp_get_proto_desc(protos, OBEX_UUID)) conn->psm = get_goep_l2cap_psm(rec); - conn->features = get_supported_features(rec, + conn->features = get_supported_features(rec, ext->remote_uuid, &conn->have_features); conn->version = get_profile_version(rec); -- 2.20.1