pwr-Solaar / Solaar

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

Add a way to swap the side buttons on the G603 #1521

Closed stevegolton closed 2 years ago

stevegolton commented 2 years ago

Information

``` $ solaar show Solaar version 1.1.2 Lightspeed Receiver Device path : /dev/hidraw11 USB id : 046d:C539 Serial : C3E1868C Firmware : 39.06.B0040 Bootloader : 02.09 Other : AA.BE Has 1 paired device(s) out of a maximum of 1. Notifications: wireless, software present (0x000900) Device activity counters: (empty) 1: G603 Wireless Gaming Mouse Device path : /dev/hidraw17 WPID : 406C Codename : G603 Kind : mouse Protocol : HID++ 4.2 Polling rate : 8 ms (125Hz) Serial number: F85219FF Model ID: B01C406C0000 Unit ID: F10E1BA7 Bootloader: BOT 58.00.B0001 Firmware: MPM 08.00.B0017 Other: The power switch is located on the base. Supports 33 HID++ 2.0 features: 0: ROOT {0000} 1: FEATURE SET {0001} 2: DEVICE FW VERSION {0003} Firmware: Bootloader BOT 58.00.B0001 00003A9D11E4 Firmware: Firmware MPM 08.00.B0017 406C3A9D11E4 Firmware: Other Unit ID: F10E1BA7 Model ID: B01C406C0000 Transport IDs: {'btleid': 'B01C', 'wpid': '406C'} 3: DEVICE NAME {0005} Name: G603 Wireless Gaming Mouse Kind: mouse 4: WIRELESS DEVICE STATUS {1D4B} 5: DEVICE FRIENDLY NAME {0007} Friendly Name: G603 6: BATTERY STATUS {1000} Battery: 90%, discharging, next level 50%. 7: REPROG CONTROLS V4 {1B04} Key/Button Diversion (saved): {Host Switch Channel 1:Regular, Host Switch Channel 2:Regular} Key/Button Diversion : {Host Switch Channel 1:Regular, Host Switch Channel 2:Regular} 8: CHANGE HOST {1814} Change Host : 1:zeus 9: HOSTS INFO {1815} Host 0 (unpaired): zeus Host 1 (paired): 10: COLOR LED EFFECTS {8070} 11: ONBOARD PROFILES {8100} Device Mode: Host Onboard Profiles (saved): Disable Onboard Profiles : Disable 12: MOUSE BUTTON SPY {8110} 13: REPORT RATE {8060} Polling Rate (ms): 1 Polling Rate (ms) (saved): 1 Polling Rate (ms) : 1 14: MODE STATUS {8090} 15: DFUCONTROL UNSIGNED {00C1} 16: DFUCONTROL SIGNED {00C2} 17: DEVICE RESET {1802} internal, hidden 18: unknown:1803 {1803} internal, hidden 19: CONFIG DEVICE PROPS {1806} internal, hidden 20: unknown:1813 {1813} internal, hidden 21: OOBSTATE {1805} internal, hidden 22: unknown:1830 {1830} internal, hidden 23: unknown:1890 {1890} internal, hidden 24: unknown:1891 {1891} internal, hidden 25: unknown:1DF3 {1DF3} internal, hidden 26: unknown:1E00 {1E00} hidden 27: unknown:1EB0 {1EB0} internal, hidden 28: unknown:1861 {1861} internal, hidden 29: unknown:18B1 {18B1} internal, hidden 30: unknown:1E22 {1E22} 31: unknown:1801 {1801} internal, hidden 32: ADJUSTABLE DPI {2201} Sensitivity (DPI) (saved): 800 Sensitivity (DPI) : 800 Has 2 reprogrammable keys: 0: Host Switch Channel 1 , default: HostSwitch Channel 1 => HostSwitch Channel 1 divertable, persistently divertable, pos:1, group:0, group mask:empty reporting: default 1: Host Switch Channel 2 , default: HostSwitch Channel 2 => HostSwitch Channel 2 divertable, persistently divertable, pos:2, group:0, group mask:empty reporting: default Battery: 90%, discharging, next level 50%. ```

Is your feature request related to a problem? Please describe. Before I start solaar, my G603 mouse's side buttons operate correctly as "forward" and "back" actions in apps like firefox, nautilus, and vscode. By "correctly" I mean the front button corresponds to forward, and the rear button corresponds to back. Using xev I can see that the front button is recognized as button 9 and the rear button is button 8.

When I start solaar, these buttons become swapped. The front button becomes button 8 and the rear button becomes button 9. Thus, the front button operates as "back" and the rear button operates as "forward" in the aforementioned apps. This persists until I quit solaar and turn my mouse off and on using the power switch.

Perhaps on startup solaar is setting some register on the mouse which flips this setting?

Describe the solution you'd like I would like a way to switch these buttons back to their default functionality in solaar. I'm not sure what form this setting would take, as I don't know how these buttons are getting switched in the first place. Either a toggle switch called "Swap side buttons", or the ability to remap the buttons would be ideal. The solution will depend on what registers/options are supported by the mouse.

Describe alternatives you've considered I only actually need solaar to take control of my keyboard and I don't use any of it's features for the G603 mouse, it's just picked up automatically. So an alternative solution would be to blacklist the mouse and leave it alone, but I'm not sure if that's possible with solaar.

Additional context I'm happy to look into this, but I have no idea where to start debugging HID++ registers in order to work out how to proceed, so a pointer in the right direction would be awesome!

stevegolton commented 2 years ago

Egg-on-face moment. Turns out there already exists a solution for this. Enabling "Onboard Profiles" did the trick - see the screenshot below. image Note: This requires solaar version 1.1.2

pfps commented 2 years ago

It's good that you found a solution, but the behaviour you describe is weird.

What Solaar did is turn off (Disable) your mouse's onboard profiles, which is a complex feature that reprograms the mouse based on information stored in the mouse that can be modified by software. Why onboard profiles should flip the forward and back buttons is a mystery to me.

What used to happen is that Solaar disabled onboard profiles to change the report rate. I expect that you set this feature to 'ignore' because otherwise the back and forward buttons would have flipped. With version 1.1.2 onboard profiles is a separate setting (because there are now two settings that may need it to be disabled).

The only remaining question is why Solaar 1.1.2 wanted to disable onboard profiles. What might have happened is that an older version of Solaar was running without report rate set to ignore (and thus it disabled onboard profiles) and that is the setting value that Solaar 1.1.2 picked up.

stevegolton commented 2 years ago

Thank you very much for the information @pfps.

I can confirm if I set the polling rate to ignored in solaar v1.1.1 and restart the mouse, the side buttons return to the correct orientation. Indeed, it seems that solaar doesn't try to enable onboard profiles with this setting set to ignored. I haven't tried this with solaar v1.1.2.

As to why solaar 1.1.2 wanted to disable onboard profiles, I think your suspicions are correct seeing as I was using v1.1.1 for a while and had tinkered around with just about every setting possible for this mouse before I tried v1.1.2.