pwr-Solaar / Solaar

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

Unable to program the two additional buttons in M575 #1717

Closed 5uie closed 2 years ago

5uie commented 2 years ago

Information

``` Solaar version 1.1.1 Unifying Receiver Device path : /dev/hidraw2 USB id : 046d:C52B Serial : A6BD9FF8 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=147 1: ERGO M575 Trackball Device path : /dev/hidraw3 WPID : 4096 Codename : ERGO M575 Kind : mouse Protocol : HID++ 4.5 Polling rate : 8 ms (125Hz) Serial number: 90B891B5 Model ID: B02740960000 Unit ID: 90B891B5 Bootloader: BOT 40.00.B0009 Firmware: MPM 26.00.B0009 Other: The power switch is located on the base. Supports 26 HID++ 2.0 features: 0: ROOT {0000} 1: FEATURE SET {0001} 2: DEVICE FW VERSION {0003} Firmware: Bootloader BOT 40.00.B0009 0000ABF1CB8B01 Firmware: Firmware MPM 26.00.B0009 4096ABF1CB8B01 Firmware: Other Unit ID: 90B891B5 Model ID: B02740960000 Transport IDs: {'btleid': 'B027', 'wpid': '4096'} 3: DEVICE NAME {0005} Name: ERGO M575 Trackball Kind: trackball 4: WIRELESS DEVICE STATUS {1D4B} 5: RESET {0020} 6: DEVICE FRIENDLY NAME {0007} Friendly Name: ERGO M575 7: UNIFIED BATTERY {1004} 8: REPROG CONTROLS V4 {1B04} DPI Sliding Adjustment (saved): Off DPI Sliding Adjustment : Off Mouse Gestures (saved): Off Mouse Gestures : Off 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} 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} Key/Button Diversion (saved): {Middle Button:Regular, Back Button:Regular, Forward Button:Regular} Key/Button Diversion : {Middle Button:Regular, Back Button:Regular, Forward Button:Regular} 9: ADJUSTABLE DPI {2201} Sensitivity (DPI) (saved): 650 Sensitivity (DPI) : 650 10: XY STATS {2250} 11: DFUCONTROL SIGNED {00C2} 12: DEVICE RESET {1802} internal, hidden 13: unknown:1803 {1803} internal, hidden 14: CONFIG DEVICE PROPS {1806} internal, hidden 15: unknown:1812 {1812} internal, hidden 16: OOBSTATE {1805} internal, hidden 17: unknown:1830 {1830} internal, hidden 18: unknown:1890 {1890} internal, hidden 19: unknown:1891 {1891} internal, hidden 20: unknown:18A1 {18A1} internal, hidden 21: unknown:1E00 {1E00} hidden 22: unknown:1EB0 {1EB0} internal, hidden 23: unknown:1861 {1861} internal, hidden 24: unknown:1E22 {1E22} internal, hidden 25: unknown:1F03 {1F03} internal, hidden Has 6 reprogrammable keys: 0: Left Button , default: Left Click => Left Click mse, reprogrammable, analytics key events, pos:0, group:1, group mask:g1 reporting: default 1: Right Button , default: Right Click => Right Click mse, reprogrammable, 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, persistently divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2 reporting: default 3: Forward Button , default: Mouse Forward Button => Mouse Forward Button mse, reprogrammable, divertable, persistently divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2 reporting: default 4: Back Button , default: Mouse Back Button => Mouse Back Button mse, reprogrammable, divertable, persistently divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2 reporting: default 5: 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: 100%, discharging. ```
``` - 1.1.4 - _NAME: ERGO M575 Trackball _absent: [hi-res-scroll, lowres-scroll-mode, hires-smooth-invert, hires-smooth-resolution, hires-scroll-mode, smart-shift, thumb-scroll-invert, thumb-scroll-mode, onboard_profiles, report_rate, pointer_speed, speed-change, backlight, backlight-timed, fn-swap, persistent-remappable-keys, disable-keyboard-keys, crown-smooth, divert-crown, divert-gkeys, m-key-leds, mr-key-led, multiplatform, change-host, gesture2-gestures, gesture2-divert, gesture2-params, sidetone, equalizer] _battery: 4100 _modelId: B02740960000 _sensitive: {dpi: false, reprogrammable-keys: false} _serial: 90B891B5 _unitId: 90B891B5 _wpid: '4096' divert-keys: {82: 0, 83: 0, 86: 0} dpi: 300 reprogrammable-keys: {80: 80, 81: 81, 82: 82, 83: 83, 86: 86} - {_NAME: ERGO M575, _serial: 90B891B5, _wpid: '4096'} ```
``` %YAML 1.3 --- - Rule: - Key: [Back Button, pressed] - KeyPress: [Alt_L, Tab] - Rule: - Key: [Forward Button, pressed] - KeyPress: [Alt_L, Shift_L, Tab] ... ```
No Errors reported from solaar -dd

