Repository: pwr-Solaar/Solaar

Issue:
Logitech receiver with USB product ID 0xC542 will not work with Solaar
<!-- Make surse 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.0.6.  Please update to the latest version and see if your issue persists. -->
- Solaar version: `1.1.0`
- Distribution: `Debian/Ubuntu`
- Kernel version : `Linux 5.13.0-21-generic x86_64 GNU/Linux`
- Output of `solaar show`:

<details>

```
Unifying Receiver
  Device path  : /dev/hidraw1
  USB id       : 046d:C52B
  Serial       : C826992E
    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=226

  1: Wireless Touch Keyboard K400 Plus
     Device path  : /dev/hidraw2
     WPID         : 404D
     Codename     : K400 Plus
     Kind         : keyboard
     Protocol     : HID++ 4.1
     Polling rate : 8 ms (125Hz)
     Serial number: F3BB1CA8
     Model ID:      404D00000000
     Unit ID:       7E823222
        Bootloader: BOT 22.02.B0002
          Firmware: RQK 63.02.B0016
             Other: 
     The power switch is located on the top edge.
     Supports 24 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
            Firmware: Bootloader BOT 22.02.B0002 404D6217AD40
            Firmware: Firmware RQK 63.02.B0016 404D6217AD40
            Firmware: Other   
            Unit ID: 7E823222  Model ID: 404D00000000  Transport IDs: {'wpid': '404D'}
         3: DEVICE NAME            {0005}   
            Name: Wireless Touch Keyboard K400 Plus
            Kind: keyboard
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: BATTERY STATUS         {1000}   
            Battery: 20%, discharging, next level 5%.
         7: REPROG CONTROLS V4     {1B04}   
         8: SWAP BUTTON CANCEL     {2005}   
         9: NEW FN INVERSION       {40A2}   
            Fn-swap: enabled
            Fn-swap default: enabled
            Swap Fx function (saved): True
            Swap Fx function        : True
        10: ENCRYPTION             {4100}   
        11: KEYBOARD DISABLE KEYS  {4521}   
            Disable keys (saved): {'1': False, '16': False, '4': False, '8': False}
            Disable keys        : {'1': False, '4': False, '8': False, '16': False}
        12: TOUCHPAD RAW XY        {6100}   
        13: GESTURE 2              {6501}   
            Gestures (saved): {'1': True, '10': True, '2': True, '30': True, '34': False, '42': True, '43': True, '45': False, '64': False, '65': False, '67': False, '84': True}
            Gestures        : {'1': True, '2': True, '30': True, '10': True, '45': False, '42': True, '43': True, '64': False, '65': False, '67': False, '84': True, '34': False}
            Gesture params (saved): {'4': {'scale': 256}}
            Gesture params        : {'4': {'scale': 256}}
        14: DFUCONTROL UNSIGNED    {00C1}   
        15: unknown:1811           {1811}   internal, hidden
        16: unknown:1830           {1830}   internal, hidden
        17: unknown:1890           {1890}   internal, hidden
        18: unknown:1DF3           {1DF3}   internal, hidden
        19: unknown:1E00           {1E00}   hidden
        20: unknown:1EB0           {1EB0}   internal, hidden
        21: unknown:1861           {1861}   internal, hidden
        22: unknown:18B0           {18B0}   internal, hidden
        23: unknown:1F11           {1F11}   internal, hidden
     Has 20 reprogrammable keys:
         0: Second Left Click         , default: Left Click                  => Left Click                
             mse, divertable, pos:0, group:0, group mask:empty
             reporting: default
         1: Back                      , default: Mouse Back Button           => Mouse Back Button         
             is FN, FN sensitive, reprogrammable, divertable, pos:1, group:0, group mask:empty
             reporting: default
         2: My Home                   , default: HomePage                    => HomePage                  
             is FN, FN sensitive, reprogrammable, divertable, pos:2, group:0, group mask:empty
             reporting: default
         3: Application Switcher      , default: Application Switcher        => Application Switcher      
             is FN, FN sensitive, reprogrammable, divertable, pos:3, group:0, group mask:empty
             reporting: default
         4: Contextual Menu           , default: Right Click                 => Right Click               
             is FN, FN sensitive, reprogrammable, divertable, pos:4, group:0, group mask:empty
             reporting: default
         5: Search                    , default: Search Files                => Search Files              
             is FN, FN sensitive, reprogrammable, divertable, pos:5, group:0, group mask:empty
             reporting: default
         6: Show Desktop              , default: Show Desktop                => Show Desktop              
             is FN, FN sensitive, reprogrammable, divertable, pos:6, group:0, group mask:empty
             reporting: default
         7: Maximize Window           , default: Maximize Window             => Maximize Window           
             is FN, FN sensitive, reprogrammable, divertable, pos:7, group:0, group mask:empty
             reporting: default
         8: Switch Screen             , default: Switch Presentation/Switch Screen => Switch Presentation/Switch Screen
             is FN, FN sensitive, reprogrammable, divertable, pos:8, group:0, group mask:empty
             reporting: default
         9: Media Player              , default: Music                       => Music                     
             is FN, FN sensitive, reprogrammable, divertable, pos:9, group:0, group mask:empty
             reporting: default
        10: Previous                  , default: Previous                    => Previous                  
             is FN, FN sensitive, divertable, pos:10, group:0, group mask:empty
             reporting: default
        11: Play/Pause                , default: Play/Pause                  => Play/Pause                
             is FN, FN sensitive, divertable, pos:11, group:0, group mask:empty
             reporting: default
        12: Next                      , default: Next                        => Next                      
             is FN, FN sensitive, divertable, pos:12, group:0, group mask:empty
             reporting: default
        13: Fn Left Click             , default: ShowUI                      => ShowUI                    
             divertable, pos:0, group:0, group mask:empty
             reporting: default
        14: Left Button               , default: Left Click                  => Left Click                
             mse, pos:0, group:0, group mask:empty
             reporting: default
        15: Right Button              , default: Right Click                 => Right Click               
             mse, pos:0, group:0, group mask:empty
             reporting: default
        16: Mute                      , default: Mute                        => Mute                      
             nonstandard, divertable, pos:0, group:0, group mask:empty
             reporting: default
        17: Volume Up                 , default: Volume Up                   => Volume Up                 
             nonstandard, divertable, pos:0, group:0, group mask:empty
             reporting: default
        18: Volume Down               , default: Volume Down                 => Volume Down               
             nonstandard, divertable, pos:0, group:0, group mask:empty
             reporting: default
        19: Sleep                     , default: Sleep                       => Sleep                     
             reprogrammable, divertable, pos:0, group:0, group mask:empty
             reporting: default
     Has 17 gesture(s), 1 param(s) and 5 spec(s):
        Track1Finger               Enabled (None): None
        TapGestures                Enabled (None): None
        Tap1Finger                 Enabled (   0): True
        Tap2Finger                 Enabled (   1): True
        TapDrag1Finger             Enabled (   2): True
        DoubleTap1Finger           Enabled (   3): True
        Scroll2FingerStateless     Enabled (None): None
        NaturalScrolling           Enabled (   4): False
        Scroll2FingerHoriz         Enabled (   5): True
        Scroll2FingerVert          Enabled (   6): True
        LeftEdgeSwipe1Finger2      Enabled (   7): False
        RightEdgeSwipe1Finger2     Enabled (   8): False
        TopEdgeSwipe1Finger2       Enabled (   9): False
        Zoom2FingerStateless       Enabled (  10): True
        FnClickGestureSuppression  Enabled (  11): False
        TwoFingersPresent          Enabled (None): None
        DeviceSpecificRawData      Enabled (None): None
        ScaleFactor                Value   (   0): 256 [Default: 256]
        period unit                Spec    (   3): 2048
        DVI field width            Spec    (   1): 8
        field widths               Spec    (   2): 8
        multiplier                 Spec    (   5): None
        resolution                 Spec    (   4): 4
     Battery: 20%, discharging, next level 5%.

```
</details>

**Describe the bug**
I've read a few issues about inability to pair mouse M185 but I haven't found my solution yet. I've cloned the git repository in my Ubuntu 21.10 and I'm using the Solaar app to set my K400+ wireless keyboard, which paired automatically. However, when it comes to my Wireless Mouse M185, it works on my PC (indeed battery low warning appears when plugging USB) but device doesn't appear on apps' interface nor Solaar/bin solaar show (just the keyboard). I am also unable to pair neither with app nor the Solaar/bin solar pair command on terminal. It seems like my mouse is somehow invisible to Solaar even when I checked this repository to confirm that M185 is supposedly compatible with this engine.

Thanks for your support in advantance, I'm a training software developer and I'm still confused when messing with programmes files.



Discussion:
Devices don't pair automatically, so it is likely that your K400+ was paired with your Unifying receiver by Logitech before it was sold.  
M185 mice appear to come in several versions.  Only those that have a Unifying logo will be able to pair with a Unifying receiver.  If you don't have such an M185 then you cannot pair it with your Unifying receiver. See https://pwr-solaar.github.io/Solaar/usage for more information.
You should be able to use your M185 by using the receiver it came with.
So I've found that my mouse doesn't have the unifying logo so I cannot pair using the Unifying receiver. I'm really lost on how to pair M185 with another receiver, since I've already tried several times clicking "Pair new device" and executing /bin soolar pair and they aren't working... Could you guide me?
Your M185 came paired with some receiver.   You can only pair your M185 with receivers that are functionally the same.  But it may be that there is no way to make this determination without actually trying to pair.  So try to find a receiver that looks the same, and has the same USB ID, then plug that receiver into your Linux computer and see whether you can actually do the pairing.

