Repository: pwr-Solaar/Solaar

Issue:
Mx master 3 sensitivity after suspension doesn't load value
**Information**
<!-- Make sure that your issue is not one of the known issues in the Solaar documentation at https://pwr-solaar.github.io/Solaar/ -->
<!-- Do not bother opening an issue for a version older than 1.1.0.  Update to the latest version and see if your issue persists. -->
- Solaar version (`solaar --version` or `git describe --tags` if cloned from this repository): solaar 1.1.1
- Distribution: Debian GNU/Linux bookworm/sid x86_64 
- Kernel version (ex. `uname -srmo`): `Linux 5.10.0-8-amd64 x86_64 GNU/Linux`
- Output of `solaar show`:

<details>

```
Solaar version 1.1.1

Unifying Receiver
  Device path  : /dev/hidraw0
  USB id       : 046d:C52B
  Serial       : 9D7991B1
    Firmware   : 24.11.B0036
    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=43

  1: MX Master 3 Wireless Mouse
     Device path  : /dev/hidraw3
     WPID         : 4082
     Codename     : MX Master 3
     Kind         : mouse
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: C4A67048
     Model ID:      B02340820000
     Unit ID:       C4A67048
        Bootloader: BOT 95.01.B0015
          Firmware: MPM 19.01.B0015
             Other: 
     The power switch is located on the base.
     Supports 35 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
            Firmware: Bootloader BOT 95.01.B0015 00006A9CA89D
            Firmware: Firmware MPM 19.01.B0015 40826A9CA89D
            Firmware: Other   
            Unit ID: C4A67048  Model ID: B02340820000  Transport IDs: {'btleid': 'B023', 'wpid': '4082'}
         3: DEVICE NAME            {0005}   
            Name: Wireless Mouse MX Master 3
            Kind: mouse
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: CRYPTO ID              {0021}   
         7: DEVICE FRIENDLY NAME   {0007}   
            Friendly Name: MX Master 3
         8: BATTERY STATUS         {1000}   
            Battery: 100%, discharging, next level 50%.
         9: REPROG CONTROLS V4     {1B04}   
            Key/Button Actions (saved): {'195': 195, '196': 196, '80': 80, '81': 81, '82': 82, '83': 83, '86': 86}
            Key/Button Actions        : {'80': 80, '81': 81, '82': 82, '83': 83, '86': 86, '195': 195, '196': 196}
            Key/Button Diversion (saved): {'195': 1, '196': 0, '82': 0, '83': 0, '86': 0}
            Key/Button Diversion        : {'82': 0, '83': 0, '86': 0, '195': 0, '196': 0}
        10: CHANGE HOST            {1814}   
            Change Host        : 1:nuc
        11: XY STATS               {2250}   
        12: ADJUSTABLE DPI         {2201}   
            Sensitivity (DPI) (saved): 2400
            Sensitivity (DPI)        : 2400
        13: SMART SHIFT            {2110}   
            Scroll Wheel Rachet (saved): 10
            Scroll Wheel Rachet        : 10
        14: HIRES WHEEL            {2121}   
            Multiplier: 15
            Has invert: Normal wheel motion
            Has ratchet switch: Normal wheel mode
            High resolution mode
            HID notification
            Scroll Wheel Direction (saved): False
            Scroll Wheel Direction        : False
            Scroll Wheel Resolution (saved): True
            Scroll Wheel Resolution        : True
        15: THUMB WHEEL            {2150}   
            Thumb Wheel Diversion (saved): False
            Thumb Wheel Diversion        : False
            Thumb Wheel Direction (saved): False
            Thumb Wheel Direction        : False
        16: WHEEL STATS            {2251}   
        17: DFUCONTROL SIGNED      {00C2}   
        18: DEVICE RESET           {1802}   internal, hidden
        19: unknown:1803           {1803}   internal, hidden
        20: CONFIG DEVICE PROPS    {1806}   internal, hidden
        21: unknown:1813           {1813}   internal, hidden
        22: OOBSTATE               {1805}   internal, hidden
        23: unknown:1830           {1830}   internal, hidden
        24: unknown:1890           {1890}   internal, hidden
        25: unknown:1891           {1891}   internal, hidden
        26: unknown:18A1           {18A1}   internal, hidden
        27: unknown:1DF3           {1DF3}   internal, hidden
        28: unknown:1E00           {1E00}   hidden
        29: unknown:1EB0           {1EB0}   internal, hidden
        30: unknown:1861           {1861}   internal, hidden
        31: unknown:9001           {9001}   internal, hidden
        32: unknown:9203           {9203}   internal, hidden
        33: unknown:9205           {9205}   internal, hidden
        34: unknown:9300           {9300}   internal, hidden
     Has 8 reprogrammable keys:
         0: Left Button               , default: Left Click                  => Left Click                
             mse, analytics key events, pos:0, group:1, group mask:g1
             reporting: default
         1: Right Button              , default: Right Click                 => Right Click               
             mse, analytics key events, pos:0, group:1, group mask:g1
             reporting: default
         2: Middle Button             , default: Mouse Middle Button         => Mouse Middle Button       
             mse, reprogrammable, divertable, raw XY, analytics key events, 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, analytics key events, 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, analytics key events, pos:0, group:2, group mask:g1,g2
             reporting: default
         5: Mouse Gesture Button      , default: Gesture Button Navigation   => Gesture Button Navigation 
             mse, reprogrammable, divertable, raw XY, analytics key events, pos:0, group:3, group mask:g1,g2,g3
             reporting: default
         6: Smart Shift               , default: Smart Shift                 => Smart Shift               
             mse, reprogrammable, divertable, raw XY, analytics key events, 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
     Battery: 100%, discharging, next level 50%.

```
</details>

**Describe the bug**
When the computer is woken up from suspension, mouse sensitivity is reverted to default (slow) speed

**To Reproduce**
Steps to reproduce the behavior:
1. Computer goes into suspension
2. Computer is woken up by moving the mouse
3. Mouse speed is slow
4. Open solaar, cycle through `changes allowed` padlock to get it working again




Discussion:

Resolving patch:
diff --git a/lib/solaar/listener.py b/lib/solaar/listener.py
--- a/lib/solaar/listener.py
+++ b/lib/solaar/listener.py
@@ -343,18 +343,18 @@ def ping_all(resuming=False):
     for l in _all_listeners.values():
         if l.receiver.isDevice:
             if resuming:
-                l.receiver.status._active = False
+                l.receiver.status._active = None  # ensure that settings are pushed
             if l.receiver.ping():
-                l.receiver.status.changed(active=True)
+                l.receiver.status.changed(active=True, push=True)
             l._status_changed(l.receiver)
         else:
             count = l.receiver.count()
             if count:
                 for dev in l.receiver:
                     if resuming:
-                        dev.status._active = False
+                        dev.status._active = None  # ensure that settings are pushed
                     if dev.ping():
-                        dev.status.changed(active=True)
+                        dev.status.changed(active=True, push=True)
                     l._status_changed(dev)
                     count -= 1
                     if not count:


Test patch: