Re: [Bluez PATCH v1] adapter: check wake_override when setting device privacy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Aug 21, 2023 at 10:28 AM Zhengping Jiang <jiangzp@xxxxxxxxxx> wrote:
>
> For the device using a RPA, hog_probe sets wake_override to true, but
> the command to set remote wakeup fails because the device has not been
> added to the kernel and the connection with the public address cannot be
> found.

This is actually not true, hog_probe does call
device_set_wake_support, also note that I had a fix on how we handle
RPA with remote wakeup because that depends on LL Privacy/RPA
Resolution:

commit 7a4b67f9caa6bdc004c910f3a52108744a8cab74
Author: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
Date:   Thu May 12 16:40:49 2022 -0700

    device: Fix enabling wake support without RPA Resolution

    If device uses RPA it shall only enable wakeup if RPA Resolution has
    been enabled otherwise it cannot be programmed in the acceptlist which
    can cause suspend to fail.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=215768


> When setting the device privacy flag, the wakeup flag should be set
> according to the wake_override, instead of the current flags.

Afaik wake_override is only set by the user via WakeAllowed, plugins
shall not be using it directly, so it really sounds like this doesn't
apply to current upstream.

> Signed-off-by: Zhengping Jiang <jiangzp@xxxxxxxxxx>
> ---
>
> Changes in v1:
> - Add function to fetch wake_override value
> - Set the remote wakeup bit if privacy mode is used when setting flags
>
>  src/adapter.c | 2 ++
>  src/device.c  | 5 +++++
>  src/device.h  | 1 +
>  3 files changed, 8 insertions(+)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index 004062e7c..f63018495 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -5520,6 +5520,8 @@ static void add_device_complete(uint8_t status, uint16_t length,
>         if (btd_opts.device_privacy) {
>                 uint32_t flags = btd_device_get_current_flags(dev);
>
> +               if (device_get_wake_override(dev))
> +                       flags |= DEVICE_FLAG_REMOTE_WAKEUP;

We shall only use override if wake_support is set.

>                 /* Set Device Privacy Mode has not set the flag yet. */
>                 if (!(flags & DEVICE_FLAG_DEVICE_PRIVACY)) {
>                         adapter_set_device_flags(adapter, dev, flags |
> diff --git a/src/device.c b/src/device.c
> index 9b58e0c4e..ae75f2fd1 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -1545,6 +1545,11 @@ void device_set_wake_override(struct btd_device *device, bool wake_override)
>         }
>  }
>
> +bool device_get_wake_override(struct btd_device *device)
> +{
> +       return device->wake_override;
> +}
> +
>  static void device_set_wake_allowed_complete(struct btd_device *device)
>  {
>         if (device->wake_id != -1U) {
> diff --git a/src/device.h b/src/device.h
> index 3252e14ef..79377a13a 100644
> --- a/src/device.h
> +++ b/src/device.h
> @@ -141,6 +141,7 @@ void device_set_wake_support(struct btd_device *device, bool wake_support);
>  void device_set_wake_override(struct btd_device *device, bool wake_override);
>  void device_set_wake_allowed(struct btd_device *device, bool wake_allowed,
>                              guint32 id);
> +bool device_get_wake_override(struct btd_device *device);
>  void device_set_refresh_discovery(struct btd_device *dev, bool refresh);
>
>  typedef void (*disconnect_watch) (struct btd_device *device, gboolean removal,
> --
> 2.42.0.rc1.204.g551eb34607-goog
>


-- 
Luiz Augusto von Dentz




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux