pwr-Solaar / Solaar

Linux device manager for Logitech devices
https://pwr-solaar.github.io/Solaar
GNU General Public License v2.0
5.4k stars 402 forks source link

Help with mapping mouse keys to simulate keyboard keys #2326

Closed msdobrescu closed 6 months ago

msdobrescu commented 7 months ago

Hi, I can't figure put how to map the lateral mouse buttons of M705 to keyboard keys. Is there a guide? I have no idea on what various feature mean. I have successfully mapped those on Windows with Logitech's software, so it is possible. Thank you in advance!

pfps commented 7 months ago

To get help you need to provide information about the device - the output of solaar show.

Solaar doesn't do quite a bit that Logitech's software does and can't do all of what it does.

msdobrescu commented 7 months ago

Here I have two device editions:

solaar show
solaar version 1.1.9

Unifying Receiver
  Device path  : /dev/hidraw2
  USB id       : 046d:C52B
  Serial       : 81789E59
    Firmware   : 24.11.B0036
    Bootloader : 02.09
    Other      : AA.AC
  Has 1 paired device(s) out of a maximum of 6.
  Notifications: wireless (0x000100)
  Device activity counters: 1=106

  1: Marathon Mouse M705 (M-R0073)
     Device path  : /dev/hidraw3
     WPID         : 406D
     Codename     : M705 (M-R0073)
     Kind         : mouse
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: 4C614270
     The power switch is located on the base.
     Battery: unknown (device is offline).
solaar show
solaar version 1.1.9

Unifying Receiver
  Device path  : /dev/hidraw1
  USB id       : 046d:C52B
  Serial       : 77099BBB
    Firmware   : 12.10.B0032
    Bootloader : 02.15
    Other      : AA.AA
  Has 2 paired device(s) out of a maximum of 6.
  Notifications: wireless, software present (0x000900)
  Device activity counters: 1=132, 2=24

  1: Marathon Mouse M705 (M-R0009)
     Device path  : /dev/hidraw2
     WPID         : 101B
     Codename     : M705 (M-R0009)
     Kind         : mouse
     Protocol     : HID++ 1.0
     Polling rate : 8 ms (125Hz)
     Serial number: 7C44B18E
          Firmware: 17.01.B0017
        Bootloader: 02.06
             Other: 00.04
     The power switch is located on the base.
     Notifications: battery status (0x100000).
     Features: special buttons, scroll accel (0x420000)
     Battery: 50%, discharging.

  2: Wireless Illuminated Keyboard K800
     Device path  : /dev/hidraw3
     WPID         : 2010
     Codename     : K800
     Kind         : keyboard
     Protocol     : HID++ 1.0
     Polling rate : 20 ms (50Hz)
     Serial number: FFC65665
          Firmware: 22.01.B0019
        Bootloader: 02.01
             Other: 00.07
     The power switch is located on the top right corner.
     Notifications: keyboard illumination, battery status (0x100200).
     Features: (none)
     Battery: critical, discharging.

The idea was to be sure the mouse supports the mapping.

pfps commented 7 months ago

Solaar supports only a very limited part of older Logitech devices, those with protocol HID++ 1.0. As well, different devices support different settings, based on what their firmware implements. Logitech has the bad habit of using the same model name for different hardware (and firmware). You have to 705s, one old and one new.

The output for your newer mouse is incomplete because it is offline. I have a description of the Solaar settings for this mouse, though.

The newer mouse does support some limited manipulation of its buttons. If you open Solaar with the mouse active you should see a Key/Button Actions setting that will allow some remapping of the buttons. But if you want to generate keyboard keys instead you need to use rules.

First divert the buttons using the Key/Button Diversion setting. Then write rules using the Rule Editor. For each mapping Insert a new rule (right-click on the User-defined rules line). Insert a Key Condition (right-click on the [empty]) and set the key to be one of the buttons you diverted (probably Left Tilt or Right Tilt). Then insert a Key Press action after the Key Condition and set the key to be whatever you want. There are a lot of possible keys but you can type part of a key name and you will see the keys that match what you typed.

