All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org, David Heidelberg <david@ixit.cz>
Subject: [PATCH 3/3] src/profile: Add default SDP record for Headset role of HSP 1.2 profile with Erratum 3507
Date: Mon, 13 Apr 2020 18:25:13 +0200	[thread overview]
Message-ID: <20200413162513.2221-4-pali@kernel.org> (raw)
In-Reply-To: <20200413162513.2221-1-pali@kernel.org>

This would allow DBus agents to implement HS role of HSP profile.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 src/profile.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/src/profile.c b/src/profile.c
index 3b7e08f26..09627fbbd 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -56,6 +56,7 @@
 
 #define DUN_DEFAULT_CHANNEL	1
 #define SPP_DEFAULT_CHANNEL	3
+#define HSP_HS_DEFAULT_CHANNEL	6
 #define HFP_HF_DEFAULT_CHANNEL	7
 #define OPP_DEFAULT_CHANNEL	9
 #define FTP_DEFAULT_CHANNEL	10
@@ -155,6 +156,49 @@
 		</attribute>						\
 	</record>"
 
+/* SDP record for Headset role of HSP 1.2 profile with Erratum 3507 */
+#define HSP_HS_RECORD							\
+	"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>			\
+	<record>							\
+		<attribute id=\"0x0001\">				\
+			<sequence>					\
+				<uuid value=\"0x1108\" />		\
+				<uuid value=\"0x1131\" />		\
+				<uuid value=\"0x1203\" />		\
+			</sequence>					\
+		</attribute>						\
+		<attribute id=\"0x0004\">				\
+			<sequence>					\
+				<sequence>				\
+					<uuid value=\"0x0100\" />	\
+				</sequence>				\
+				<sequence>				\
+					<uuid value=\"0x0003\" />	\
+					<uint8 value=\"0x%02x\" />	\
+				</sequence>				\
+			</sequence>					\
+		</attribute>						\
+		<attribute id=\"0x0005\">				\
+			<sequence>					\
+				<uuid value=\"0x1002\" />		\
+			</sequence>					\
+		</attribute>						\
+		<attribute id=\"0x0009\">				\
+			<sequence>					\
+				<sequence>				\
+					<uuid value=\"0x1108\" />	\
+					<uint16 value=\"0x%04x\" />	\
+				</sequence>				\
+			</sequence>					\
+		</attribute>						\
+		<attribute id=\"0x0100\">				\
+			<text value=\"%s\" />				\
+		</attribute>						\
+		<attribute id=\"0x0302\">				\
+			<boolean value=\"%s\" />			\
+		</attribute>						\
+	</record>"
+
 #define HSP_AG_RECORD							\
 	"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>			\
 	<record>							\
@@ -1789,6 +1833,16 @@ static char *get_hfp_ag_record(struct ext_profile *ext, struct ext_io *l2cap,
 				ext->have_features ? ext->features : 0x9);
 }
 
+static char *get_hsp_hs_record(struct ext_profile *ext, struct ext_io *l2cap,
+							struct ext_io *rfcomm)
+{
+	/* HSP 1.2: By default Remote Audio Volume Control is off */
+	return g_strdup_printf(HSP_HS_RECORD, rfcomm->chan, ext->version,
+				ext->name,
+				(ext->have_features && (ext->features & 0x1))
+				? "true" : "false");
+}
+
 static char *get_hsp_ag_record(struct ext_profile *ext, struct ext_io *l2cap,
 							struct ext_io *rfcomm)
 {
@@ -2012,6 +2066,16 @@ static struct default_settings {
 		.auto_connect	= true,
 		.get_record	= get_hfp_ag_record,
 		.version	= 0x0107,
+	}, {
+		.uuid		= HSP_HS_UUID,
+		.name		= "Headset unit",
+		.priority	= BTD_PROFILE_PRIORITY_HIGH,
+		.remote_uuid	= HSP_AG_UUID,
+		.channel	= HSP_HS_DEFAULT_CHANNEL,
+		.authorize	= true,
+		.auto_connect	= true,
+		.get_record	= get_hsp_hs_record,
+		.version	= 0x0102,
 	}, {
 		.uuid		= HSP_AG_UUID,
 		.name		= "Headset Voice gateway",
-- 
2.20.1


  parent reply	other threads:[~2020-04-13 16:25 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 17:29 bluez: Export SDP "Remote audio volume control" item for HSP profile Pali Rohár
2019-12-12 19:42 ` Luiz Augusto von Dentz
2019-12-12 23:03   ` Pali Rohár
2020-02-09 13:02     ` Pali Rohár
2020-03-20 13:01       ` Pali Rohár
2020-03-20 17:48         ` Luiz Augusto von Dentz
2020-03-21 18:40           ` Pali Rohár
2020-03-21 19:54             ` Pali Rohár
2020-04-13 16:25               ` [PATCH 0/3] " Pali Rohár
2020-04-13 16:25                 ` [PATCH 1/3] src/profile: Distinguish between zero-set HFP AG features and unset HFP AG features Pali Rohár
2020-04-13 16:44                   ` Luiz Augusto von Dentz
2020-04-13 16:52                     ` Pali Rohár
2020-04-13 16:58                       ` Luiz Augusto von Dentz
2020-04-13 17:17                         ` Pali Rohár
2020-04-13 17:47                           ` Luiz Augusto von Dentz
2020-04-13 17:58                             ` Pali Rohár
2020-04-13 19:41                               ` Luiz Augusto von Dentz
2020-04-13 19:51                                 ` Pali Rohár
2020-04-13 20:24                                   ` Luiz Augusto von Dentz
2020-04-13 20:42                                     ` Pali Rohár
2020-04-13 21:07                                       ` Luiz Augusto von Dentz
2020-04-13 22:26                                         ` Pali Rohár
2020-04-13 16:25                 ` [PATCH 2/3] src/profile: Export Remote Audio Volume Control SDP value for HSP HS role via first bit in features value Pali Rohár
2020-04-13 16:25                 ` Pali Rohár [this message]
2020-04-13 16:51                   ` [PATCH 3/3] src/profile: Add default SDP record for Headset role of HSP 1.2 profile with Erratum 3507 Luiz Augusto von Dentz
2020-04-14  0:09                 ` [PATCH 0/3] bluez: Export SDP "Remote audio volume control" item for HSP profile Luiz Augusto von Dentz
2020-04-14  8:09                   ` Pali Rohár
2020-04-14 19:53                   ` Pali Rohár
2020-04-14 20:28                     ` Luiz Augusto von Dentz
2020-04-14 20:46                       ` [PATCH] doc: Update documentation for HSP and HFP profiles Pali Rohár
2020-04-14 21:03                         ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200413162513.2221-4-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=david@ixit.cz \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.