Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3474559pxu; Sun, 11 Oct 2020 11:00:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUTuRoENCDdydwbRgIkCb9RZ7u03MeAV12ybL3xQAn1tPZVZ+bp5DmBwFHmf4b0j74g/kA X-Received: by 2002:a05:6402:396:: with SMTP id o22mr10129327edv.361.1602439213483; Sun, 11 Oct 2020 11:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602439213; cv=none; d=google.com; s=arc-20160816; b=CVprW+udvHIMVogn3IzDAiVKl+233fNkFY8l6Ppb7DYMCm+Zx2xa3XmU4H9RVq0z0a MJvfNn/R8I8N+mjtenWXsvBIyk7G6VMkYdlZPtURIiszAWIPGbmpVMZHDIwabba1Vwws VVnoQjd7V2UKm/HxQxaltHnl54o490dKuDSRT+YlfsHdLdLsPEJTqZG5aGaB34ROhzIc 4ukWKK74fnnXazJquchmbyYVdKnuJi+EqoR5rRGkc8NqaVK0G/yt6dSmIe9/pI2mSyf+ bi38mLdSfP5PyRoKgioVaIw1/tjieoxMLgtD0aELyL3QuxaT2BDnoa8AeQooCrJmFHZ8 /M2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :mime-version:user-agent:date:message-id:subject:from:to :dkim-signature; bh=eZG5SK7sZHA0lKrpILD/eRTz7bH38IZ6QkwBvzzfKas=; b=cI/dOo8wfiwZz2KLC36PIVCZRR4wVBAaTGNMfgT/eXwtz2kmeU1VsCc3YPJl9lLgvx EA7Z/1aEFnjL8xkvS16ZLfJpK5xLMhQwwczm8uRKV2SFh6NgoVLranj9RKwqNWMqYDN+ 5HOFzB5Utqn1VlHfmEFvvQVbiPnbURqASE2cvUgD9CrdWWFnoPD3i9pPbQlZGbB75tJT 3HgDdZnH2xhy44b/92eh7ESVly/ALxRT7XU6k2v3XVOJpoDZVOoXtamIjwbEQrGg0m4W idaQie1e4DK3NvpPgqe6krn9231uX4Dt+x7sJIflaVKnXkQJ6tYzo7bkjH4Y+jNbLTJ2 kv9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tcd-ie.20150623.gappssmtp.com header.s=20150623 header.b=2SyXl+bP; 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 y7si10852687ejq.455.2020.10.11.10.59.48; Sun, 11 Oct 2020 11:00:13 -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=2SyXl+bP; 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 S1726134AbgJKFAl (ORCPT + 99 others); Sun, 11 Oct 2020 01:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725882AbgJKFAl (ORCPT ); Sun, 11 Oct 2020 01:00:41 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8205BC0613CE for ; Sat, 10 Oct 2020 22:00:40 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id r10so10862431pgb.10 for ; Sat, 10 Oct 2020 22:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=eZG5SK7sZHA0lKrpILD/eRTz7bH38IZ6QkwBvzzfKas=; b=2SyXl+bPWdcKTyuwrPRURxD2uUuMcwdFNXEMn2loQguHsdLwf3tzgg0zGUgdI7RrmH Bzlzyp2RswrhyTnUzOHI3f4XuqbbZ/rR26AedS46ebt7NWobCmh9KLYXunHrgIX2oRt6 6S55fvbsDcQhxc+Y63Im4PYdEEhTLiVc8XsjsRlM6sORjpNErDgIEkDCwpnRryq5sj6+ tdGVl3BUDThCObs+Ss09mkIaAMYj6up/L1HsAYyrEjeE8WblWj9tPCdiVlPDjCCk88GY so2c0YwE25VwEaMkG3I8GnT6D7Xf6liqVYliGwY1B08D4vEqhjnemKVywVfGoYvuLGYH 9bYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=eZG5SK7sZHA0lKrpILD/eRTz7bH38IZ6QkwBvzzfKas=; b=mUGXxUxclAdWdKA6HaYKGzpBL3wuH+VoCzryHbgr8rq/JmfyyiebhgLproHmk1BxzF Elv1aMFNvb2RMth3/BIBG6rR9KJuKVYIfc13NL3rBBbsixsq0anJdv8B47FELZdhgXUK EJScSHw4Q+npP3PdrClXR6PxoH3on18rKjx06gRzL8FvnrmASM6Rai0tk4lSh4NrHT4u OLRqVlSawDnaBZmHJgsagWBttCub1SgUXwjFxvlOXRwD1oAlojW3H4Rmh9x+BOewBpfo 7tjiTMJLZ15i1Um+QBvluSS1zAQHC8DR0CEisJeX37l2SBYBiLBP/OgyB5XRGLyyCoyH eR6Q== X-Gm-Message-State: AOAM5316IYBwSL0P5eZyM3/MN6wkLSoWn2iUxYqq/UTswp2ZxRnbZG9m iGijG132Cw0zd3z79Jhx8BX5khBybkDyYvgI X-Received: by 2002:a62:e112:0:b029:152:b36e:b05d with SMTP id q18-20020a62e1120000b0290152b36eb05dmr18416630pfh.3.1602392439630; Sat, 10 Oct 2020 22:00:39 -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 x4sm15348527pfm.86.2020.10.10.22.00.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 10 Oct 2020 22:00:38 -0700 (PDT) To: linux-bluetooth@vger.kernel.org From: Peter Mullen Subject: Bose QC 35 Battery/ANC Support Message-ID: <333e38b3-da26-e3c6-76fb-1ee1caf90299@tcd.ie> Date: Sat, 10 Oct 2020 22:00:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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. 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. 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. 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. Let me know if there are any thoughts on this; I can get the patch ready and submitted if desired. Kind regards, Peter