mbox series

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

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

Message

Abhishek Pandit-Subedi March 20, 2020, 1:50 a.m. UTC
Hi Luiz and Marcel,

Please do not merge this until the accompanying kernel change is
accepted. I am sending this series to show how I plan on using the
changes to the Add Device management operation.

Pending questions I have for this series:
* Do I need to distinguish whether the kernel supports the updated Add
  Device structure? (It will probably reject it if the size isn't
  correct)
* Can we allow HID devices to default to Wake Allowed? I think its
  preferable to allow newly paired HID devices to wake the system from
  sleep without any additional changes.

--

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.

In order to set this flag, Bluez must call the Add Device management
operation with the DEVICE_FLAG_WAKEABLE flag mask and value set. This
call can be made multiple times with the same address (the kernel will
add the device the first time but only update the action or flags on
subsequent calls).

This change was tested with appropriate kernel changes on v4.19
(verified that HID devices were being marked as wake capable in the
kernel).

Thanks
Abhishek

Changes in v4:
* Newly added support in Add Device for flags
* 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 (5):
  mgmt: Update docs for Add Device
  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 ++
 doc/mgmt-api.txt        |  12 ++++
 lib/mgmt.h              |   3 +
 profiles/input/device.c |   1 +
 profiles/input/hog.c    |   1 +
 src/adapter.c           | 112 +++++++++++++----------------------
 src/adapter.h           |   1 +
 src/device.c            | 125 ++++++++++++++++++++++++++++++++++++++++
 src/device.h            |   8 +++
 10 files changed, 197 insertions(+), 72 deletions(-)