From 152abb086ac0a7a25f1a34b99448da6d087be08b Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 19 May 2013 10:14:31 +0200 Subject: [PATCH 1/3] hid10: document notifications better See [registers.txt][1] for 'keyboard_backlight'. The behavior of keyboard_sleep_raw and keyboard_multimedia_raw is described at [keyboard.txt][2]. [1]: https://git.lekensteyn.nl/ltunify/tree/registers.txt [2]: https://git.lekensteyn.nl/ltunify/tree/keyboard.txt --- lib/logitech/unifying_receiver/hidpp10.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/logitech/unifying_receiver/hidpp10.py b/lib/logitech/unifying_receiver/hidpp10.py index 5ed6d959..7ce96889 100644 --- a/lib/logitech/unifying_receiver/hidpp10.py +++ b/lib/logitech/unifying_receiver/hidpp10.py @@ -46,10 +46,10 @@ POWER_SWITCH_LOCATION = _NamedInts( # but right now we don't know enough. NOTIFICATION_FLAG = _NamedInts( battery_status=0x100000, # send battery charge notifications (0x07 or 0x0D) - keyboard_sleep_raw=0x020000, # guess - keyboard_multimedia_raw=0x010000, # guess + keyboard_sleep_raw=0x020000, # system control keys such as Sleep + keyboard_multimedia_raw=0x010000, # consumer controls such as Mute and Calculator # reserved_r1b4=0x001000, # unknown, seen on a unifying receiver - keyboard_backlight=0x000200, # guess + keyboard_backlight=0x000200, # illumination brightness level changes (by pressing keys) software_present=0x000800, # .. no idea wireless=0x000100, # notify when the device wireless goes on/off-line ) From 29d0c0716473e5250fbf4faa97b563fe6b3e2412 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 19 May 2013 10:20:21 +0200 Subject: [PATCH 2/3] hid10: Formatting and re-order NOTIFICATION_FLAGs Align values for easier reading the numeric values of NOTIFICATION_FLAGs. To maintain consistency in the ordering of the values, swap keyboard_backlight with keyboard_present. --- lib/logitech/unifying_receiver/hidpp10.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/logitech/unifying_receiver/hidpp10.py b/lib/logitech/unifying_receiver/hidpp10.py index 7ce96889..927a75e5 100644 --- a/lib/logitech/unifying_receiver/hidpp10.py +++ b/lib/logitech/unifying_receiver/hidpp10.py @@ -45,13 +45,13 @@ POWER_SWITCH_LOCATION = _NamedInts( # In the future would be useful to have separate enums for receiver and device notification flags, # but right now we don't know enough. NOTIFICATION_FLAG = _NamedInts( - battery_status=0x100000, # send battery charge notifications (0x07 or 0x0D) - keyboard_sleep_raw=0x020000, # system control keys such as Sleep + battery_status= 0x100000, # send battery charge notifications (0x07 or 0x0D) + keyboard_sleep_raw= 0x020000, # system control keys such as Sleep keyboard_multimedia_raw=0x010000, # consumer controls such as Mute and Calculator - # reserved_r1b4=0x001000, # unknown, seen on a unifying receiver - keyboard_backlight=0x000200, # illumination brightness level changes (by pressing keys) - software_present=0x000800, # .. no idea - wireless=0x000100, # notify when the device wireless goes on/off-line + # reserved_r1b4= 0x001000, # unknown, seen on a unifying receiver + software_present= 0x000800, # .. no idea + keyboard_backlight= 0x000200, # illumination brightness level changes (by pressing keys) + wireless= 0x000100, # notify when the device wireless goes on/off-line ) ERROR = _NamedInts( From f0542923d79b844a0ffdcae0ca6aa9a0ee8ad1b7 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 19 May 2013 10:30:41 +0200 Subject: [PATCH 3/3] hid10: update flags description for notifications The Logitech HID++ 1.0 documentation actually names the fields for devices and receiver. Clarify that and explain why enabling all of the bits is a bad idea. --- lib/logitech/unifying_receiver/hidpp10.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/logitech/unifying_receiver/hidpp10.py b/lib/logitech/unifying_receiver/hidpp10.py index 927a75e5..1cc9842c 100644 --- a/lib/logitech/unifying_receiver/hidpp10.py +++ b/lib/logitech/unifying_receiver/hidpp10.py @@ -39,7 +39,14 @@ POWER_SWITCH_LOCATION = _NamedInts( left_edge=0x0B, bottom_edge=0x0C) -# Some flags are used both by devices and receivers, the Logitech documentation makes no difference +# Some flags are used both by devices and receivers. The Logitech documentation +# mentions that the first and last (third) byte are used for devices while the +# second is used for the receiver. In practise, the second byte is also used for +# some device-specific notifications (keyboard illumination level). Do not +# simply set all notification bits if the software does not support it. For +# example, enabling keyboard_sleep_raw makes the Sleep key a no-operation unless +# the software is updated to handle that event. +# Observations: # - wireless and software present were seen on receivers, reserved_r1b4 as well # - the rest work only on devices as far as we can tell right now # In the future would be useful to have separate enums for receiver and device notification flags,