receiver: add direct implementation of NEW FN INVERSION feature

receiver: fix bug in NEW FN INVERSION

receiver: fix bug in NEW FN INVERSION

receiver: fix bug in NEW FN INVERSION
This commit is contained in:
Peter F. Patel-Schneider 2020-06-29 10:15:50 -04:00
parent 070a2bf837
commit cab523e122
3 changed files with 22 additions and 10 deletions

View File

@ -67,7 +67,7 @@ Feature | ID | Status | Notes
`SURFACE_TUNING` | `0x2240` | :x: |
`HYBRID_TRACKING` | `0x2400` | :x: |
`FN_INVERSION` | `0x40A0` | :heavy_check_mark: | `_feature_fn_swap`
`NEW_FN_INVERSION` | `0x40A2` | :heavy_check_mark: | `_feature_new_fn_swap`
`NEW_FN_INVERSION` | `0x40A2` | :heavy_check_mark: | `get_new_fn_inversion`, `_feature_new_fn_swap`
`K375S_FN_INVERSION` | `0x40A3` | :heavy_check_mark: | `_feature_k375s_fn_swap`
`ENCRYPTION` | `0x4100` | :x: |
`LOCK_KEY_STATE` | `0x4220` | :x: |

View File

@ -653,3 +653,12 @@ def get_hires_wheel(device):
ratchet = (ratchet_mode & 0x01) != 0
return multi, has_invert, has_ratchet, inv, res, target, ratchet
def get_new_fn_inversion(device):
state = feature_request(device, FEATURE.NEW_FN_INVERSION, 0x00)
if state:
inverted, default_inverted = _unpack('!BB', state[:2])
inverted = (inverted & 0x01) != 0
default_inverted = (default_inverted & 0x01) != 0
return inverted, default_inverted

View File

@ -165,15 +165,18 @@ def _print_device(dev):
pointer_speed = _hidpp20.get_pointer_speed_info(dev)
if pointer_speed:
print(" Pointer Speed: %s" % pointer_speed)
# elif feature == _hidpp20.FEATURE.LOWRES_WHEEL:
# wheel_status = _hidpp20.get_lowres_wheel_status(dev)
# if wheel_status:
# print(" Wheel Reports: %s" % wheel_status)
else:
for setting in dev_settings:
if setting.feature == feature:
v = setting.read(False)
print(" %s: %s" % (setting.label, v) )
elif feature == _hidpp20.FEATURE.LOWRES_WHEEL:
wheel_status = _hidpp20.get_lowres_wheel_status(dev)
if wheel_status:
print(" Wheel Reports: %s" % wheel_status)
elif feature == _hidpp20.FEATURE.NEW_FN_INVERSION:
inverted, default_inverted = _hidpp20.get_new_fn_inversion(dev)
print(" Fn-swap:", "enabled" if inverted else "disabled")
print(" Fn-swap default:", "enabled" if default_inverted else "disabled")
for setting in dev_settings:
if setting.feature == feature:
v = setting.read(False)
print(" %s: %s" % (setting.label, v) )
if dev.online and dev.keys:
print (' Has %d reprogrammable keys:' % len(dev.keys))