Add notification for high-resolution Wheel events

The event at address 0 is only produced while in HID++ mode.

The rachet event (address 0x10) happens on both HID and
HID++ modes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Mauro Carvalho Chehab 2017-03-24 06:16:37 -03:00
parent 7078750a3f
commit 410d100dc6
1 changed files with 18 additions and 0 deletions

View File

@ -275,4 +275,22 @@ def _process_feature_notification(device, status, n, feature):
_log.warn("%s: unknown TOUCH MOUSE %s", device, n)
return True
if feature == _F.HIRES_WHEEL:
if (n.address == 0x00):
if _log.isEnabledFor(_INFO):
flags, delta_v = _unpack('>bh', n.data[:3])
high_res = (flags & 0x10) != 0
periods = flags & 0x0f
_log.info("%s: WHEEL: res: %d periods: %d delta V:%-3d", device, high_res, periods, delta_v)
return True
elif (n.address == 0x10):
if _log.isEnabledFor(_INFO):
flags = ord(n.data[:1])
ratchet = flags & 0x01
_log.info("%s: WHEEL: ratchet: %d", device, ratchet)
return True
else:
_log.warn("%s: unknown WHEEL %s", device, n)
return True
_log.warn("%s: unrecognized %s for feature %s (index %02X)", device, n, feature, n.sub_id)