mbox series

[BlueZ,v5,0/6] device: Allow devices to be marked as wake capable

Message ID 20200622234051.206800-1-abhishekpandit@chromium.org (mailing list archive)
Headers show
Series device: Allow devices to be marked as wake capable | expand

Message

Abhishek Pandit-Subedi June 22, 2020, 11:40 p.m. UTC
Hi Luiz,

This change accompanies a change in the kernel to allow marking devices
as wakeable so they can wake the system from suspend. Currently, only
HID devices support this and will be configured to allow this setting to
be changed via the WakeAllowed property.

Accompanying kernel change: https://patchwork.kernel.org/patch/11609999/

In order to set this flag, Bluez must call Set Device Flags with the
Remote Wakeup bit set. This change was tested with the accompanying
kernel changes on v5.4 with both manual tests and automated tests.

Here's the tests that I ran manually:
  - Pair new HID device and confirm it has Wake Allowed to True
  (default). Verify device can be woken from suspend with device.
  - Restart bluetoothd, confirm Device Flags Changed event after Add
  Device has no Remote Wakeup flag and Set Device Flags is called
  afterwards to restore it. Verify wake from suspend still works.
  - Disable Wake allowed via dbus and confirm wake from suspend no
  longer works.
  - Restart bluetoothd and confirm Wake Allowed is still false. Verify
  wake from suspend does not work.

Thanks
Abhishek

Changes in v5:
- Use device_flags mgmt op
* Decode device flags
* Refactor to use set_wake_flags and respond to device flags changed
* Add wake_override so we can keep track of user/profile configuration
  vs what is currently active
* Only call device_set_wake_support

Changes in v4:
* Renamed wake_capable to wake_allowed
* Removed set_wake_capable mgmt op and updated add_device to accept
  flags to set whether a device is wakeable
* Refactored adapter_whitelist_add and adapter_auto_connect_add to call
  adapter_add_device
* Renamed WakeCapable to WakeAllowed
* Renamed WakeCapable to WakeAllowed
* Renamed device_set_profile_wake_support to just
device_set_wake_support

Changes in v3:
* Added profile_wake_support and made wake_capable dependent on it
* Added documentation for WakeCapable
* Mark HID device to support wake from suspend

Changes in v2:
* Added dbus api "WakeCapable" to set value
* Update device_set_wake_capable to be called by
  adapter_set_wake_capable_complete so we can emit property changed
* Newly added to show whether device is wake capable
* Removed automatically setting wake capable for HID devices

Abhishek Pandit-Subedi (6):
  mgmt: Add mgmt op and events for device flags
  monitor: Decode device flags mgmt ops and event
  device: Support marking a device with wake allowed
  client: Display wake allowed property with info
  doc/device-api: Add WakeAllowed
  input: Make HID devices support wake

 client/main.c           |   1 +
 doc/device-api.txt      |   5 ++
 lib/mgmt.h              |  33 +++++++
 monitor/packet.c        |  68 +++++++++++++++
 profiles/input/device.c |   1 +
 profiles/input/hog.c    |   1 +
 src/adapter.c           |  98 +++++++++++++++++++++
 src/adapter.h           |   3 +-
 src/device.c            | 184 ++++++++++++++++++++++++++++++++++++++++
 src/device.h            |   9 ++
 10 files changed, 402 insertions(+), 1 deletion(-)