If you are running Wayland you will need to install Solaar's uinput rule. See https://pwr-solaar.github.io/Solaar/installation for more information.

msdobrescu commented 7 months ago

I don't use Wayland, but I have no idea what to setup for the rules. My main issue is to find how the lateral buttons are named. Both mice behave like back/forth at browsing.

msdobrescu commented 7 months ago

Got the right output:

solaar version 1.1.9

Unifying Receiver
  Device path  : /dev/hidraw2
  USB id       : 046d:C52B
  Serial       : 81789E59
    Firmware   : 24.11.B0036
    Bootloader : 02.09
    Other      : AA.AC
  Has 1 paired device(s) out of a maximum of 6.
  Notifications: wireless (0x000100)
  Device activity counters: 1=45

  1: Marathon Mouse M705 (M-R0073)
     Device path  : /dev/hidraw3
     WPID         : 406D
     Codename     : M705 (M-R0073)
     Kind         : mouse
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: 4C614270
     Model ID:      406D00000000
     Unit ID:       9BA5733F
        Bootloader: BOT 59.00.B0002
          Firmware: RQM 67.10.B0009
     The power switch is located on the base.
     Supports 28 HID++ 2.0 features:
         0: ROOT                   {0000} V0     
         1: FEATURE SET            {0001} V0     
         2: DEVICE FW VERSION      {0003} V2     
            Firmware: Bootloader BOT 59.00.B0002 406D00443FD5
            Firmware: Firmware RQM 67.10.B0009 406D00443FD5
            Unit ID: 9BA5733F  Model ID: 406D00000000  Transport IDs: {'wpid': '406D'}
         3: DEVICE NAME            {0005} V0     
            Name: Marathon Mouse/Performance Plus M705
            Kind: mouse
         4: WIRELESS DEVICE STATUS {1D4B} V0     
         5: CONFIG CHANGE          {0020} V0     
         6: BATTERY STATUS         {1000} V0     
            Battery status unavailable.
         7: REPROG CONTROLS V4     {1B04} V3     
            Key/Button Actions (saved): {Left Button:Left Click, Right Button:Right Click, Middle Button:Mouse Middle Button, Back Button:Mouse Back Button, Forward Button:Mouse Forward Button, Left Tilt:Mouse Scroll Left Button , Right Tilt:Mouse Scroll Right Button}
            Key/Button Actions        : {Left Button:Left Click, Right Button:Right Click, Middle Button:Mouse Middle Button, Back Button:Mouse Back Button, Forward Button:Mouse Forward Button, Left Tilt:Mouse Scroll Left Button , Right Tilt:Mouse Scroll Right Button}
            Key/Button Diversion (saved): {Middle Button:Regular, Back Button:Regular, Forward Button:Regular, Left Tilt:Regular, Right Tilt:Regular}
            Key/Button Diversion        : {Middle Button:Regular, Back Button:Regular, Forward Button:Regular, Left Tilt:Regular, Right Tilt:Regular}
         8: POINTER SPEED          {2205} V0     
            Pointer Speed: 0.77734375
            Sensitivity (Pointer Speed) (saved): 199
            Sensitivity (Pointer Speed)        : 199
         9: VERTICAL SCROLLING     {2100} V0     
            Roller type: 3G
            Ratchet per turn: 24
            Scroll lines: 0
        10: DFUCONTROL SIGNED      {00C2} V0     
        11: DEVICE RESET           {1802} V0    internal, hidden 
        12: unknown:1803           {1803} V0    internal, hidden 
        13: CONFIG DEVICE PROPS    {1806} V1    internal, hidden 
        14: unknown:1810           {1810} V0    internal, hidden 
        15: unknown:1830           {1830} V0    internal, hidden 
        16: unknown:1890           {1890} V0    internal, hidden 
        17: unknown:18A1           {18A1} V0    internal, hidden 
        18: unknown:1DF3           {1DF3} V0    internal, hidden 
        19: unknown:1E00           {1E00} V0    hidden 
        20: unknown:1EB0           {1EB0} V0    internal, hidden 
        21: unknown:1861           {1861} V0    internal, hidden 
        22: unknown:18B1           {18B1} V0    internal, hidden 
        23: unknown:1850           {1850} V0    internal, hidden 
        24: unknown:1E22           {1E22} V0    internal, hidden 
        25: unknown:1F03           {1F03} V0    internal, hidden 
        26: unknown:18C0           {18C0} V0    internal, hidden 
        27: HIRES WHEEL            {2121} V0     
            Multiplier: 8
            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
            Scroll Wheel Diversion (saved): False
            Scroll Wheel Diversion        : False
     Has 7 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, pos:0, group:2, group mask:g1,g2
             reporting: default
         3: Back Button               , default: Mouse Back Button           => Mouse Back Button         
             mse, reprogrammable, divertable, pos:0, group:2, group mask:g1,g2
             reporting: default
         4: Forward Button            , default: Mouse Forward Button        => Mouse Forward Button      
             mse, reprogrammable, divertable, 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, 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, pos:0, group:2, group mask:g1,g2
             reporting: default
     Battery status unavailable.

