From 4dfa55c96cd715b7a56f1973b597fa2295ba55db Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Wed, 15 Jul 2020 07:56:07 -0400 Subject: [PATCH] receiver: add mode and inversion settings for feature THUMB_WHEEL --- docs/features.md | 2 +- lib/logitech_receiver/settings_templates.py | 40 ++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/docs/features.md b/docs/features.md index 74590631..1c55279b 100644 --- a/docs/features.md +++ b/docs/features.md @@ -59,7 +59,7 @@ Feature | ID | Status | Notes `HI_RES_SCROLLING` | `0x2120` | :heavy_check_mark: | `get_hi_res_scrolling_info`, `_feature_hi_res_scroll` `HIRES_WHEEL` | `0x2121` | :heavy_check_mark: | `get_hires_wheel`, `_feature_hires_smooth_invert`, `_feature_hires_smooth_resolution` `LOWRES_WHEEL` | `0x2130` | :heavy_check_mark: | `get_lowres_wheel_status`, `_feature_lowres_smooth_scroll` -`THUMB_WHEEL` | `0x2150` | :x: | +`THUMB_WHEEL` | `0x2150` | :heavy_check_mark: | `_feature_thumb_mode`, `_feature_thumb_invert` `MOUSE_POINTER` | `0x2200` | :heavy_check_mark: | `get_mouse_pointer_info`, read only `ADJUSTABLE_DPI` | `0x2201` | :heavy_check_mark: | `_feature_adjustable_dpi` `POINTER_SPEED` | `0x2205` | :heavy_check_mark: | `get_pointer_speed_info`, `_feature_pointer_speed` diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py index 5de8588a..8f7d50ce 100644 --- a/lib/logitech_receiver/settings_templates.py +++ b/lib/logitech_receiver/settings_templates.py @@ -227,7 +227,8 @@ _LOW_RES_SCROLL = ( _('HID++ mode for vertical scroll with the wheel.') + '\n' + _('Effectively turns off wheel scrolling in Linux.') ) _HIRES_INV = ( - 'hires-smooth-invert', _('High Resolution Wheel Invert'), _('High-sensitivity wheel invert mode for vertical scroll.') + 'hires-smooth-invert', _('High Resolution Wheel Invert'), + _('High-sensitivity wheel invert direction for vertical scroll.') ) _HIRES_RES = ('hires-smooth-resolution', _('Wheel Resolution'), _('High-sensitivity mode for vertical scroll with the wheel.')) _FN_SWAP = ( @@ -259,6 +260,11 @@ _REPROGRAMMABLE_KEYS = ( _DISABLE_KEYS = ('disable-keyboard-keys', _('Disable keys'), _('Disable specific keyboard keys.')) _PLATFORM = ('multiplatform', _('Set OS'), _('Change keys to match OS.')) _CHANGE_HOST = ('change-host', _('Change Host'), _('Switch connection to a different host')) +_THUMB_SCROLL_MODE = ( + 'thumb-scroll-mode', _('HID++ Thumb Scrolling'), + _('HID++ mode for horizontal scroll with the thumb wheel.') + '\n' + _('Effectively turns off thumb scrolling in Linux.') +) +_THUMB_SCROLL_INVERT = ('thumb-scroll-invert', _('Thumb Scroll Invert'), _('Invert thumb scroll direction.')) # # Keyword arguments for setting template functions: @@ -684,6 +690,36 @@ def _feature_change_host(): ) +def _feature_thumb_mode(): + return feature_toggle( + _THUMB_SCROLL_MODE[0], + _F.THUMB_WHEEL, + read_fnid=0x10, + write_fnid=0x20, + true_value=b'\x01\x00', + false_value=b'\x00\x00', + mask=b'\x01\x00', + label=_THUMB_SCROLL_MODE[1], + description=_THUMB_SCROLL_MODE[2], + device_kind=(_DK.mouse, _DK.trackball) + ) + + +def _feature_thumb_invert(): + return feature_toggle( + _THUMB_SCROLL_INVERT[0], + _F.THUMB_WHEEL, + read_fnid=0x10, + write_fnid=0x20, + true_value=b'\x00\x01', + false_value=b'\x00\x00', + mask=b'\x00\x01', + label=_THUMB_SCROLL_INVERT[1], + description=_THUMB_SCROLL_INVERT[2], + device_kind=(_DK.mouse, _DK.trackball) + ) + + # # # @@ -713,6 +749,8 @@ _SETTINGS_TABLE = [ _S(_PLATFORM[0], _F.MULTIPLATFORM, _feature_multiplatform), _S(_PLATFORM[0], _F.DUALPLATFORM, _feature_dualplatform, identifier='dualplatform'), _S(_CHANGE_HOST[0], _F.CHANGE_HOST, _feature_change_host), + _S(_THUMB_SCROLL_MODE[0], _F.THUMB_WHEEL, _feature_thumb_mode), + _S(_THUMB_SCROLL_INVERT[0], _F.THUMB_WHEEL, _feature_thumb_invert), ] _SETTINGS_LIST = namedtuple('_SETTINGS_LIST', [s[4] for s in _SETTINGS_TABLE])