From patchwork Mon Apr 13 16:25:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 11485909 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 974B513B2 for ; Mon, 13 Apr 2020 16:25:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F97B20732 for ; Mon, 13 Apr 2020 16:25:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586795149; bh=DQjlPiY6Eyps/1NaA+933ltNVayJQeghPvUr9J64T3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HBrHERGMRqe21kqizIIdDGxDvclEVazqWTZLIPoN/daF1oBXoxdgXmRNfqpndo1pl 45x6ZJxZ6oLKFa+znrP0mo0SGSEHojvrGFqWy5Uk2lCm3dU51J0CGm7jhT3ZcIYafe 02ImIHKHFrLJ9mRH9y+YplbIHBUkpbj1k3YTLQXM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731531AbgDMQZs (ORCPT ); Mon, 13 Apr 2020 12:25:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:52106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731527AbgDMQZq (ORCPT ); Mon, 13 Apr 2020 12:25:46 -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 9DD0320692; Mon, 13 Apr 2020 16:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586795145; bh=DQjlPiY6Eyps/1NaA+933ltNVayJQeghPvUr9J64T3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rwiyIM6xM9dsU2m458n3T+6DFcucp6Yo89yPhcAcB5GMQdTF2XBsK6WCOGCv+/am3 +4LaxfXYJVom95S7+xhekj18F2qSr9Cio+FgG0RNYdWnOL7kFEveo2tgCbnrvV69Kp ZdTS0ozVqcHlFQlqbNl0f0lSi7ZAA/9IirQrPpOA= Received: by pali.im (Postfix) id C6489895; Mon, 13 Apr 2020 18:25:43 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Luiz Augusto von Dentz Cc: linux-bluetooth@vger.kernel.org, David Heidelberg 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 Message-Id: <20200413162513.2221-4-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 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This would allow DBus agents to implement HS role of HSP profile. Signed-off-by: Pali Rohár --- 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 @@ \ " +/* SDP record for Headset role of HSP 1.2 profile with Erratum 3507 */ +#define HSP_HS_RECORD \ + " \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + " + #define HSP_AG_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",