None of the above buttons worked.

How should such rule look like in the yaml config?

msdobrescu commented 7 months ago

Also this one does nor work either:

Unifying Receiver
  Device path  : /dev/hidraw10
  USB id       : 046d:C52B
  Serial       : EAEA9D4B
    Firmware   : 12.09.B0030
    Bootloader : 04.16
    Other      : AA.AA
  Has 2 paired device(s) out of a maximum of 6.
  Notifications: wireless, software present (0x000900)
  Device activity counters: 1=57

  1: Multi Device Silent Mouse M585/M590
     Device path  : /dev/hidraw11
     WPID         : 406B
     Codename     : M585/M590
     Kind         : mouse
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: 7A0FF7F7
     Model ID:      B01B406B0000
     Unit ID:       CA3A2C0F
        Bootloader: BOT 48.01.B0002
          Firmware: MPM 05.10.B0011
             Other: 
     The power switch is located on the base.
     Supports 35 HID++ 2.0 features:
         0: ROOT                   {0000} V0     
         1: FEATURE SET            {0001} V0     
         2: DEVICE FW VERSION      {0003} V2     
            Firmware: Bootloader BOT 48.01.B0002 0000AE5E7277
            Firmware: Firmware MPM 05.10.B0011 406BAE5E7277
            Firmware: Other   
            Unit ID: CA3A2C0F  Model ID: B01B406B0000  Transport IDs: {'btleid': 'B01B', 'wpid': '406B'}
         3: DEVICE NAME            {0005} V0     
            Name: M585/M590 Multi-Device Mouse
            Kind: mouse
         4: WIRELESS DEVICE STATUS {1D4B} V0     
         5: CONFIG CHANGE          {0020} V0     
         6: CRYPTO ID              {0021} V1     
         7: DEVICE FRIENDLY NAME   {0007} V0     
            Friendly Name: M585/M590
         8: BATTERY STATUS         {1000} V0     
            Battery: 90%, discharging, next level 50%.
         9: CHANGE HOST            {1814} V1     
            Change Host        : 1:USC
        10: HOSTS INFO             {1815} V1     
            Host 0 (paired): USC
            Host 1 (unpaired): 
        11: REPROG CONTROLS V4     {1B04} V3     
            Key/Button Actions (saved): {Left Button:Left Click, Right Button:Right Click, Middle Button:Mouse Middle Button, Back Button:Mouse Back Button, Forward Button:Mouse Forward Button, Left Tilt:Mouse Scroll Left Button , Right Tilt:Mouse Scroll Right Button}
            Key/Button Actions        : {Left Button:Left Click, Right Button:Right Click, Middle Button:Mouse Middle Button, Back Button:Mouse Back Button, Forward Button:Mouse Forward Button, Left Tilt:Mouse Scroll Left Button , Right Tilt:Mouse Scroll Right Button}
            Key/Button Diversion (saved): {Middle Button:Regular, Back Button:Regular, Forward Button:Regular, Left Tilt:Regular, Right Tilt:Regular}
            Key/Button Diversion        : {Middle Button:Regular, Back Button:Regular, Forward Button:Regular, Left Tilt:Regular, Right Tilt:Regular}
        12: PERSISTENT REMAPPABLE ACTION {1C00} V0     
            Persistent Key/Button Mapping        : {Left Button:Mouse Button Left, Right Button:Mouse Button Right, Middle Button:Mouse Button Middle, Back Button:Mouse Button Back, Forward Button:Mouse Button Forward, Left Tilt:Horizontal Scroll Left, Right Tilt:Horizontal Scroll Right}
        13: POINTER SPEED          {2205} V0     
            Pointer Speed: 0.97265625
            Sensitivity (Pointer Speed) (saved): 249
            Sensitivity (Pointer Speed)        : 249
        14: VERTICAL SCROLLING     {2100} V0     
            Roller type: standard
            Ratchet per turn: 18
            Scroll lines: 0
        15: DFUCONTROL SIGNED      {00C2} V0     
        16: DEVICE RESET           {1802} V0    internal, hidden 
        17: unknown:1803           {1803} V0    internal, hidden 
        18: CONFIG DEVICE PROPS    {1806} V0    internal, hidden 
        19: OOBSTATE               {1805} V0    internal, hidden 
        20: unknown:1813           {1813} V0    internal, hidden 
        21: unknown:1830           {1830} V0    internal, hidden 
        22: unknown:1861           {1861} V0    internal, hidden 
        23: unknown:1890           {1890} V2    internal, hidden 
        24: unknown:1891           {1891} V2    internal, hidden 
        25: unknown:18A1           {18A1} V0    internal, hidden 
        26: unknown:1DF3           {1DF3} V0    internal, hidden 
        27: unknown:1E00           {1E00} V0    hidden 
        28: unknown:1EB0           {1EB0} V0    internal, hidden 
        29: unknown:18B1           {18B1} V0    internal, hidden 
        30: unknown:1850           {1850} V0    internal, hidden 
        31: unknown:1E22           {1E22} V0     
        32: unknown:1F03           {1F03} V0    internal, hidden 
        33: unknown:18C0           {18C0} V0    internal, hidden 
        34: LOWRES WHEEL           {2130} V0     
            Wheel Reports: HID
            Scroll Wheel Diversion (saved): False
            Scroll Wheel Diversion        : False
     Has 8 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: 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
     Has 7 persistent remappable keys:
         0: Left Button                => Mouse Button: Mouse Button Left
         1: Right Button               => Mouse Button: Mouse Button Right
         2: Middle Button              => Mouse Button: Mouse Button Middle
         3: Back Button                => Mouse Button: Mouse Button Back
         4: Forward Button             => Mouse Button: Mouse Button Forward
         5: Left Tilt                  => Horizontal Scroll: Horizontal Scroll Left
         6: Right Tilt                 => Horizontal Scroll: Horizontal Scroll Right
     Battery: 90%, discharging, next level 50%.
