Repository: pwr-Solaar/Solaar

Issue:
After wake up mouse scroll is slow
**Information**
- Solaar version: solaar 1.0.4
- Distribution: Fedora 33
- Kernel version: `Linux 5.10.10-200.fc33.x86_64 x86_64 GNU/Linux` 
- Output of `solaar show`:
```
Unifying Receiver
  Device path  : /dev/hidraw1
  USB id       : 046d:C52B
  Serial       : B3679A77
    Firmware   : 24.07.B0030
    Bootloader : 02.09
    Other      : AA.AC
  Has 1 paired device(s) out of a maximum of 6.
  Notifications: wireless, software present (0x000900)
  Device activity counters: 1=34

  1: Wireless Mouse MX Master 2S
     Device path  : /dev/hidraw3
     WPID         : 4069
     Codename     : MX Master 2S
     Kind         : mouse
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: EF459E74
     Model ID:      B01940690000
     Unit ID:       22F74994
        Bootloader: BOT 56.01.B0006
          Firmware: MPM 12.01.B0006
          Firmware: MPM 12.01.B0006
             Other: 
     The power switch is located on the base.
     Supports 32 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
            Firmware: Bootloader BOT 56.01.B0006 406916A9FC5401
            Firmware: Firmware MPM 12.01.B0006 B01916A9FC5401
            Firmware: Firmware MPM 12.01.B0006 406916A9FC5401
            Firmware: Other   
            Unit ID: 22F74994  Model ID: B01940690000  Transport IDs: {'btleid': 'B019', 'wpid': '4069'}
         3: DEVICE NAME            {0005}   
            Name: Wireless Mouse MX Master 2S
            Kind: mouse
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: CRYPTO ID              {0021}   
         7: BATTERY STATUS         {1000}   
            Battery: 50%, discharging, next level 20%.
         8: CONFIG DEVICE PROPS    {1806}   internal, hidden
         9: CHANGE HOST            {1814}   
            Change Host: 1:gasoxxxxxxx
        10: REPROG CONTROLS V4     {1B04}   
            Key/Button Actions: {'80': 80, '81': 81, '82': 82, '83': 83, '86': 86, '195': 195, '196': 196}
        11: ADJUSTABLE DPI         {2201}   
            Sensitivity (DPI): 1000
        12: VERTICAL SCROLLING     {2100}   
            Roller type: 3G
            Ratchet per turn: 24
            Scroll lines: 0
        13: SMART SHIFT            {2110}   
            Scroll Wheel Rachet: 16
        14: HIRES WHEEL            {2121}   
            Multiplier: 8
            Has invert: Normal wheel motion
            Has ratchet switch: Normal wheel mode
            High resolution mode
            HID notification
            Scroll Wheel Direction: False
            Scroll Wheel Resolution: True
        15: GESTURE 2              {6501}   
            Gestures: {'46': True, '45': True}
        16: DFUCONTROL SIGNED      {00C2}   
        17: unknown:1813           {1813}   internal, hidden
        18: unknown:1830           {1830}   internal, hidden
        19: unknown:1890           {1890}   internal, hidden
        20: unknown:1891           {1891}   internal, hidden
        21: unknown:18A1           {18A1}   internal, hidden
        22: unknown:18C0           {18C0}   internal, hidden
        23: unknown:1DF3           {1DF3}   internal, hidden
        24: unknown:1E00           {1E00}   hidden
        25: unknown:1EB0           {1EB0}   internal, hidden
        26: unknown:1803           {1803}   internal, hidden
        27: unknown:1861           {1861}   internal, hidden
        28: unknown:9001           {9001}   internal, hidden
        29: unknown:9200           {9200}   internal, hidden
        30: unknown:9202           {9202}   internal, hidden
        31: OOBSTATE               {1805}   internal, hidden
     Has 8 reprogrammable keys:
         0: Left Button               , default: Left Click                  => Left Click                
             mse, pos:0, group:1, group mask:g1
             reporting: default
         1: Right Button              , default: Right Click                 => Right Click               
             mse, pos:0, group:1, group mask:g1
             reporting: default
         2: Middle Button             , default: Mouse Middle Button         => Mouse Middle Button       
             mse, reprogrammable, divertable, raw XY, pos:0, group:3, group mask:g1,g2,g3
             reporting: default
         3: Back Button               , default: Mouse Back Button           => Mouse Back Button         
             mse, reprogrammable, divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         4: Forward Button            , default: Mouse Forward Button        => Mouse Forward Button      
             mse, reprogrammable, divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         5: App Switch Gesture        , default: Gesture Button Navigation   => Gesture Button Navigation 
             mse, reprogrammable, divertable, raw XY, pos:0, group:3, group mask:g1,g2,g3
             reporting: default
         6: Smart Shift               , default: Smart Shift                 => Smart Shift               
             mse, reprogrammable, divertable, raw XY, pos:0, group:3, group mask:g1,g2,g3
             reporting: default
         7: Virtual Gesture Button    , default: Virtual Gesture Button      => Virtual Gesture Button    
             divertable, virtual, raw XY, force raw XY, pos:0, group:4, group mask:empty
             reporting: default
     Has 2 gesture(s), 0 param(s) and 4 spec(s):
        Thumbwheel                 Enabled (   0): True
        NaturalScrolling           Enabled (   1): True
        period unit                Spec    (   3): 800
        DVI field width            Spec    (   1): 8
        field widths               Spec    (   2): 8
        resolution                 Spec    (   4): 2048
     Battery: 50%, discharging, next level 20%.

```

**Describe the bug**
After wake up from PC (Fedora 33 in my case) the scrolling is slow. It does this already for few versions of Fedora. When I start pairing in Solaar and immediatly stop pairing the mousescrolling is back at it's original speed.

**To Reproduce**
Steps to reproduce the behavior:
See above
Smooth scrolling is absurdly fast on libinput
**Information**
- Solaar version: 1.0.5
- Distribution: Ubuntu 20.04
- Kernel version: `Linux 5.8.0-45-generic x86_64 GNU/Linux`
- Output of `solaar show`: 
<details>
```
Wired Devices
  1: M720 Triathlon Multi-Device Mouse
     Device path  : /dev/hidraw4
     USB id       : 046d:B015
     Codename     : M720 Triathlon
     Kind         : mouse
     Protocol     : HID++ 4.5
     Serial number: ?
     Model ID:      B015405E0000
     Unit ID:       C14EDE53
        Bootloader: BOT 34.01.B0005
          Firmware: MPM 04.10.B0013
             Other: 
     Supports 31 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
            Firmware: Bootloader BOT 34.01.B0005 000000A96719
            Firmware: Firmware MPM 04.10.B0013 B01500A96719
            Firmware: Other   
            Unit ID: C14EDE53  Model ID: B015405E0000  Transport IDs: {'btleid': 'B015', 'wpid': '405E'}
         3: DEVICE NAME            {0005}   
            Name: M720 Triathlon Multi-Device Mouse
            Kind: mouse
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: CRYPTO ID              {0021}   
         7: DEVICE FRIENDLY NAME   {0007}   
         8: BATTERY STATUS         {1000}   
            Battery: 90%, discharging, next level 50%.
         9: CHANGE HOST            {1814}   
            Change Host: 2:helitonmrf
        10: HOSTS INFO             {1815}   
            Host 0 (paired): 
            Host 1 (paired): helitonmrf
            Host 2 (paired): DESKTOP-610I2UD
        11: REPROG CONTROLS V4     {1B04}   
            Key/Button Actions: {'80': 80, '81': 81, '82': 82, '83': 83, '86': 86, '91': 91, '93': 93, '208': 208}
            Key/Button Diversion: {'82': 0, '83': 0, '86': 0, '91': 0, '93': 0, '208': 0, '215': 0}
        12: PERSISTENT REMAPPABLE ACTION {1C00}   
        13: POINTER SPEED          {2205}   
            Pointer Speed: 1.0
            Sensitivity (Pointer Speed): 256
        14: VERTICAL SCROLLING     {2100}   
            Roller type: 3G
            Ratchet per turn: 24
            Scroll lines: 0
        15: DFUCONTROL UNSIGNED    {00C1}   
        16: DFUCONTROL SIGNED      {00C2}   
        17: unknown:1803           {1803}   internal, hidden
        18: unknown:1813           {1813}   internal, hidden
        19: unknown:1830           {1830}   internal, hidden
        20: unknown:18A1           {18A1}   internal, hidden
        21: unknown:1DF3           {1DF3}   internal, hidden
        22: unknown:1E00           {1E00}   hidden
        23: unknown:1EB0           {1EB0}   internal, hidden
        24: unknown:1861           {1861}   internal, hidden
        25: unknown:18B1           {18B1}   internal, hidden
        26: unknown:1850           {1850}   internal, hidden
        27: unknown:1E22           {1E22}   
        28: unknown:1F03           {1F03}   internal, hidden
        29: unknown:18C0           {18C0}   internal, hidden
        30: HIRES WHEEL            {2121}   
            Multiplier: 8
            Has invert: Normal wheel motion
            Has ratchet switch: Normal wheel mode
            Low resolution mode
            HID notification
            Scroll Wheel Direction: False
            Scroll Wheel Resolution: False
     Has 9 reprogrammable keys:
         0: Left Button               , default: Left Click                  => Left Click                
             mse, reprogrammable, pos:0, group:1, group mask:g1
             reporting: default
         1: Right Button              , default: Right Click                 => Right Click               
             mse, reprogrammable, pos:0, group:1, group mask:g1
             reporting: default
         2: Middle Button             , default: Mouse Middle Button         => Mouse Middle Button       
             mse, reprogrammable, divertable, persistently divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         3: Back Button               , default: Mouse Back Button           => Mouse Back Button         
             mse, reprogrammable, divertable, persistently divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         4: Forward Button            , default: Mouse Forward Button        => Mouse Forward Button      
             mse, reprogrammable, divertable, persistently divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         5: Left Tilt                 , default: Mouse Scroll Left Button    => Mouse Scroll Left Button  
             mse, reprogrammable, divertable, persistently divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         6: Right Tilt                , default: Mouse Scroll Right Button   => Mouse Scroll Right Button 
             mse, reprogrammable, divertable, persistently divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         7: MultiPlatform Gesture Button, default: Multiplatform Gesture Button => Multiplatform Gesture Button
             mse, reprogrammable, divertable, persistently divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         8: Virtual Gesture Button    , default: Virtual Gesture Button      => Virtual Gesture Button    
             divertable, virtual, raw XY, force raw XY, pos:0, group:3, group mask:empty
             reporting: default
     Battery: 90%, discharging, next level 50%.
```
</details>

