Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4113456pxu; Mon, 12 Oct 2020 09:47:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysMr177/Hw//OrVLc78/Nct0yVjSrF8GNMkoAk7XTStOwcoh/265xGGmEtZCO+n64tZLBT X-Received: by 2002:a05:6402:48d:: with SMTP id k13mr3566806edv.92.1602521258915; Mon, 12 Oct 2020 09:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602521258; cv=none; d=google.com; s=arc-20160816; b=C6VejBgjYz2Fn2iBc9MTtisBN3c3PhqCsq2UJB0BIYoit0xqAoC0yML22kupbNEYmC vEMZO9oa6bnS4FUMNGHZ9DO9bVVAh0sOaSPFQRlbu5DqusvpVOWXCeXCBCpPQMLnWGUe uEmhFI/ANTGkOspOia8YNDByHNg+gZjCpTOfO8GPxU/jM9ULqTath/QNm2oWqXO/RKiw BA0O8d/mWYuz+MUlulKsPdmY7xxCQ58vgmbTdVeheZww/00BDujQ7sIkSLQopJ6uqV7V Us0Av6x2JkTgudrFiXlKdIsI0PRQsdIcycXQj3ysZsovDcHhRLj5FFwmrDtmDPGvIuKf bTvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4e3SwxtTLY4AeHrQDDsd9T2Vljvm1WRjaXtyZUqDfG8=; b=fKuPwKk6sOBJrd43k4W7vW2nl6BSxZZelyfl34SXLn7FLt7tw+X9Sijd45LZcvRA0r 2fGXoeAEF0OC3sqrenO3OuWbJHhRSGcVnd35CVsz7isFOVaT9ujLCHUl3W15ZL5hRePr 6es+w1HjbiLlaIr6bRhWOcZJNigHy/eyvl+M/a4SmX2XpiRzuZcyXiT180yYegGnPIOd P5tyHMkcLgEDb+lUd32XSyFRI5b2dL6Ywhojt2Cc0dGPRBU8mk3xoCy5Xl9YiE64UB4l C1eiikSfJZKK6hbbxU2RWRJMr83a6P0TjOIuHInw9x7mm14V3j4j2EZ4iZNjKCneg+XT XANw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lRmd2yQK; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si12755051edq.501.2020.10.12.09.47.00; Mon, 12 Oct 2020 09:47:38 -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=@gmail.com header.s=20161025 header.b=lRmd2yQK; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403963AbgJLQny (ORCPT + 99 others); Mon, 12 Oct 2020 12:43:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403962AbgJLQny (ORCPT ); Mon, 12 Oct 2020 12:43:54 -0400 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45E91C0613D0 for ; Mon, 12 Oct 2020 09:43:54 -0700 (PDT) Received: by mail-ot1-x32a.google.com with SMTP id m22so4988435ots.4 for ; Mon, 12 Oct 2020 09:43:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4e3SwxtTLY4AeHrQDDsd9T2Vljvm1WRjaXtyZUqDfG8=; b=lRmd2yQKA3ljEZ6nyTI/m1BdMqka7UzUtXf2hCJXVyznpYtq3asKzblR9VXsL7jy94 RtUTvU53Bxlp/jsQgrCHXOfj7876syOSf+wXhjUlW3XatJdSZ3jb6cG/dBT5H5GVjL49 9daeQFbc4Csnlu4zF+MrqpTIwY5Zlpn2vQ0AOLXjvvrst84UydKyCqTV/QB8XNA0rMAi qg0kGMihwIXeuqZkQB7WZ5O5OkDFE3ROBwZsfzQUK+xuCzHDTHcQQoja2SfuIE6W5LvM SInWx88/MPsFJpZQdFpgiylLU8SJD1ntkwgCvCCqV9xK/mLz/qycgJM/vcW0R023D82b F6LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4e3SwxtTLY4AeHrQDDsd9T2Vljvm1WRjaXtyZUqDfG8=; b=VRS1JZA1hF7v9q4GeOpArVdBwFdRPJas318QAWUk3nQmPwE6KL9K37Pw+vKDYUZBuf vazz/6gkVZFnrZorIOAnNUqPB1rieFr2hCWiM5WSlVgotIqvyl76bndo/jFNWX9Bhlqz a+rVdWmFeWav/nrkndEASb67WDfYOPYncwaHhqLorRRNSgZX2ZG/hqQUNjfulsD/hbe2 K6BDb5geDUad+3aMciUa8MrR+cNM4Mvsqavl5JnecMeVKf1Bx8CDZ7Fn7By2MiIyOaHc OpBT1kYKETpgQeAbuBzPDEbCEO/j+rHLzwGLDvaoCtQD3hdsoM5TkLFGrIwmS2bev6do watw== X-Gm-Message-State: AOAM530cYr1XwPaD0IWCEgGd9zVNlJYRhVPWDh3ksZbAwSoh7+qC3Xjz oJOk+SZ4QY7LQkqQIFGzT8EtY7VFYMEHH6ReK4c= X-Received: by 2002:a05:6830:134c:: with SMTP id r12mr17934119otq.240.1602521031938; Mon, 12 Oct 2020 09:43:51 -0700 (PDT) MIME-Version: 1.0 References: <333e38b3-da26-e3c6-76fb-1ee1caf90299@tcd.ie> In-Reply-To: <333e38b3-da26-e3c6-76fb-1ee1caf90299@tcd.ie> From: Luiz Augusto von Dentz Date: Mon, 12 Oct 2020 09:43:39 -0700 Message-ID: Subject: Re: Bose QC 35 Battery/ANC Support To: Peter Mullen Cc: "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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. > 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. > For battery level integration, I've basically just wrapped the dbus > interface from the standard GATT battery profile. This has been working > fine with my DE; the battery level shows immediately after connection > and updates as the level drops. We had some discussion on weather we should continue using a custom D-Bus interface or just emulate the battery reports over UHID given that is probably better integrated with the system. > 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. > Let me know if there are any thoughts on this; I can get the patch ready > and submitted if desired. > > Kind regards, > Peter > -- Luiz Augusto von Dentz