Add support for CLI show to display High Res Wheel settings
Add support for the high resolution wheel found on MX Anywhere 2. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
684afa871e
commit
360c92f6b0
|
@ -477,3 +477,30 @@ def get_mouse_pointer_info(device):
|
|||
'suggest_os_ballistics': suggest_os_ballistics,
|
||||
'suggest_vertical_orientation': suggest_vertical_orientation
|
||||
}
|
||||
|
||||
def get_hires_wheel(device):
|
||||
caps = feature_request(device, FEATURE.HIRES_WHEEL, 0x00)
|
||||
mode = feature_request(device, FEATURE.HIRES_WHEEL, 0x10)
|
||||
ratchet = feature_request(device, FEATURE.HIRES_WHEEL, 0x030)
|
||||
|
||||
|
||||
if caps and mode and ratchet:
|
||||
# Parse caps
|
||||
multi, flags = _unpack('!BB', caps[:2])
|
||||
|
||||
has_invert = (flags & 0x08) != 0
|
||||
has_ratchet = (flags & 0x04) != 0
|
||||
|
||||
# Parse mode
|
||||
wheel_mode, reserved = _unpack('!BB', mode[:2])
|
||||
|
||||
target = (wheel_mode & 0x01) != 0
|
||||
res = (wheel_mode & 0x02) != 0
|
||||
inv = (wheel_mode & 0x04) != 0
|
||||
|
||||
# Parse Ratchet switch
|
||||
ratchet_mode, reserved = _unpack('!BB', ratchet[:2])
|
||||
|
||||
ratchet = (ratchet_mode & 0x01) != 0
|
||||
|
||||
return multi, has_invert, has_ratchet, inv, res, target, ratchet
|
||||
|
|
|
@ -93,6 +93,31 @@ def _print_device(dev):
|
|||
flags = 0 if flags is None else ord(flags[1:2])
|
||||
flags = _hidpp20.FEATURE_FLAG.flag_names(flags)
|
||||
print (' %2d: %-22s {%04X} %s' % (index, feature, feature, ', '.join(flags)))
|
||||
if feature == _hidpp20.FEATURE.HIRES_WHEEL:
|
||||
wheel = _hidpp20.get_hires_wheel(dev)
|
||||
if wheel:
|
||||
multi, has_invert, has_switch, inv, res, target, ratchet = wheel
|
||||
print(" Multiplier: %s" % multi)
|
||||
if has_invert:
|
||||
print(" Has invert")
|
||||
if inv:
|
||||
print(" Inverse wheel motion")
|
||||
else:
|
||||
print(" Normal wheel motion")
|
||||
if has_switch:
|
||||
print(" Has ratchet switch")
|
||||
if ratchet:
|
||||
print(" Normal wheel mode")
|
||||
else:
|
||||
print(" Free wheel mode")
|
||||
if res:
|
||||
print(" High resolution mode")
|
||||
else:
|
||||
print(" Low resolution mode")
|
||||
if target:
|
||||
print(" HID++ notification")
|
||||
else:
|
||||
print(" HID notification")
|
||||
|
||||
if dev.online and dev.keys:
|
||||
print (' Has %d reprogrammable keys:' % len(dev.keys))
|
||||
|
|
Loading…
Reference in New Issue