Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1041397ybc; Tue, 12 Nov 2019 13:17:03 -0800 (PST) X-Google-Smtp-Source: APXvYqxASy0lisNWPOWMAQ0HrKdccTEy4Cf8MOTSvBYE2j/3RRllBTmRDWu2hcoTtY4CwbpsLiyn X-Received: by 2002:a17:906:c789:: with SMTP id cw9mr30999273ejb.40.1573593422917; Tue, 12 Nov 2019 13:17:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573593422; cv=none; d=google.com; s=arc-20160816; b=d34ot4GoQj1JDWIKZwtqTcAhopM7OhP3R8UlecnnV4QIhS7wC/AxKyGNtb8QZA4R6k Pdx+8qecLl4IazuK0ZCRqRfez/ItsNkQ0akaBD/l3QrDJfEeSKs84SgUPzU6rsS+p+Rl NNE/JWw7gxY+veANiSrU0tARruhg8orIPYtdZnWKgBjSAv4f9pV9mTfugXc0lA+ScqIj EX5zfznkEZ5ENjgqoPGW+xcTE39un2K1kZhDZo+6hhar40IdBaeYAEdKU70nZZ4ClN6V CSyk2JLRbrGUPPnZZdOnWO9iFFOphpgXvOf1YFlGGVmp1taZRxnvGQNA+s0s0CTLNgEj zgfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=aMzbCgwxYefbPxMjcV3qnnKUjtgh3jGDVTZOQJvB6+E=; b=jUYN84oNBZaTBML0COJHN4MN6yiIipkDcVePoJENKFC/Ir7cMOXUmLkuKQ8+lYnOuj JHCqiUY9JkelsCVzQjBUa7DEXbeLwg5eQb7Kp0x+fbJgz4qWMVl7mQ3wW72uJ7J6PIOz APbQu9tn6UIzg9OWQe3npKIy3mICCCRey5q7CU1j7mSG+/hLKRdEmUYYEWQCJsOBU2ju 9cIHFOQc+q7N4iVkm3EyvIxMhSkrURV2pY3ex7jYZgdT1eow/z8WwmX0UJlN/3daQAAA dkjDxHGWdCfjshCF4vQv/+tpf4xO7ocZboerTteDwyR8RA5kLnwACgt1JFcF2TkbIhdK Aj0w== 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 d44si14616347ede.149.2019.11.12.13.16.26; Tue, 12 Nov 2019 13:17:02 -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 S1726980AbfKLVPw (ORCPT + 99 others); Tue, 12 Nov 2019 16:15:52 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:60178 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726376AbfKLVPw (ORCPT ); Tue, 12 Nov 2019 16:15:52 -0500 X-Greylist: delayed 556 seconds by postgrey-1.27 at vger.kernel.org; Tue, 12 Nov 2019 16:15:52 EST Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id F2FCE1C1189; Tue, 12 Nov 2019 22:06:33 +0100 (CET) Date: Tue, 12 Nov 2019 22:06:33 +0100 From: Pavel Machek To: Pali Roh??r Cc: Marcel Holtmann , Luiz Augusto von Dentz , "linux-bluetooth@vger.kernel.org" , Johan Hedberg Subject: Re: HCI Set custom bandwidth for AuriStream SCO codec Message-ID: <20191112210633.cjhpb7eczzta63mf@ucw.cz> References: <20190519212157.GB31403@amd> <20190607130245.mv4ch6dxnuptzdki@pali> <20190708122512.qqfvtm455ltxxg3h@pali> <20190708210616.x2dlnzjhnplu37bz@pali> <20190718100939.bwl26qcfxe6ppcto@pali> <20191027220945.wmb3g55wtrmqbnmz@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191027220945.wmb3g55wtrmqbnmz@pali> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi! > > > >>>>>>>> But for AuriStream I need to set custom SCO parameters as described > > > >>>>>>>> below and currently kernel does not support it. This is why I'm asking > > > >>>>>>>> how kernel can export for userspace configuration of SCO parameters... > > > >>>>>>> > > > >>>>>>> We can always come up with socket options but we got to see the value > > > >>>>>>> it would bring since AuriStream don't look that popular among > > > >>>>>>> headsets, at least Ive never seem any device advertising it like > > > >>>>>>> apt-X, etc. > > > >>>>>> > > > >>>>>> Pali clearly has such device and he is willing to work on it. Surely > > > >>>>>> that means it is popular enough to be supported...? > > > >>>>> > > > >>>>> Just put AT+CSRSF=0,0,0,0,0,7 to google search and you would see that > > > >>>>> not only I have such device... > > > >>>>> > > > >>>>> So I would really would like to see that kernel finally stops blocking > > > >>>>> usage of this AuriStream codec. > > > >>>> > > > >>>> we need to figure out on how we do the kernel API to allow you this specific setting. > > > >>> > > > >>> Hi Marcel! Kernel API for userspace should be simple. Just add two > > > >>> ioctls for retrieving and setting structure with custom parameters: > > > >>> > > > >>> syncPktTypes = 0x003F > > > >>> bandwidth = 4000 > > > >>> max_latency = 16 > > > >>> voice_settings = 0x63 > > > >>> retx_effort = 2 > > > >>> > > > >>> Or add more ioctls, one ioctl per parameter. There is already only ioctl > > > >>> for voice settings and moreover it is whitelisted only for two values. > > > >> > > > >> it is not that simple actually. Most profiles define a certain set of parameters and then they try to configure better settings and only fallback to a specification defined default as last resort. > > > > > > > > Ok. I see that there is another "example" configuration for AuriStream > > > > with just different syncPktTypes = 0x02BF and bandwidth = 3850. > > > > > > > > So it really is not simple as it can be seen. > > > > > > currently the stepping for mSBC and CVSD are hard-coded in esco_param_cvsd and esco_param_msbc arrays in hci_conn.c and then selected by the ->setting parameter. > > > > > > So either we provide an new socket option (for example BT_VOICE_EXT) or we extend BT_VOICE to allow providing the needed information. However this needs to be flexible array size since we should then be able to encode multiple stepping that are tried in order. > > > > > > My preference is that we extend BT_VOICE and not introduce a new socket option. So feel free to propose how we can load the full tables into the SCO socket. I mean we are not really far off actually. The only difference is that currently the tables are in the hci_conn.c file and selected by the provided voice->setting. However nothing really stops us from providing the full table via user space. > > > > Ok. I will look at it and I will try to propose how to extend current > > BT_VOICE ioctl API for supporting all those new parameters. > > Below is inline MIME part with POC patch which try to implement a new > IOCTL (currently named BT_VOICE_SETUP) for configuring voice sco > settings. > > It uses flexible array of parameters voice_setting, pkt_type, max_latency, retrans_effort>, but with > maximally 10 array members (due to usage of static array storage). cvsd > codec uses 7 different fallback settings (see voice_setup_cvsd), so for > POC 10 should be enough. > > Because a new IOCL has different members then old BT_VOICE I rather > decided to introduce a new IOCTL and not hacking old IOCTL to accept two > different structures. > > Please let me know what do you think about this API, if this is a way > how to continue or if something different is needed. New ioctl sounds like good idea. > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h > index fabee6db0abb..0e9f4ac07220 100644 > --- a/include/net/bluetooth/bluetooth.h > +++ b/include/net/bluetooth/bluetooth.h > @@ -122,6 +122,19 @@ struct bt_voice { > #define BT_SNDMTU 12 > #define BT_RCVMTU 13 > > +#define BT_VOICE_SETUP 14 > +#define BT_VOICE_SETUP_ARRAY_SIZE 10 > +struct bt_voice_setup { > + __u8 sco_capable:1; > + __u8 esco_capable:1; > + __u32 tx_bandwidth; > + __u32 rx_bandwidth; > + __u16 voice_setting; > + __u16 pkt_type; > + __u16 max_latency; > + __u8 retrans_effort; > +}; > + Is this the new ioctl? I'd assume it should go to include/user/.. somewhere to be exported to userspace...? Is it good idea to use __u8 :1 in user<->kernel API? Pavel