The USB ID of a receiver can be shown using `lsusb`.   My Unifying receiver shows up as 
```
Bus 003 Device 016: ID 046d:c52b Logitech, Inc. Unifying Receiver
```

As I was saying in the first message, my mouse does work in my computer. I only wanted some software to configure the mouse functioning (in my case regarding the scroll speed). I gave up on trying to find Logitechs' personalized applications to access my mouse settings and I decided to use general ubuntu configurations of mouse peripherals. For example, I used imwheel tool to stablish correct settings of mouse. I can leave this thread since I've seen that Solaar only works for Unifying receivers and there's nothing simillar for the rest of Logitech's devices.
If you have the receiver for the M185 mouse connected to your Linux box, you should be able to see the receiver and mouse in Solaar and control some aspects of the mouse.   If not, then please provide the output of `lsusb` so that the receiver can be added to the receivers that Solaar supports.
As I was saying, my mouse doesn't appear on Solaar so I think receiver might not be available to use with this app. I'm going to leave here the output of my `lsusb`:
`Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub`
`Bus 001 Device 004: ID 5986:9102 Acer, Inc BisonCam,NB Pro`
`Bus 001 Device 003: ID 046d:c542 Logitech, Inc. Wireless Receiver`
`Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver`
`Bus 001 Device 005: ID 8087:0029 Intel Corp. AX200 Bluetooth`
`Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub`

Thanks for your assistance
The receiver with ID 046d:c542 is not known to Solaar and needs to be added.  I'll create a patch for this.

Resolving patch:
diff --git a/lib/logitech_receiver/base_usb.py b/lib/logitech_receiver/base_usb.py
--- a/lib/logitech_receiver/base_usb.py
+++ b/lib/logitech_receiver/base_usb.py
@@ -143,58 +143,56 @@
 UNIFYING_RECEIVER_C52B = _unifying_receiver(0xc52b)
 UNIFYING_RECEIVER_C532 = _unifying_receiver(0xc532)
 
-# Nano receviers that support the Unifying protocol
+# Nano receivers (usually sold with low-end devices)
 NANO_RECEIVER_ADVANCED = _nano_receiver_no_unpair(0xc52f)
-
-# ex100 old style receiver pre-unifyimg protocol
-EX100_27MHZ_RECEIVER_C517 = _ex100_receiver(0xc517)
-
-# Nano receivers that don't support the Unifying protocol
 NANO_RECEIVER_C518 = _nano_receiver(0xc518)
 NANO_RECEIVER_C51A = _nano_receiver(0xc51a)
 NANO_RECEIVER_C51B = _nano_receiver(0xc51b)
 NANO_RECEIVER_C521 = _nano_receiver(0xc521)
 NANO_RECEIVER_C525 = _nano_receiver(0xc525)
 NANO_RECEIVER_C526 = _nano_receiver(0xc526)
-NANO_RECEIVER_C52e = _nano_receiver_no_unpair(0xc52e)
+NANO_RECEIVER_C52E = _nano_receiver_no_unpair(0xc52e)
 NANO_RECEIVER_C531 = _nano_receiver(0xc531)
 NANO_RECEIVER_C534 = _nano_receiver_max2(0xc534)
 NANO_RECEIVER_C537 = _nano_receiver(0xc537)
 NANO_RECEIVER_6042 = _lenovo_receiver(0x6042)
 
-# Lightspeed receivers
+# Lightspeed receivers (usually sold with gaming devices)
 LIGHTSPEED_RECEIVER_C539 = _lightspeed_receiver(0xc539)
-LIGHTSPEED_RECEIVER_C53a = _lightspeed_receiver(0xc53a)
-LIGHTSPEED_RECEIVER_C53f = _lightspeed_receiver(0xc53f)
-LIGHTSPEED_RECEIVER_C53d = _lightspeed_receiver(0xc53d)
-LIGHTSPEED_RECEIVER_C545 = _lightspeed_receiver(0xc545)
+LIGHTSPEED_RECEIVER_C53A = _lightspeed_receiver(0xc53a)
+LIGHTSPEED_RECEIVER_C53D = _lightspeed_receiver(0xc53d)
+LIGHTSPEED_RECEIVER_C53F = _lightspeed_receiver(0xc53f)
 LIGHTSPEED_RECEIVER_C541 = _lightspeed_receiver(0xc541)
+LIGHTSPEED_RECEIVER_C545 = _lightspeed_receiver(0xc545)
 LIGHTSPEED_RECEIVER_C547 = _lightspeed_receiver(0xc547)
 
+# EX100 old style receiver pre-unifying protocol
+EX100_27MHZ_RECEIVER_C517 = _ex100_receiver(0xc517)
+
 ALL = (
     BOLT_RECEIVER_C548,
     UNIFYING_RECEIVER_C52B,
     UNIFYING_RECEIVER_C532,
     NANO_RECEIVER_ADVANCED,
-    EX100_27MHZ_RECEIVER_C517,
     NANO_RECEIVER_C518,
     NANO_RECEIVER_C51A,
     NANO_RECEIVER_C51B,
     NANO_RECEIVER_C521,
     NANO_RECEIVER_C525,
     NANO_RECEIVER_C526,
-    NANO_RECEIVER_C52e,
+    NANO_RECEIVER_C52E,
     NANO_RECEIVER_C531,
     NANO_RECEIVER_C534,
     NANO_RECEIVER_C537,
     NANO_RECEIVER_6042,
     LIGHTSPEED_RECEIVER_C539,
-    LIGHTSPEED_RECEIVER_C53a,
-    LIGHTSPEED_RECEIVER_C53f,
-    LIGHTSPEED_RECEIVER_C53d,
-    LIGHTSPEED_RECEIVER_C545,
+    LIGHTSPEED_RECEIVER_C53A,
+    LIGHTSPEED_RECEIVER_C53D,
+    LIGHTSPEED_RECEIVER_C53F,
     LIGHTSPEED_RECEIVER_C541,
+    LIGHTSPEED_RECEIVER_C545,
     LIGHTSPEED_RECEIVER_C547,
+    EX100_27MHZ_RECEIVER_C517,
 )
 
 _wired_device = lambda product_id, interface: {


Test patch: