Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1639306ybc; Sun, 24 Nov 2019 03:05:43 -0800 (PST) X-Google-Smtp-Source: APXvYqyCUw/ByzI24UouLhYcF9+qF2Do2oI06GJaXg78KaZkVD+BN6g9aRdJrJQGdPE/0/CV7Bj4 X-Received: by 2002:aa7:cb53:: with SMTP id w19mr12067624edt.50.1574593543460; Sun, 24 Nov 2019 03:05:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574593543; cv=none; d=google.com; s=arc-20160816; b=cifzAqB9u+Ot/jX9I+ABWjN7s97L1ofXYlsXFO7iQXbgx3PDwy3PGxalCJScfpKkPJ tUwPLiaxaNfBrxsTRTcnNt6NV6ZqVay4mpzqdfwYjKAiyncWY6BcGGxM4RMv0Au87xT5 d22AQ9VyZQ/geOE74Qzcp/oQBWw/25YI0JIVsL2JK6sgGgbe2qgXgGvMfFkdFQqV1uWW SD5LYhgIU1vOMcQ+u1qD6tlztTqKVwPeernar6sxyRVRrW0UvZqMKCnEZJ49szJAgpVX n5bgsMWFsQxmyB/Po0ClWrPckgZEkW1bqj0e3nKW9nX2XLSAzOv1N1wBVENoIJeVbYkj KyEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=wkxOW00j1Cun+T8RvHyopDNE2Cr2hQLWwowBSN3fG8s=; b=QupGNgUYPBoooLk058Y2GPS7Mw7v56jAejq256XZELBtyf/Rsyz28vrRXQW1YH7IBL iAzJkpjAsRLToMlW6xphtvJujOR1BdT7KZdH3EWeLsuRNboMulsR9FmMR+24csUhU5fQ 4D5ZJZKaoXBmCb4dfYjehLu5QVDs/jghywzEVvJsNgPtWE83mwHxvNOkWmIqdPe/mCx/ TiUCQ+rkE7jj9iNGbsGIW7onUzl31GAE7FcuNTD+v5nBql+7fZKAknUb3ss5SpTH1GZ4 NzJAkcJ4n/Th40eX3IwGmTm2Sv8vL/LwHnNKPW+Y8XOWlT994iH+z4h3KuNyfYwShY+k XvPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si2363887eji.80.2019.11.24.03.05.18; Sun, 24 Nov 2019 03:05:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726813AbfKXLEl convert rfc822-to-8bit (ORCPT + 99 others); Sun, 24 Nov 2019 06:04:41 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:42562 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726705AbfKXLEl (ORCPT ); Sun, 24 Nov 2019 06:04:41 -0500 Received: from marcel-macbook.fritz.box (p4FF9F0D1.dip0.t-ipconnect.de [79.249.240.209]) by mail.holtmann.org (Postfix) with ESMTPSA id 9E84ECECD5; Sun, 24 Nov 2019 12:13:47 +0100 (CET) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3601.0.10\)) Subject: Re: HCI Set custom bandwidth for AuriStream SCO codec From: Marcel Holtmann In-Reply-To: <20191121224455.orhslaa6zdmlwe43@pali> Date: Sun, 24 Nov 2019 12:04:39 +0100 Cc: Pavel Machek , Luiz Augusto von Dentz , "linux-bluetooth@vger.kernel.org" , Johan Hedberg Content-Transfer-Encoding: 8BIT Message-Id: <390FC814-FBC2-4225-82C2-0CB866F01471@holtmann.org> References: <20190708122512.qqfvtm455ltxxg3h@pali> <20190708210616.x2dlnzjhnplu37bz@pali> <20190718100939.bwl26qcfxe6ppcto@pali> <20191027220945.wmb3g55wtrmqbnmz@pali> <1CFFA8EF-1B2A-466E-8901-BFB849F20442@holtmann.org> <20191119171342.mwfzszu7xwabi7to@pali> <392B6AA9-7512-472A-8F22-D86F2A7F1EDC@holtmann.org> <20191120074411.xtyw34kb3gc73zvk@pali> <20191121224455.orhslaa6zdmlwe43@pali> To: =?utf-8?Q?Pali_Roh=C3=A1r?= X-Mailer: Apple Mail (2.3601.0.10) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Pali, >> I was playing with another suggestion for API: >> >> +#define BT_VOICE_SETUP 14 >> +struct bt_voice_pkt_type { >> + __u8 capability; /* 0x01 - SCO; 0x02 - eSCO */ >> + __u8 retrans_effort; >> + __u16 pkt_type; >> + __u16 max_latency; >> +}; >> +struct bt_voice_setup { >> + __u16 voice_setting; >> + __u16 pkt_types_count; >> + __u32 tx_bandwidth; >> + __u32 rx_bandwidth; >> + struct bt_voice_pkt_type pkt_types[]; >> +}; >> >> So voice_setttings, pkt_types_count and badwidth would not be repeated >> as it is same for every pkt_type/retrans_effors/max_latency. >> >> But above uses C99 flexible arrays, so I do not know if API kernel <--> >> userspace API is allowed to use C99 flexible arrays. >> >> But getsockopt/setsockopt functions are possible to write with above >> API. > > I played more with C99 flexible arrays and seems that gcc supports it > without any problems. I'm sending another attempt of API implementation, > now with more fields which are needed for Enhanced Setup Synchronous > Connection command. This command is not supported by kernel yet, but > should be easy to add it. So my ioctl API is prepared for it. Enhanced > Setup Synchronous Connection command would be needed to use hardware > mSBC codec encoder/decoder. > > -- > Pali Rohár > pali.rohar@gmail.com > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h > index fabee6db0abb..29590c6749d5 100644 > --- a/include/net/bluetooth/bluetooth.h > +++ b/include/net/bluetooth/bluetooth.h > @@ -116,12 +116,49 @@ struct bt_voice { > __u16 setting; > }; > > -#define BT_VOICE_TRANSPARENT 0x0003 > -#define BT_VOICE_CVSD_16BIT 0x0060 > - > #define BT_SNDMTU 12 > #define BT_RCVMTU 13 > > +#define BT_VOICE_SETUP 14 > +#define BT_VOICE_PKT_TYPE_CAP_SCO BIT(0) > +#define BT_VOICE_PKT_TYPE_CAP_ESCO BIT(1) > +struct bt_voice_pkt_type { > + __u8 capability; /* bitmask of BT_VOICE_PKT_TYPE_CAP_* */ > + __u8 retrans_effort; > + __u16 pkt_type; > + __u16 max_latency; > +}; > +#define BT_VOICE_SETUP_FEATURE_CONFIG BIT(0) /* Additional configuration fields after voice_settings are set (including other features) */ > +#define BT_VOICE_SETUP_FEATURE_ADD_SCO BIT(1) /* Can use Add Synchronous Connection */ > +#define BT_VOICE_SETUP_FEATURE_SETUP_SCO BIT(2) /* Can use Setup Synchronous Connection */ > +#define BT_VOICE_SETUP_FEATURE_ENH_SETUP_SCO BIT(3) /* Can use Enhanced Setup Synchronous Connection */ > +struct bt_voice_setup { > + __u16 voice_setting; > + __u8 features; /* bitmask of BT_VOICE_SETUP_FEATURE_* */ > + __u8 pkt_types_count; > + __u32 tx_bandwidth; > + __u32 rx_bandwidth; > + __u32 input_bandwidth; > + __u32 output_bandwidth; > + __u8 tx_coding_format[5]; > + __u8 rx_coding_format[5]; > + __u8 input_coding_format[5]; > + __u8 output_coding_format[5]; > + __u16 tx_codec_frame_size; > + __u16 rx_codec_frame_size; > + __u16 input_coded_data_size; > + __u16 output_coded_data_size; > + __u8 input_pcm_data_format; > + __u8 output_pcm_data_format; > + __u8 input_pcm_msb_position; > + __u8 output_pcm_msb_position; > + __u8 input_data_path; > + __u8 output_data_path; > + __u8 input_unit_size; > + __u8 output_unit_size; > + struct bt_voice_pkt_type pkt_types[]; > +}; > + lets not mush these together. One of these are air codecs and setup defined by a profile, the other are local codec path defined by the platform. You will also not have multiple local codec path. That will be one and they will not be negotiated. The eSCO settings however will be negotiated. Regards Marcel