From b6bc35ed3e05f610a6fb5882857d9732893a247b Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Fri, 19 Jul 2013 11:49:30 +0200 Subject: [PATCH] K800: added support for hand detection --- lib/logitech_receiver/descriptors.py | 1 + lib/logitech_receiver/settings_templates.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/logitech_receiver/descriptors.py b/lib/logitech_receiver/descriptors.py index ea13ad79..88392f1f 100644 --- a/lib/logitech_receiver/descriptors.py +++ b/lib/logitech_receiver/descriptors.py @@ -175,6 +175,7 @@ _D('Wireless Illuminated Keyboard K800', protocol=1.0, wpid='2010', registers=(_R.battery_status, _R.three_leds, ), settings=[ _RS.fn_swap(), + _RS.hand_detection(), ], ) diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py index 22195bfd..0769dded 100644 --- a/lib/logitech_receiver/settings_templates.py +++ b/lib/logitech_receiver/settings_templates.py @@ -86,11 +86,19 @@ _FN_SWAP = ('fn-swap', _("Swap Fx function"), + '\n\n' + _("When unset, the F1..F12 keys will activate their standard function,\n" "and you must hold the FN key to activate their special function.")) +_HAND_DETECTION = ('hand-detection', _("Hand Detection"), + _("Turn on illumination when the hands hover over the keyboard.")) # # # +def _register_hand_detection(register=_R.keyboard_hand_detection, + true_value=b'\x00\x00\x00', false_value=b'\x00\x00\x30', mask=b'\x00\x00\xFF'): + return register_toggle(_HAND_DETECTION[0], register, true_value=true_value, false_value=false_value, + label=_HAND_DETECTION[1], description=_HAND_DETECTION[2], + device_kind=_DK.keyboard) + def _register_fn_swap(register=_R.keyboard_fn_swap, true_value=b'\x00\x01', mask=b'\x00\x01'): return register_toggle(_FN_SWAP[0], register, true_value=true_value, mask=mask, label=_FN_SWAP[1], description=_FN_SWAP[2], @@ -138,7 +146,7 @@ RegisterSettings = _SETTINGS_LIST( smooth_scroll=_register_smooth_scroll, side_scroll=_register_side_scroll, dpi=_register_dpi, - hand_detection=None, + hand_detection=_register_hand_detection, typing_illumination=None, ) FeatureSettings = _SETTINGS_LIST(