From e3b8a6484b23650f2e55047240dac25fece697cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 13 Apr 2020 18:25:13 +0200 Subject: [PATCH] profile: Add default SDP record for Headset role of HSP 1.2 This would allow D-Bus agents to implement HS role of HSP profile. --- src/profile.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/src/profile.c b/src/profile.c index e94f28675..7e27adb56 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 @@ \ " +/* SDP record for Headset role of HSP 1.2 profile with Erratum 3507 */ +#define HSP_HS_RECORD \ + " \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + " + #define HSP_AG_RECORD \ " \ \ @@ -1776,6 +1820,15 @@ static char *get_hfp_ag_record(struct ext_profile *ext, struct ext_io *l2cap, ext->name, ext->features); } +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->features & 0x1) ? "true" : + "false"); +} + static char *get_hsp_ag_record(struct ext_profile *ext, struct ext_io *l2cap, struct ext_io *rfcomm) { @@ -1988,6 +2041,16 @@ static struct default_settings { .auto_connect = true, .get_record = get_hfp_hf_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 = HFP_AG_UUID, .name = "Hands-Free Voice gateway", -- 2.47.3