Describe the bug

  1. I am unable to programme the two additional buttons in Logitech M575 (the programming of these buttons have been discussed in #1557.
  2. I have followed the instructions provided in #1443 specifically for M575.
  3. The rules work as a back and forward button within firefox, but do not work as intended alt+tabbing or swithcing between windows.
pfps commented 2 years ago

To make keys or buttons initiate Solaar rule processing they have to be diverted.

The Solaar documentation discusses this in the rules document:

Solaar's rules only trigger on HID++ notifications so device actions that normally produce HID output have to be first be set (diverted) to produce HID++ notifications instead of their normal behavior. Currently Solaar can divert some mouse scroll wheels, some mouse thumb wheels, the crown of Craft keyboards, and some keys and buttons. If the scroll wheel, thumb wheel, crown, key, or button is not diverted by setting the appropriate setting then no HID++ notification is generated and rules will not be triggered by manipulating the wheel, crown, key, or button. Look for HID++ or Diversion settings to see what diversion can be done with your devices.

pfps commented 2 years ago

PR #1706 shows a short description for the rule component being edited. See Issue #1701 for more information. Try running PR #1706 and see whether the description for the Key component would have helped you. If not, please suggest wording that might have helped you.

5uie commented 2 years ago

To make keys or buttons initiate Solaar rule processing they have to be diverted.

The Solaar documentation discusses this in the rules document:

Solaar's rules only trigger on HID++ notifications so device actions that normally produce HID output have to be first be set (diverted) to produce HID++ notifications instead of their normal behavior. Currently Solaar can divert some mouse scroll wheels, some mouse thumb wheels, the crown of Craft keyboards, and some keys and buttons. If the scroll wheel, thumb wheel, crown, key, or button is not diverted by setting the appropriate setting then no HID++ notification is generated and rules will not be triggered by manipulating the wheel, crown, key, or button. Look for HID++ or Diversion settings to see what diversion can be done with your devices.

Apologies if I am refering to the wrong page or have misunderstood! I have seen the instructions at https://pwr-solaar.github.io/Solaar/capabilities and at https://pwr-solaar.github.io/Solaar/rules. Based on the information at https://pwr-solaar.github.io/Solaar/features.html, I looked at the file in lib/logitech_receiver/settings_templates.py and lib/logitech_receiver/hidpp20.py and it seems to suggest that the back and forward button aren't part of the files for my PR (#1445 or in #1706 as mentioned in the response).

/dev/hidraw0: Logitech USB Receiver (046d:c52b) HID++ 1.0
/dev/hidraw0 (device 1): ERGO M575 (046d:4096) HID++ 4.5

Logitech USB Receiver (046d:c52b) is a HID++ 1.0 device
Register 0x00 read   3: 00 09 00
Register 0x01 read   3: 00 00 00
Register 0x02 read   3: 00 01 00
Register 0x03 read   3: 00 00 00
Register 0xb3 read  16: 7c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Register 0xb5 read  16: Invalid value (0x03)
Register 0xd0 read   3: 00 00 00
Register 0xd4 read   3: 00 00 7c
Register 0xe6 read   3: 00 00 00
Register 0xf0 read   3: 00 00 00
Register 0xf1 read   3: Invalid value (0x03)

    state 0x0, button 9, same_screen YES
    state 0x0, button 9, same_screen YES
    state 0x0, button 8, same_screen YES
    state 0x0, button 8, same_screen YES

I have #1701 on my machine now,

> git describe --tags
1.1.4-42-g29d2c14

The instructions read fine for me. Solaaris_Userrules

However, the issue persists. Am I supposed to use a feature such as REPROG CONTROLS or MKEYS before I trigger the key and the action?

Once again apologies if I haven't understood and thank you for providing Solaaris!

pfps commented 2 years ago

To have the back and forward buttons trigger Solaar rules you have to first use Solaar to "divert" the buttons so that they produce messages that Solaar can use. You do this in the Solaar GUI by using the Key/Button Diversion setting and set the Back Button and Forward Button to Diverted. You also have to have to Solaar GUI running.

Only when Solaar is running and only when keys or buttons are diverted will Solaar rules be run in response to pressing the key or button.

5uie commented 2 years ago

Solaaris_Divert_attempt1

Is this correct? I have the GUI running (have restarted Solaaris too) but it still doesn't acknowledge this.

pfps commented 2 years ago

What you did was add an extra condition to the rule. This rule acts as follows:

When a device sends a message to Solaar, if your ERGO has its back button diverted and the back button was the cause of the message then simulate an Alt_L + Tab.

The previous rules were fine. The first one read as follows:

When a device sends a message to Solaar, if the back button was the cause of the message then simulate an Alt_L + Tab.

What was missing was that your mouse never sent this kind of message because the back and forward buttons were not diverted and thus they never caused messages to be sent to Solaar. Solaar rules do not respond to normal input messages from devices, just the special kinds of message that arise from diversions.

You need to use the normal main window in Solaar and in the Key/Button Diversion setting change Back Button and Forward Button to Diverted.

pfps commented 2 years ago

https://pwr-solaar.github.io/Solaar/Solaar-main-window-back-divert.png shows the main Solaar window with the Back Button diverted. Your main window will not look exactly like this, of course, because your device is different.

5uie commented 2 years ago

https://pwr-solaar.github.io/Solaar/Solaar-main-window-back-divert.png shows the main Solaar window with the Back Button diverted. Your main window will not look exactly like this, of course, because your device is different.

Thank you this worked, but how do I setup a similar divert for the forward button? As GUI on the main screen seems to allow only for one button to be diverted Solaaris_DivertMain

pfps commented 2 years ago

Each key or button has its own value. Just change the first field to Forward Button and change that to Diverted.

5uie commented 2 years ago

Thank you that worked, I thought we needed another GUI entry to do this.