pfps commented 7 months ago

As stated above, you have to divert the buttons before they can be used in rules.

msdobrescu commented 7 months ago

Well, I don't know what that means.

pfps commented 7 months ago

Read my comment above

msdobrescu commented 7 months ago

What is the difference between persistent key/button mapping and diverting? What is diverting, technically?

pfps commented 7 months ago

Read https://pwr-solaar.github.io/Solaar/rules

msdobrescu commented 7 months ago

Thanks, I was looking into it already. As a long time Logitech user, I know that receivers, for example, have a limited number of writes into their firmware, so can't change the associated devices too much. So my question is if there is such impact on the mouse too, or is it a pure software thing. Not sure.

Also, not clear if that button mapping feature of Solaar is similar or not. Can you please clarify this for me?

It is important to know what are the drawbacks too, also when to use one or another.

pfps commented 7 months ago

There are so many variations of Logitech hardware. As far as I know, some use fused memory for persistent storage, some use cheap flash, and some use good flash. So determining how many writes can be done is dependent on the device. But anything that does not persist should have almost unlimited writes.

Almost everything that Solaar does requires writes to the device. Certainly anything related to changeable settings does. But settings that don't persist should not degrade device permanent storage. Key/button remapping is not a persistent setting. (But there is a permanent version that a very few devices have.) While Solaar is running it pushes non-permanent settings to devices when they signal that they are reconnecting after being in a state where they have lost their non-permanent storage.