**Describe the bug**
The scroll speed is absurdly fast when Scroll Wheel Resolution is enabled. I found solutions for mice that use `evdev` as the driver, but M720 uses `libinput` so I can't just use `xinput` to reset `Evdev Scrolling Distance`.

**To Reproduce**
Steps to reproduce the behavior:
With a mouse that uses `libinput` (M720, for example), activate *Scroll Wheel Resolution*.

**Additional context**
Add any other context about the problem here.



Discussion:

See the discussion in the latter part of issue #1061 
The problem is that input drivers use this setting so when these input drivers are active users shouldn't be using Solaar to set the setting.

I'm thinking of removing the setting entirely from Solaar.

Resolving patch:
diff --git a/lib/logitech_receiver/descriptors.py b/lib/logitech_receiver/descriptors.py
--- a/lib/logitech_receiver/descriptors.py
+++ b/lib/logitech_receiver/descriptors.py
@@ -458,7 +458,7 @@ def get_btid(btid):
     wpid='406D',
     settings=[
         _FS.hires_smooth_invert(),
-        _FS.hires_smooth_resolution(),
+        #        _FS.hires_smooth_resolution(),
         _FS.pointer_speed(),
     ]
 )
@@ -483,7 +483,7 @@ def get_btid(btid):
     wpid='404A',
     settings=[
         _FS.hires_smooth_invert(),
-        _FS.hires_smooth_resolution(),
+        #        _FS.hires_smooth_resolution(),
     ],
 )
 _D(
@@ -510,7 +510,7 @@ def get_btid(btid):
     btid=0xb012,
     settings=[
         _FS.hires_smooth_invert(),
-        _FS.hires_smooth_resolution(),
+        #        _FS.hires_smooth_resolution(),
     ],
 )
 
@@ -522,7 +522,7 @@ def get_btid(btid):
     btid=0xb019,
     settings=[
         _FS.hires_smooth_invert(),
-        _FS.hires_smooth_resolution(),
+        #        _FS.hires_smooth_resolution(),
         _FS.gesture2_gestures(),
     ],
 )
diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py
--- a/lib/logitech_receiver/settings_templates.py
+++ b/lib/logitech_receiver/settings_templates.py
@@ -772,7 +772,7 @@ def _S(name, featureID=None, featureFn=None, registerFn=None, identifier=None):
     _S(_HI_RES_SCROLL, _F.HI_RES_SCROLLING, _feature_hi_res_scroll),
     _S(_LOW_RES_SCROLL, _F.LOWRES_WHEEL, _feature_lowres_smooth_scroll),
     _S(_HIRES_INV, _F.HIRES_WHEEL, _feature_hires_smooth_invert),
-    _S(_HIRES_RES, _F.HIRES_WHEEL, _feature_hires_smooth_resolution),
+    #    _S(_HIRES_RES, _F.HIRES_WHEEL, _feature_hires_smooth_resolution),  # Recent Linux drivers depend on this not changing
     _S(_SMART_SHIFT, _F.SMART_SHIFT, _feature_smart_shift),
     _S(_SMART_SHIFT, _F.SMART_SHIFT_ENHANCED, _feature_smart_shift_enhanced, identifier='smart_shift_enhanced'),
     _S(_THUMB_SCROLL_MODE, _F.THUMB_WHEEL, _feature_thumb_mode),


Test patch: