only enable certain notification flags on devices
Also added some documentation to the notification flags, where possible.
This commit is contained in:
parent
a5eeac6e5a
commit
317cf6d00f
|
@ -14,7 +14,8 @@ from .common import (strhex as _strhex,
|
||||||
from .hidpp20 import FIRMWARE_KIND
|
from .hidpp20 import FIRMWARE_KIND
|
||||||
|
|
||||||
#
|
#
|
||||||
# constants
|
# Constants - most of them as defined by the official Logitech HID++ 1.0
|
||||||
|
# documentation, some of them guessed.
|
||||||
#
|
#
|
||||||
|
|
||||||
DEVICE_KIND = _NamedInts(
|
DEVICE_KIND = _NamedInts(
|
||||||
|
@ -38,11 +39,20 @@ POWER_SWITCH_LOCATION = _NamedInts(
|
||||||
left_edge=0x0B,
|
left_edge=0x0B,
|
||||||
bottom_edge=0x0C)
|
bottom_edge=0x0C)
|
||||||
|
|
||||||
|
# Some flags are used both by devices and receivers, the Logitech documentation makes no difference
|
||||||
|
# - 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,
|
||||||
|
# but right now we don't know enough.
|
||||||
NOTIFICATION_FLAG = _NamedInts(
|
NOTIFICATION_FLAG = _NamedInts(
|
||||||
battery_status=0x100000,
|
battery_status=0x100000, # send battery charge notifications (0x07 or 0x0D)
|
||||||
# reserved_r1b4=0x001000, unknown
|
keyboard_sleep_raw=0x020000, # guess
|
||||||
wireless=0x000100,
|
keyboard_multimedia_raw=0x010000, # guess
|
||||||
software_present=0x000800)
|
# reserved_r1b4=0x001000, # unknown, seen on a unifying receiver
|
||||||
|
keyboard_backlight=0x000200, # guess
|
||||||
|
software_present=0x000800, # .. no idea
|
||||||
|
wireless=0x000100, # notify when the device wireless goes on/off-line
|
||||||
|
)
|
||||||
|
|
||||||
ERROR = _NamedInts(
|
ERROR = _NamedInts(
|
||||||
invalid_SubID__command=0x01,
|
invalid_SubID__command=0x01,
|
||||||
|
|
|
@ -171,7 +171,12 @@ class PairedDevice(object):
|
||||||
if not self.receiver or not self.receiver.handle:
|
if not self.receiver or not self.receiver.handle:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
set_flag_bits = _hidpp10.NOTIFICATION_FLAG.all_bits() if enable else 0
|
if enable:
|
||||||
|
set_flag_bits = ( _hidpp10.NOTIFICATION_FLAG.battery_status
|
||||||
|
+ _hidpp10.NOTIFICATION_FLAG.wireless
|
||||||
|
+ _hidpp10.NOTIFICATION_FLAG.software_present )
|
||||||
|
else:
|
||||||
|
set_flag_bits = 0
|
||||||
ok = _hidpp10.set_notification_flags(self, set_flag_bits)
|
ok = _hidpp10.set_notification_flags(self, set_flag_bits)
|
||||||
|
|
||||||
flag_bits = _hidpp10.get_notification_flags(self)
|
flag_bits = _hidpp10.get_notification_flags(self)
|
||||||
|
|
Loading…
Reference in New Issue