Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3663990ybl; Fri, 20 Dec 2019 13:19:36 -0800 (PST) X-Google-Smtp-Source: APXvYqwahcYLcM4U9tXZx0kRcTqopmNa1hlaEamkjfTvsx59Z6jyKBnY1sp72Ztd60cqYYuVDWL6 X-Received: by 2002:a05:6830:14d3:: with SMTP id t19mr7619080otq.278.1576876776137; Fri, 20 Dec 2019 13:19:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576876776; cv=none; d=google.com; s=arc-20160816; b=InaoHEqkKePyBmT5aPU188+7HYoNprBkFSzKvJvHjr6ebojxKFVvRZN66/p7OC51gM zfbka89LshG5EZ+BEasqJ4tD/+CI4xWsFPf8uOwJ5SxAA0NWkQEnUA/yAyNdsgHUQJ/P 2T8xDdTzpmuTt69WNSy9Z493GPekwWrguqaJA3ZackbRM4oZ6ZSf30/Vbq6jqkquZ0rU DSoYd9WqIwdHRSYYawixfWN0NmzJdInj3zTGPCthdgInKHI9rsW8E00ZqpENYBzqNXMy kax818hjhP2OEQLyUjfy+kvaRITHRPcvDg8gpdV2E896XIifJ3/E5nKlEcB2yhkjFUhn Sf1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=SVBUsED3zN4uP3nGytson7MdXiYmAMCMZdmQi3lsBGs=; b=NYzsg4M+4hqH8YuiPYujI05ymFsYoGyv1Sv+ZTz8fJDMck29cmfZSIyZLaP8CAtyEd KeuukKQemYl2cSSd9ZowXv9usWr6D5I7vq7rIyof1CoFcpMOIEoQ+Y9GkbYQTKpIqOX/ GQq6+g3CRKmn/Z6jsP2xwEP9issO7OHQ86XNOda6OtfxEnDrv6n4zChwsLRTEE01mm7S duVqL7bPSBcEgkKTdIxZU4DxzsRHSc/pjRbncrCsTtQ0LsMyZLKueqCjcTyv0Bl82W10 zZntj+kbgqda+sBFrpfHIkVOjduMD2JG8XkJkX6ciTWyJNvO5XoFzphJxBIl71OG69dR p29g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GeeUC6hZ; 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 101si1348239otm.168.2019.12.20.13.19.07; Fri, 20 Dec 2019 13:19:36 -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=GeeUC6hZ; 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 S1727473AbfLTVTF (ORCPT + 99 others); Fri, 20 Dec 2019 16:19:05 -0500 Received: from mail-il1-f169.google.com ([209.85.166.169]:46641 "EHLO mail-il1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727402AbfLTVTF (ORCPT ); Fri, 20 Dec 2019 16:19:05 -0500 Received: by mail-il1-f169.google.com with SMTP id t17so9087908ilm.13 for ; Fri, 20 Dec 2019 13:19:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SVBUsED3zN4uP3nGytson7MdXiYmAMCMZdmQi3lsBGs=; b=GeeUC6hZylQDmw8ZdtLM6T/A+6xuGCj+UKRgeT20aq/51Dm8eR/ifUNUhf5x0HFQ5G +Lf3Abvgc/SVJ0Hh35+Oi2tTVCq6WrHKY1xlZwh9wBq2TI6zfsuAC0h+cLxjXN30Xbhf RDXjpQvbnfpHbGCCVkcRDldsLkWZvYsDbCwh1O92oFfnONB0zTzpG8b5Lbg/F0A0CoUW vbWvRu8XJbxTlgmqczdvJVFZ47kwew3A1Tk0AQvqJGYcmIPqqePHl6mGNKsdYWW/sFiF 3JfxPpyZzs+wmQctnQ+mXUhqMwWeL6wlHqeHNImBKN+BDGcJQWqSPAxVSIKKQSwBr/pw 1B2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SVBUsED3zN4uP3nGytson7MdXiYmAMCMZdmQi3lsBGs=; b=SWRZpzrMwHk7pbr9qmOppDVlhDEURW18kg5GR3NbVgjnC/uYpaxlqeGSLDN1uJXaPi h7X2C1ALr/BX4FfctWtrho5HfxVq6BOFrQYe9XgUX68h6YddzZlB9foaEBtpqOFbKsxm nd3c3L7h8TaAjZigqn4y764hDX4ONgB+hJm77GjjELkxfSbs4canfZMjdk51cWDrE+I2 FR5/5d6GeJz50crlI2gUNl8rmEEGwrbKs5u8Lks4xanVxeVY0rdVUHOOwDddbhApt7LG 84ztcuyES+WxFj6d0i0wd5aAmrhQxWtemKPCSS2/ubX81wnTpy6O8Q6jVNMqymcBNwM6 RGbg== X-Gm-Message-State: APjAAAXXlw48mH2FPQMSrY4+i+A7PgQ8ial2pGpytqjFyGZMMVCKyWLm LJZDxddC1y4ELeq07iwN+eM= X-Received: by 2002:a92:de46:: with SMTP id e6mr6110634ilr.122.1576876743911; Fri, 20 Dec 2019 13:19:03 -0800 (PST) Received: from new-host-2.home ([2605:a601:ad86:2901:f189:7fcc:ad5c:18d3]) by smtp.googlemail.com with ESMTPSA id u7sm1137576iob.16.2019.12.20.13.19.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 13:19:03 -0800 (PST) Subject: Re: [pulseaudio-discuss] Proposal for a new API and usage of Bluetooth HSP and HFP profiles on Linux To: =?UTF-8?Q?Pali_Roh=c3=a1r?= Cc: Luiz Augusto von Dentz , "linux-bluetooth@vger.kernel.org" , Tanu Kaskinen , General PulseAudio Discussion , ofono@ofono.org, devkit-devel@lists.freedesktop.org, Bastien Nocera , Georg Chini , Russell Treleaven , Arun Raghavan , Marcel Holtmann , Sebastian Reichel , Pavel Machek References: <20191216091521.reh2urr25husschv@pali> <3ca53c66-1df0-41bf-710e-dea709906234@gmail.com> <20191218172828.vfie4su2whts2fqh@pali> <20191218173632.aqdmdhutu3ruezck@pali> <06eb7e98-1357-afd1-40a5-2ccb139d8dec@gmail.com> <20191218213349.2ksew2wnhgu3peub@pali> <0cfbe253-417c-e7c0-553a-abf360a80c9f@gmail.com> <20191219095132.blj3oyyrlfowv5ik@pali> <90261b42-1048-370f-7680-acd9f7e754ed@gmail.com> <20191219153344.hxnoa3idqvgdwrp2@pali> From: Denis Kenzior Message-ID: <76f1cb25-b608-e4e9-6fd9-8da932c56a15@gmail.com> Date: Fri, 20 Dec 2019 15:19:01 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191219153344.hxnoa3idqvgdwrp2@pali> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Pali, >> There have been one or two implementations of AG role fully external to >> oFono. These implementations simply used the existing oFono APIs to drive >> the modem. > > bluez & pulseaudio developers told me that it would be a good idea to > avoid implementing a new AT parser for telephony stack. And rather use > ofono implementation for telephony part... In my opinion there's nothing scary about AT parsing. In fact that is the easiest part of this whole venture. If you don't want to roll your own parser, you can borrow one from the oFono project. We already solved this nicely in the form of the gatchat library. You could incorporate this into your project (if it is GPL compatible). Or you could wait until we port gatchat to ell which will be under LGPL license. > > But if I should use existing DBus API provided by ofono, it means that I > need to do parsing of all AT commands (including telephony) and > translate them to ofono DBus API. I think you will need to do this regardless. Otherwise I fail to see how you prevent one 'agent' from consuming AT commands it shouldn't be. This is a possibility you need to consider, whether it happens by accident or maliciously. > > I agree, this should work and there is not need to modify ofono. But it > means that in hsphfpd daemon I need to have full AT parser for all > telephony commands and it was something which bluez / pa developers > thought that should be avoided. Therefore I come up with idea that > telephony commands would be handled by external Telephony Agent, which > can be ofono. Understood. But I think the metric function was selected inappropriately in this case. My opinion is that you should have started with what the overall architecture should look like; you should not have based design decisions on which parts might be a little hard to implement. > >> You could do that. But as I said, we rejected such a design a >> long time ago due to complexity and other issues. > > Anyway, what is the problem with accepting modem socket in ofono via > DBus and starts talking with it like with any other modem which ofono > supports? Currently ofono already takes modem socket from bluez via DBus > API, so in same way hsphfpd can pass modem socket to ofono. Basically > ofono then can reuse same code which already uses for sockets from > bluez, just it do not have to parse and interpret audio related AT > commands (as these are handled by hsphpfd itself). > > What are exact issues? I do not see complexity at ofono part (as has > already everything implemented) and currently I do not see those "other" > issues. The issues are many. And really the question is not whether it 'could be' done, but whether it 'should be' done. Let me describe a couple examples: - In the case of HF role (1), oFono already provides all the necessary APIs. So put yourself in oFono's maintainer shoes. What would we gain by supporting almost the same but different mechanism? We would have to introduce a new hfp_hf plugin, one that is almost identical, but different to hfp_hf_bluez5 plugin. These two plugins would have coexistence issues, which would add more complexity. Then there's the impact on PulseAudio and other users. How do they know when to use the HandsfreeAudio API vs some external API? Supporting this new way buys us a lot of extra code / complexity with no value added. - The other example is more practical. HFP Service Level Connection (SLC) establishment is actually quite tricky. There are certain limitations on what can and cannot be done prior to SLC establishment, including how audio handling is done. Unfortunately, codec negotiation, indicator negotiation, and feature negotiation are part of the SLC. oFono already solves all of this and handles all of it nicely. We have passed all relevant certification testing. It is very unclear how you plan to handle this (or whether you realistically even can) in your architecture when the responsibilities are split between the various daemons. So again, oFono has nothing to gain here... > > You suggested to use phone simulator together with ofono and then > starts extending / patching phone simulator to supports all needed parts > which are in my hsphfpd design (battery status, button press, codec > selection)? > Not quite. I suggested you expand oFono's emulator implementation (for AG role) and its DBus APIs (for HF role) to support the new vendor specific features that you want. Forget about the phone simulator, it is really irrelevant for what you're trying to accomplish. > Also how to handle the main problem of phone simulator that it is too > much complicated to setup it on desktop? Looking at the steps... > > https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/#index5h2 > > ... that desktop user needs to run nontrivial commands in command like, > plus creating configuration file only just to connect bluetooth headset > is ridiculous and non-acceptable for desktop application. > > If this problem is not fixed, ofono and phone simulator are not usable > as "main" software implementation of HFP profile for usage of bluetooth > headsets on Linux. oFono was never advertised as solving the 'HFP AG without a modem' use case. This is something we never had as a requirement / objective. Phonesim is a development tool. So of course it isn't trivial to setup, it isn't meant to be used in production in the first place. The use of phonesim described in the PA wiki, while creative, is a giant hack ;) Basically it all boils down to the fact that nobody has stepped up all this time to solve a particular use case you care about. But blaming oFono for this is misguided. So, if you want to solve the HFP AG without a modem case I fully support your efforts. Perhaps this can even be solved in oFono itself (since it already does 90% of what you want) by making the modem requirement optional. What we could do for example is to create a dummy modem if an AG connection is requested and no other suitable modems are detected in the system. The resultant AG wouldn't have any call control capability, it could still be used for transferring audio data, battery, etc. If you want to pursue this, we can brainstorm further. Regards, -Denis