All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	ChromeOS Bluetooth Upstreaming 
	<chromeos-bluetooth-upstreaming@chromium.org>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>
Subject: Re: [Bluez PATCH v5 0/4] adapter: Reconnect audio when resuming from suspend
Date: Tue, 15 Sep 2020 11:05:04 -0700	[thread overview]
Message-ID: <CABBYNZLmyr5a_WoMwkmBsr2Y8LvnY1xiH724Y2BDOAe5zHFJjw@mail.gmail.com> (raw)
In-Reply-To: <20200915174146.1693687-1-abhishekpandit@chromium.org>

Hi Abhishek,

On Tue, Sep 15, 2020 at 10:41 AM Abhishek Pandit-Subedi
<abhishekpandit@chromium.org> wrote:
>
>
> Hi Luiz and Marcel,
>
> This is a quality of life improvement for the behavior of audio devices
> during system suspend. This depends on a kernel change that emits
> suspend/resume events:
>
> https://patchwork.kernel.org/project/bluetooth/list/?series=325771
>
> Right now, audio devices will be disconnected as part of suspend but
> won't be reconnected when the system resumes without user interaction.
> This is annoying to some users as it causes an interruption to their
> normal work flow.
>
> This change reconnects audio devices that were disconnected for suspend
> using the following logic:
>
>  * In the device disconnect callback, mark any devices with the A2DP
>    service uuid for reconnect. The reconnect will not be queued until
>    resume.
>  * In the controller resume callback, queue any policy items that are
>    marked to reconnect on resume for connection with the ResumeDelay
>    value (default = 2s).
>
> A reconnect is queued after the controller resumes and the delay
> between resume and reconnect is configurable via the ResumeDelay key in
> the Policy settings. The 2s delay was chosen arbitrarily and I think
> anywhere up to 10s is probably ok. A longer delay is better to account
> for spurious wakeups and Wi-Fi reconnection time (avoiding any co-ex
> issues) at the downside of reconnection speed.
>
> Here are the tests I have done with this:
> - Single suspend and verified the headphones reconnect
> - Suspend stress test for 25 iterations and verify both Wi-Fi and
>   Bluetooth audio reconnect on resume. (Ran with wake minimum time of
>   10s)
> - Suspend test with wake time = 1s to verify that BT reconnect isn't
>   attempted. Ran 5 iterations with low wake time and then let it stay
>   awake to confirm reconnect finally completed on last resume.
> - Suspend test with wake time between 1s - 4s. Ran with 5 iterations and
>   verified it connected several times in the middle and finally at the
>   end.
>
> I've tested this on a Pixelbook Go (AC-9260 controller) and HP
> Chromebook 14a (RTL8822CE controller) with GID6B headset.
>
> I've also tested this with the Pixel Buds 2. These earbuds actually
> reconnect automatically to the Chromebook (even without this policy
> change) and I verified that the new changes don't break the reconnection
> mechanism.
>
> Thanks
> Abhishek
>
>
> Changes in v5:
> - Remove use of !! in has_kernel_features

It seems I end up merging the old version by mistake, but I fixed this
one change myself and added btd_ prefix to it since that is required
to be exported for plugins that are not built-in.

> Changes in v4:
> - Set reconnect timer in disconnect if resume events aren't supported
> - Only set reconnect timer if adapter matches current notification
> - Refactor changes in src/adapter to its own commit
> - Refactor enabling A2DP_SINK_UUID into its own commit
>
> Changes in v3:
> - Refactored resume notification to use btd_adapter_driver
> - Renamed ReconnectAudioDelay to ResumeDelay and set default to 2
> - Added A2DP_SINK_UUID to default reconnect list
>
> Changes in v2:
> - Refactored to use policy instead of connecting directly in adapter
>
> Abhishek Pandit-Subedi (4):
>   adapter: Refactor kernel feature globals
>   adapter: Handle controller resume and notify drivers
>   policy: Enable reconnect for a2dp-sink in defaults
>   policy: Reconnect audio on controller resume
>
>  plugins/policy.c |  87 +++++++++++++++++++++++++++++++++-------
>  src/adapter.c    | 102 +++++++++++++++++++++++++++++++++--------------
>  src/adapter.h    |  11 +++++
>  src/main.c       |   1 +
>  src/main.conf    |  11 ++++-
>  5 files changed, 168 insertions(+), 44 deletions(-)
>
> --
> 2.28.0.618.gf4bc123cb7-goog
>


-- 
Luiz Augusto von Dentz

  parent reply	other threads:[~2020-09-15 18:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 17:41 [Bluez PATCH v5 0/4] adapter: Reconnect audio when resuming from suspend Abhishek Pandit-Subedi
2020-09-15 17:41 ` [Bluez PATCH v5 1/4] adapter: Refactor kernel feature globals Abhishek Pandit-Subedi
2020-09-15 17:41 ` [Bluez PATCH v5 2/4] adapter: Handle controller resume and notify drivers Abhishek Pandit-Subedi
2020-09-15 17:41 ` [Bluez PATCH v5 3/4] policy: Enable reconnect for a2dp-sink in defaults Abhishek Pandit-Subedi
2020-09-15 17:41 ` [Bluez PATCH v5 4/4] policy: Reconnect audio on controller resume Abhishek Pandit-Subedi
2020-09-15 18:05 ` Luiz Augusto von Dentz [this message]
2020-09-15 18:13   ` [Bluez PATCH v5 0/4] adapter: Reconnect audio when resuming from suspend Abhishek Pandit-Subedi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABBYNZLmyr5a_WoMwkmBsr2Y8LvnY1xiH724Y2BDOAe5zHFJjw@mail.gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=abhishekpandit@chromium.org \
    --cc=chromeos-bluetooth-upstreaming@chromium.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.