From 410d100dc619fa3a5d14dda68e23c9c8d8a91f15 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 24 Mar 2017 06:16:37 -0300 Subject: [PATCH] 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 --- lib/logitech_receiver/notifications.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/logitech_receiver/notifications.py b/lib/logitech_receiver/notifications.py index 3367d4d9..376e7567 100644 --- a/lib/logitech_receiver/notifications.py +++ b/lib/logitech_receiver/notifications.py @@ -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)