Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp326866pxu; Wed, 14 Oct 2020 02:20:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZLPAEFGf6AVnJEYl0wZsdWgzzmFCYw1ZlCkrn/LeBSWD62uMTk0ZMGbRo7iAQV9ROy78Z X-Received: by 2002:a17:906:4941:: with SMTP id f1mr4409846ejt.417.1602667217525; Wed, 14 Oct 2020 02:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602667217; cv=none; d=google.com; s=arc-20160816; b=bHGIV1KB4PQCeiwq2OhJUHAFL+xdSfL97LRw/ybX2kElv7sn9Gc/Dah8Mr+DK7MoiS k/jRDOLDXSe/c0ASXUfBU7L5CXB+HPEQmE3jzTn5jg8GJrhzyf3dR/wZsYPgOgFG2k48 5M+h9Vg2/mkj+YpX6mjKShTrdbkZbze7MpCsHFxXrfHC5bzD1dnvhUY55zgNFGA2UX+e oH8iJRwm5ijcOozPggCxoW5BhPHx2L8cYc9TEk9SYls76JH3NzYg9viIsGM6CzaGq7my Fo8rk3/xuvKKl8QB0fzaA+mrCLe1sCNDAJw3Bdy8ozy6qUiUeTBiRkBp0RoShaJMFRkt 6omw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=GTY8OrccYe4mCjbqHOc79Uh42jvP30CMBNpOq0WvvCI=; b=vcrbW6CQOZ1MVy5uI+m/GNeEWXiaggPKNHGYTeH16kVrT7sjdyRaSYsaw8r3mp8i1L Vq4Yd1N/yGR60TL5DbPnvGa5fg0arnwd49wwgQKhKYWD29eExwGAgQA3/guq6mGbYp1f 8xM5OmwKS9UlAZXsxgZd+LW+yLVYcvGX19UWUwUUtDRmI3GVcj2mbXMU3ohJqDMeFb0D sqwZYpoDBUiLVcuP1gb8YABWQF70uOE/MXOYU+6qqFkBc2VnfdVsuuiFpwaZsXIGdHqP wjnckLTzC0uAKKUDpo3L7nR1TEz+jWZCIzCOO/xqdpx/I8EjbqU6nAubzms8j2UWPrJo j8KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tcd-ie.20150623.gappssmtp.com header.s=20150623 header.b=yTUo3Wv7; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si1725127ejd.424.2020.10.14.02.19.41; Wed, 14 Oct 2020 02:20:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@tcd-ie.20150623.gappssmtp.com header.s=20150623 header.b=yTUo3Wv7; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729909AbgJNIol (ORCPT + 99 others); Wed, 14 Oct 2020 04:44:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729828AbgJNIoi (ORCPT ); Wed, 14 Oct 2020 04:44:38 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C45A9C041E7A for ; Tue, 13 Oct 2020 22:06:31 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id j8so915365pjy.5 for ; Tue, 13 Oct 2020 22:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=GTY8OrccYe4mCjbqHOc79Uh42jvP30CMBNpOq0WvvCI=; b=yTUo3Wv7u2Ean1S9AMl9lQKsNz4VYkW3yewlo8IPK+J9dM+UbhYj6apF3Nre0o9JSJ N9rWpioN6+XCBKv7xnHA7M0vQBXnlfaSuLYkCFjjWRU5HTGwaywOpoVp00KsXL51Sfjs odj2GsPWrxTskCFYDMh0pXjy2HUeyDmuuAIHl/jcvgq2yMe+yRe4F5SyDytjKPYueeWn PhKW481+q+g1twTRv2sHrJACMe2qGZ4Kij6nkIeXpwkospERw4iKxo1h1bPdxUgUbOjv olh6I2bqq01XuyJgWmDLmk/0IirPWrcvfX61r30kU3DYzEGzuwByAT0a089HgLV8mTdN NKWA== 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=GTY8OrccYe4mCjbqHOc79Uh42jvP30CMBNpOq0WvvCI=; b=ZZDGE+AJYxeeAix9Z7ceHXlM92FQvmiSL8MgGlKLVTN3Q4kW4samdAaGsTPn08BD2J uj96p7UGyzn5Ak0p0AYMgnuiBO+Cnmghgb/UxaOOAPOC0xWme75V5yD/Besf4exVIPE+ WRo1s4jtuxyb4j4n9E+57Y7gK2GHtxuzayNhmXyOtF6H28ybe8PTT94rMb2HEsoE/dps G52gUK72Rpl/Jl8xO8y3ENTqZQdYDwcAqSFYAthdYmqsbhKm0gctQMs3L89GLScEqvIl OkZnv2jwNo8UCgBmu38r3EFKfQGpsmihXAc/LbjTK99a5N6dNDoOKsehSVt4jrSIQ2Bb 3sTQ== X-Gm-Message-State: AOAM532mOIwNedKrn4LWIQlh5i4Jx7WRLWvK54e7Rj3MRZQWMct/9/BQ nHLQe/bSwZg2P+LudUChUpBPR6kyL8v68HX8 X-Received: by 2002:a17:902:465:b029:d0:89f1:9e2a with SMTP id 92-20020a1709020465b02900d089f19e2amr2738643ple.6.1602651991033; Tue, 13 Oct 2020 22:06:31 -0700 (PDT) Received: from [192.168.2.14] (216-19-182-159.dyn.novuscom.net. [216.19.182.159]) by smtp.gmail.com with ESMTPSA id n203sm1608504pfd.81.2020.10.13.22.06.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Oct 2020 22:06:30 -0700 (PDT) Subject: Re: Bose QC 35 Battery/ANC Support To: Luiz Augusto von Dentz Cc: "linux-bluetooth@vger.kernel.org" References: <333e38b3-da26-e3c6-76fb-1ee1caf90299@tcd.ie> From: Peter Mullen Message-ID: <6030b6bc-73f1-6fbd-e5c5-58e2ce4a5d26@tcd.ie> Date: Tue, 13 Oct 2020 22:06:29 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Luiz, On 2020-10-12 9:43 a.m., Luiz Augusto von Dentz wrote: > Hi Peter, > > On Sun, Oct 11, 2020 at 1:04 PM Peter Mullen wrote: >> >> Hi all, >> >> I've been working on a plugin that adds support for battery level >> reporting and Active Noise Cancelling (ANC) control for the Bose QC 35 >> headphones. The patch is nearly ready to go, but because of the >> non-standard way it's implemented I figured it might be necessary to get >> some preliminary feedback on it prior to submission (or to see if it's >> worth submitting). >> >> As a brief overview of device control, the QC35 has a set of additional >> controls operating over rfcomm channel 8 where messages are passed back >> and forth between devices. The messages consist of a 3-byte opcode, a >> 1-byte payload length, and N-bytes of payload. There's some more >> information on the specifics here: >> https://blog.davidventura.com.ar/reverse-engineering-the-bose-qc35-bluetooth-protocol.html >> >> As this is a non-standard "profile", there's no profile UUID assigned to >> it which makes adding a profile somewhat more complicated. My solution >> here was to add a profile under the iPod Accessory Protocol (iAP) >> profile UUID which the QC35 lists, and to then filter out devices in the >> profile probe callback based on manufacturer ID, device class, and >> product ID. This isn't ideal as the probe will be called for any device >> listing the iAP UUID, so suggestions for alternative approaches (if >> necessary) are appreciated. > > We could in possibly add pid/vid to btd_profile that way it can be > probed by pid/vid in addition to UUID, that way one can make a driver > that is specific to a vendor or a product. Had a go at that this evening as a proof-of-concept; so far it's working well, so this could be viable. I'll finish it off and test it out properly. >> For session state control, I've hooked into the AVDTP state-change >> callback. Again, possibly non-standard but this seemed to be the best >> way to trigger the initiatiation/tearing down of the rfcomm connection. > > I would recommend hooking to the btd_service state, like for example > the policy plugin is doing. I was able to get the plugin working based on the btd_service state cb, but had a couple of concerns with it, mainly because we'll be receiving events for all services on all devices, so the filtering of unused events adds a bit of overhead. I was also able to use the AVCTP state callback without issue, which may be better suited than the AVDTP one. >> For ANC integration, I've added a new dbus interface under >> "org.bluez.Anc1". The interface contains a read-only "Range" property, >> which indicates the number of discrete values the ANC can be set to, and >> a read-write property "Level" which gets/sets the level. This interface >> layout was chosen to be device agnostic, so that ANC support could >> potentially be added for more devices in future. > > I'd probably add Bose to the name of the interface if it is bose specific. While the plugin is Bose specific, I had tried to keep the interface itself generic so that integration with the DE or similar won't need any changes if ANC support is added for other devices later. -- Peter Mullen