Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp846165ybv; Thu, 13 Feb 2020 10:34:10 -0800 (PST) X-Google-Smtp-Source: APXvYqwpOH9USk7panBdwRZHzMQXScsfE20u0QDiI/t4ffJL7xi2b9lGGUPu+G5y2P35Xz2iYyla X-Received: by 2002:a54:450d:: with SMTP id l13mr3944578oil.117.1581618849962; Thu, 13 Feb 2020 10:34:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581618849; cv=none; d=google.com; s=arc-20160816; b=ZjjTpSLnlOazCSY1JKnDv3mqP2hKFYU5TQAvLrg3X0TvxcuHMdJnJWR0hQOhRtgCKC upXWLx7pmH/g2ldoE3uQPKfpFBG2kGmo60kmPKiTA+nDLvtvrGRa/z3C0WHkajLRTpkb FoTcyCobLQ4c0L5MQfScYjYk1KAYKKxpBbdHOMcAERwS5W2yyrdGxxmqpPRCgc6JJdU6 ahpwOFLCFXVNa1eqEBwgX+oavNa6+WWpyoH3bsHkIIlfIUqij9bFB0ZldSkeoikil0Ju gKi00HWZDC71DGGIQwloy5CbiAtZ/wB0l9ESYS4kO+HiAkQc68cG5UpKKHGENklcUcrX wkKQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nQ1O54l/xJoKtZAHjl/ZHrEcTWofgNpjma9R21hQbe4=; b=GSXXUPgQXr6vD++itWZBZgX6vQZZVUTxhb1GAlE7j6+agI1MhbtZgofkgx4Kwiaosr yr/K5Gx1qGgcbEVG+J+iPCm/oxFwEapKUcmHOMVr2XRJLdncEl2VifdYm2URlaxqSRQp 5fFNHFJjJsqf//8tS1Ie0yRoI2ldU78v90oFMKa04Jf8gM6YouH78EdCNwbC7cJfZR/x JTVpeMH+UMQL7yidjO0VOidUZ3dzROnSOFnRSsZA4AeQWREekgpuij8BInGjZ0Fntmh4 WxmQeHhlnzmyd4Kf3npD8m33e1cINzdTnwjTvwLQOTCv603C/kAdFObHspLiuSTqGpPL NtDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fq0tSyNw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k11si1593888otp.176.2020.02.13.10.33.50; Thu, 13 Feb 2020 10:34:09 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fq0tSyNw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728022AbgBMSc5 (ORCPT + 99 others); Thu, 13 Feb 2020 13:32:57 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:35660 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbgBMSc5 (ORCPT ); Thu, 13 Feb 2020 13:32:57 -0500 Received: by mail-wr1-f67.google.com with SMTP id w12so7949903wrt.2 for ; Thu, 13 Feb 2020 10:32:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=nQ1O54l/xJoKtZAHjl/ZHrEcTWofgNpjma9R21hQbe4=; b=Fq0tSyNwt4zsLvpuJ38pHkmkFWJBAweoWjmcKy4s6y8cy6xE9B9Ivw9yJ4XTL9zQkj MlQ8NcJbalHXJUEAzFRc43XuR+W++DcQSGOwYZGlK3jY4ClC0CjJPluVgseGDfhm4HzV 4HB0Z3oYxuEVIl+/brm0izoHAg9vkPrl8GISm+50RTtRWlYzvg6kIMl3qZvQALb8PKWF n0WSwO/4dyUr0kvOQ1qrgqYLVl2ntNQ9YXNH33VYXVHbxOnfCOnoNegb90Ye2BOjCY3K 6in559lrMep2SFeOYPkc/k2eC3v4iSQ6DchLZFvnRU31dRFf64p5dNQvpX44nwHyGDIM v1DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=nQ1O54l/xJoKtZAHjl/ZHrEcTWofgNpjma9R21hQbe4=; b=IHbaqX9YI+y8EjamWTi+1g7JXncjdNn4Q7nrqwGL5Zj5QhRAv9wWP68ShVvC0ebIir B8NGxtyWN++TecsG1NmEw+7ddQmLUvAe+0MRDPq3/pDT0Q/82dXWSgSdMeru7U/TQ2LZ 4XFu8TSdIq3vq2xGOCUhUdRn5NnwLooxE8Al7uM/c9tBp5HG3bVnAD1WM7BcYyT/51K5 vFXuu1unW3WqUjQ1maeQGg5mD9VOt31BdadwcP4mTPfQ0RGrLQIVPSr9EeN9fW7yugxE jSqcI4hyyaiMku8yz88iATBX2yOPhBCB6Msd4Czt4qg5Ge1ltPHHHH+75KRhx+LfQfr6 Sy6A== X-Gm-Message-State: APjAAAVRlDeBhgJ3kWlFXH3Xw7VQAr5w1PqU6DPmUPaHJJs20ifid5jJ jKRjcaUbw3lFHG0Mca0vrxzXtdqm X-Received: by 2002:adf:afd2:: with SMTP id y18mr856600wrd.90.1581618774660; Thu, 13 Feb 2020 10:32:54 -0800 (PST) Received: from pali ([2a02:2b88:2:1::5cc6:2f]) by smtp.gmail.com with ESMTPSA id 25sm4118723wmi.32.2020.02.13.10.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 10:32:54 -0800 (PST) Date: Thu, 13 Feb 2020 19:32:53 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Denis Kenzior Cc: ofono@ofono.org, linux-bluetooth@vger.kernel.org Subject: Re: HSP/HFP ofono bluetooth support for Linux desktop Message-ID: <20200213183253.44vkm6bpddre4dvp@pali> References: <20200107192311.efit6zftt27encdc@pali> <721332d3-336a-b9d2-f8cd-72da785fb9dc@gmail.com> <20200108212537.zs6pesil2vjguvu6@pali> <57639029-7588-956b-8e3c-a2a6ed11b758@gmail.com> <20200213174621.e2q4ryu36p5ericx@pali> <6679dd2b-4780-e44f-b86d-28cf65638888@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6679dd2b-4780-e44f-b86d-28cf65638888@gmail.com> User-Agent: NeoMutt/20180716 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Thursday 13 February 2020 12:14:06 Denis Kenzior wrote: > Hi Pali, > > > Used by who? Gateway role is fully broken and client (hfp) role is used > > I guess that depends on your perspective. I've already pointed out that the > desktop 'AG' use case was never something we needed to implement. If you > want to fix oFono to do that, great. If you want to write your own daemon > to do this, also great. > > > probably only by some power users. Also there is no support for mSBC in > > pusleaudio. > > Why is oFono at fault for this? Genuine question. What are the roadblocks > to mSBC support? Because does not provide needed API. > > > > So, no, really it is not used. > > > > > > Main objection for handsfree-audio-api.txt is that it does not provide > > > > information about locally used codec and somehow mixes air codec and > > > > local codec. In my hsphfpd.txt I used term "AgentCodec" for bluetooth > > > > local codec and term "AirCodec" for bluetooth air codec format. > > > > > > Okay. But, just FYI, at the time there was no hw that could do such > > > on-the-fly conversions, so this use case wasn't considered/implemented. > > > > This cannot be truth as probably every bluetooth HW is doing on-the-fly > > conversion between CVSD and PCM. I was not able to find HW which allows > > me to send raw CVSD samples... > > At the time this was all done in software. CVSD was never done in software. Always in hardware. As said, even now I was not able to find bluetooth HW which would allow to do CVSD in software. > Alternatively, the hardware was > directly wired between the sound card / modem and the bluetooth chip. So > just opening the SCO socket was enough. > > > > True. In retrospect we probably should have used strings. But it was > > > assumed that vendor extensions would go via the Bluetooth SIG Assigned > > > Numbers facility. Anyhow, we can always add a 'Register2' method that could > > > take codecs as a string array or a combination of strings & ints. And if > > > Register2 was used, then use 'NewConnection2' with a signature that supports > > > passing in vendor codecs and whatever else that might be needed. > > > > This is still not enough. Audio application (e.g. pulseaudio) need to > > register AgentCodec, not AirCodec. And current API is somehow mixed. > > Audio application needs to know what is the format which bluetooth chip > > sends to userspace (PCM? mSBC? CVSD? PCMA? AuriStream?) and which format > > bluetooth chip expects. I named this AgentCodec. > > So how do you negotiate the 'AgentCodec'? Does BlueZ expose this > information? If so, how? SCO socket option or ...? It is done by HCI commands, therefore by kernel. There is discussion for exporting userspace <--> kernel API to allow setting arbitrary configurations for codecs supported by bluetooth HW. Getting list of supported codecs can be done by this script: https://github.com/pali/hsphfpd-prototype/blob/prototype/sco_features.pl (needs to be run as root) > > > > And also API does not provide socket MTU information or ability to > > > > change/specify which codec would be used. > > > > > > There was no need, we automatically defaulted to using Wide band if > > > available. Third party codecs are a new use case (for oFono HFP), so would > > > require an API extension. > > > > MTU is needed also for mSBC codec if encoding is done in software > > (pulseaudio). Without it, this wide band support in ofono is unusable > > for pulseaudio. > > Isn't the MTU obtained from the SCO socket itself? How is oFono at fault > here? Yes, via some ioctl it can be done. But bluez for other bluetooth profiles provides this information via dbus API. As bluez does not support HSP/HFP it expects that software which implement it, provide needed info. > > > > And also API extension for choosing codec. Also for choosing if software > > of hardware encoding would be used. We know that there are lot of broken > > devices in different way and it is really needed for either blacklist > > some codec or switch between hw and sw encoding if something strange > > happen. Without it pulseaudio is not going to support more codes then > > default required (CVSD). > > This seems to be a kernel / device driver / firmware issue and should be > solved at that level. Why??? It is up to the application which owns SLC socket and this application needs to provide API for it. Codecs are negotiated via AT commands, so again only HFP / HSP daemon can do it. > > > > > > > > > > Non-audio APIs which are needed to export (for both HSP and HFP profiles): > > > > > > > > * battery level (0% - 100%) > > > > * power source (external, battery, unknown) > > > > * ability to send "our laptop" battery level and power source to remote device > > > > * send text message to embedded display > > > > * process button press event (exported via linux kernel uinput) > > > > > > > > > > I think all of these are feasible to support under the current oFono > > > structure, either via plugins or API extensions. > > > > Ok. Are you going to implement them? > > I think that all of these are missing parts in ofono and something which > > is needed to be implemented for desktop/laptop HSP and HFP profile > > support. > > > > There are no plans to do this at the moment. So, why should I even consider to use ofono at all? It does not support none of above desktop feature, it does not support extended codecs, it does not support HSP profile and also it does not support HFP profile without physical modem (majority of desktops and laptops). Please, do not take me wrong but after 2.5 months long discussion I just see that ofono does not support needed parts, there are no plans for it and everything needed is already designed and implemented in my prototype hsphfpd daemon. -- Pali Rohár pali.rohar@gmail.com