pfps commented 7 months ago

Is there anything else to be done here?

msdobrescu commented 7 months ago

Hi, thanks for your patience! Probably, would be useful to have some messages/warnings/icons when specific operations are or may be persistent, so they may render the device unusable or may exceed its writing capacity. Thank you!

pfps commented 7 months ago

There are only a couple of persistent settings that Solaar uses and these are only on high-end devices that should have a large number of writes permissible. The place where there are only a few writes permissible is pairings on Nano receivers and there there are prominent warnings. Solaar does not have facilities to update firmware so there are no problems in this area.

pfps commented 6 months ago

Closing as there appears to be nothing else to do here.

msdobrescu commented 5 months ago

Hi, one of my old mice died (the scroll simply doesn't work anymore - there were symptoms since months). To confirm, the newer mice have more controls to be mapped and work fine in Solaar. Thank you for the great job!

neoOpus commented 3 months ago

Is it possible to have other buttons supported for this device in order for me to use some for CTRL or ALT... I used to use Setpoint + uberOptions in windows to get this but now I switched to linux and I don't have access to all the buttons like the Forward / Back / TaskSwitch / etc.

solaar version 1.1.13+dfsg-1

Unifying Receiver Device path : /dev/hidraw0 USB id : 046d:C52B Serial : 5DC76AAA C Pending : ff Firmware : 12.11.B0032 Bootloader : 04.16 Other : AA.AA Has 1 paired device(s) out of a maximum of 6. Notifications: wireless, software present (0x000900) Device activity counters: 1=11

1: Performance Mouse MX Device path : /dev/hidraw1 WPID : 101A Codename : Performance MX Kind : mouse Protocol : HID++ 1.0 Report Rate : 8ms Serial number: 0C71AF06 0: 15.01.B0062 1: 02.11 3: 00.09 The power switch is located on the base. Notifications: battery status (0x100000). Features: special buttons, scroll accel (0x420000) Battery: critical, discharging.

pfps commented 3 months ago

Solaar can only do what the mouse supports. Older devices like this one have fewer capabilities than newer ones so it is very unlikely that anything can be done even if Solaar was extended to support button mapping on older devices.

neoOpus commented 3 months ago

@pfps commented on Jun 25, 2024, 4:37 AM EDT:

Solaar can only do what the mouse supports. Older devices like this one have fewer capabilities than newer ones so it is very unlikely that anything can be done even if Solaar was extended to support button mapping on older devices.

Originally posted by @pfps in https://github.com/pwr-Solaar/Solaar/issues/2326#issuecomment-2188314914

I see, on Setpoint, I could configure all the buttons. I am seeking a way to enable customization for some buttons and potentially integrate them into the GUI for this mouse may allow customizing them… I really don't intend to buy a new mouse right now due to constrained budget :(