From 0836766bfbfcc099dc5999fc0c7bd59905d499bc Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Thu, 25 Jun 2020 09:55:27 -0400 Subject: [PATCH] receiver: fix k375s Fn inversion --- lib/logitech_receiver/settings.py | 2 +- lib/logitech_receiver/settings_templates.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/logitech_receiver/settings.py b/lib/logitech_receiver/settings.py index f1c96828..928b4fe0 100644 --- a/lib/logitech_receiver/settings.py +++ b/lib/logitech_receiver/settings.py @@ -508,7 +508,7 @@ class BooleanValidator(object): tv = _bytes2int(true_value) fv = _bytes2int(false_value) mv = _bytes2int(mask) - assert tv & fv == 0 + assert tv != fv # true and false might be something other than bit values assert tv & mv == tv assert fv & mv == fv self.needs_current_value = any(m != b'\xFF' for m in mask) diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py index bbed44ec..590967d3 100644 --- a/lib/logitech_receiver/settings_templates.py +++ b/lib/logitech_receiver/settings_templates.py @@ -243,14 +243,19 @@ def _feature_fn_swap(): label=_FN_SWAP[1], description=_FN_SWAP[2], device_kind=(_DK.keyboard,)) +# this might not be correct for this feature def _feature_new_fn_swap(): return feature_toggle(_FN_SWAP[0], _F.NEW_FN_INVERSION, label=_FN_SWAP[1], description=_FN_SWAP[2], device_kind=(_DK.keyboard,)) + +# ignore the capabilities part of the feature - all devices should be able to swap Fn state +# just use the current host (first byte = 0xFF) part of the feature to read and set the Fn state def _feature_k375s_fn_swap(): return feature_toggle(_FN_SWAP[0], _F.K375S_FN_INVERSION, label=_FN_SWAP[1], description=_FN_SWAP[2], + true_value=b'\xFF\x01', false_value=b'\xFF\x00', device_kind=(_DK.keyboard,)) # FIXME: This will enable all supported backlight settings, we should allow the users to select which settings they want to enable.