pwr-Solaar / Solaar

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

G-key keypress when keyboard is asleep does not get diverted #1462

Closed Hubro closed 2 years ago

Hubro commented 2 years ago

Information

``` ➜ solaar show Solaar version 1.1.1 Unifying Receiver Device path : /dev/hidraw3 USB id : 046d:C52B Serial : D8C3B659 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: (empty) 1: MX Keys Keyboard Device path : /dev/hidraw6 WPID : 408A Codename : MX Keys Kind : keyboard Protocol : HID++ 4.5 Polling rate : 20 ms (50Hz) Serial number: 97624246 The power switch is located on the edge of top right corner. Battery: unknown (device is offline). Unifying Receiver Device path : /dev/hidraw13 USB id : 046d:C52B Serial : A7599671 Firmware : 24.01.B0023 Bootloader : 01.08 Other : AA.AC Has 1 paired device(s) out of a maximum of 6. Notifications: wireless, software present (0x000900) Device activity counters: (empty) 1: Wireless Touch Keyboard K400 Plus Device path : /dev/hidraw14 WPID : 404D Codename : K400 Plus Kind : keyboard Protocol : HID++ 2.0 Polling rate : 8 ms (125Hz) Serial number: 23C01660 The power switch is located on the top edge. Battery: unknown (device is offline). Lightspeed Receiver Device path : /dev/hidraw19 USB id : 046d:C541 Serial : 1E6F6B7F Firmware : 01.02.B0028 Bootloader : 01.27 Other : A6.FD Has 1 paired device(s) out of a maximum of 2. Notifications: wireless, software present (0x000900) Device activity counters: 1=216 1: G915 WIRELESS RGB MECHANICAL GAMING KEYBOARD Device path : None WPID : 407C Codename : G915 KEYBOARD Kind : keyboard Protocol : HID++ 4.2 Polling rate : 8 ms (125Hz) Serial number: 460DF756 Model ID: B354407CC33E Unit ID: 460DF756 Bootloader: BOT 77.02.B0039 Other: Firmware: MPK 09.03.B0041 Other: Other: The power switch is located on the top left corner. Supports 38 HID++ 2.0 features: 0: ROOT {0000} 1: FEATURE SET {0001} 2: DEVICE FW VERSION {0003} Firmware: Bootloader BOT 77.02.B0039 0000EC44D534 Firmware: Other Firmware: Firmware MPK 09.03.B0041 407C3791543D Firmware: Other Firmware: Other Unit ID: 460DF756 Model ID: B354407CC33E Transport IDs: {'btleid': 'B354', 'wpid': '407C', 'usbid': 'C33E'} 3: DEVICE NAME {0005} Name: G915 WIRELESS RGB MECHANICAL GAMING KEYBOARD Kind: keyboard 4: WIRELESS DEVICE STATUS {1D4B} 5: RESET {0020} 6: DEVICE FRIENDLY NAME {0007} Friendly Name: G915 KEYBOARD 7: BATTERY VOLTAGE {1001} Battery: 3869mV, discharging, 60. 8: CHANGE HOST {1814} Change Host : 1:aura 9: HOSTS INFO {1815} Host 0 (paired): aura Host 1 (paired): 10: RGB EFFECTS {8071} 11: PER KEY LIGHTING V2 {8081} 12: REPROG CONTROLS V4 {1B04} Key/Button Diversion (saved): {'209': 0, '210': 0} Key/Button Diversion : {'209': 0, '210': 0} 13: REPORT HID USAGE {1BC0} 14: ENCRYPTION {4100} 15: KEYBOARD DISABLE BY USAGE {4522} 16: KEYBOARD LAYOUT 2 {4540} 17: GKEY {8010} Divert G Keys (saved): True Divert G Keys : False 18: MKEYS {8020} 19: MR {8030} 20: BRIGHTNESS CONTROL {8040} 21: ONBOARD PROFILES {8100} Device Mode: On-Board 22: REPORT RATE {8060} Polling Rate (ms): 1 Polling Rate (ms) (saved): 1 Polling Rate (ms) : 1 23: DFUCONTROL SIGNED {00C2} 24: DFU {00D0} 25: DEVICE RESET {1802} internal, hidden 26: unknown:1803 {1803} internal, hidden 27: CONFIG DEVICE PROPS {1806} internal, hidden 28: unknown:1813 {1813} internal, hidden 29: OOBSTATE {1805} internal, hidden 30: unknown:1830 {1830} internal, hidden 31: unknown:1890 {1890} internal, hidden 32: unknown:1891 {1891} internal, hidden 33: unknown:18A1 {18A1} internal, hidden 34: unknown:1E00 {1E00} hidden 35: unknown:1EB0 {1EB0} internal, hidden 36: unknown:1861 {1861} internal, hidden 37: unknown:18B0 {18B0} internal, hidden 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: 3869mV, discharging, 60. Lightspeed Receiver Device path : /dev/hidraw5 USB id : 046d:C539 Serial : EDC69B5D Firmware : 39.05.B0040 Bootloader : 01.08 Other : AA.BE Has 1 paired device(s) out of a maximum of 1. Notifications: wireless, software present (0x000900) Device activity counters: (empty) 1: G900 Chaos Spectrum Gaming Mouse Device path : /dev/hidraw7 WPID : 4053 Codename : G900 Kind : mouse Protocol : HID++ 4.2 Polling rate : 8 ms (125Hz) Serial number: 5BFEBB5F Model ID: C08100000000 Unit ID: 5BFEBB5F Firmware: MPM 01.05.B0023 Bootloader: BOT 20.02.B0020 Other: The power switch is located on the base. Supports 25 HID++ 2.0 features: 0: ROOT {0000} 1: FEATURE SET {0001} 2: DEVICE FW VERSION {0003} Firmware: Firmware MPM 01.05.B0023 C081 Firmware: Bootloader BOT 20.02.B0020 AABA Firmware: Other Unit ID: 5BFEBB5F Model ID: C08100000000 Transport IDs: {'usbid': 'C081'} 3: DEVICE NAME {0005} Name: Gaming Mouse G900 Kind: mouse 4: BATTERY VOLTAGE {1001} Battery: 3721mV, discharging, 20. 5: unknown:1863 {1863} internal, hidden 6: unknown:18A1 {18A1} internal, hidden 7: unknown:1E00 {1E00} hidden 8: unknown:1E20 {1E20} 9: unknown:1EB0 {1EB0} internal, hidden 10: ADJUSTABLE DPI {2201} Sensitivity (DPI) (saved): 1000 Sensitivity (DPI) : 1000 11: ANGLE SNAPPING {2230} 12: SURFACE TUNING {2240} 13: REPORT RATE {8060} Polling Rate (ms): 2 Polling Rate (ms) (saved): 2 Polling Rate (ms) : 2 14: ONBOARD PROFILES {8100} Device Mode: Host 15: MOUSE BUTTON SPY {8110} 16: unknown:1850 {1850} internal, hidden 17: DFUCONTROL SIGNED {00C2} 18: unknown:1801 {1801} internal, hidden 19: DEVICE RESET {1802} internal, hidden 20: unknown:1890 {1890} internal, hidden 21: unknown:1811 {1811} internal, hidden 22: LATENCY MONITORING {8111} 23: COLOR LED EFFECTS {8070} 24: LED CONTROL {1300} Battery: 3721mV, discharging, 20. Lightspeed Receiver Device path : /dev/hidraw10 USB id : 046d:C545 Serial : B745659B Firmware : 02.01.B0006 Bootloader : 00.01 Other : 90.2A Has 1 paired device(s) out of a maximum of 2. Notifications: wireless, software present (0x000900) Device activity counters: 1=230 1: G915 TKL LIGHTSPEED Wireless RGB Mechanical Gaming Keyboard Device path : None WPID : 408E Codename : G915 TKL Kind : keyboard Protocol : HID++ 4.2 Polling rate : 8 ms (125Hz) Serial number: E39C9BCF Model ID: B35F408EC343 Unit ID: E39C9BCF Bootloader: BL1 12.00.B0017 Other: Firmware: MPK 14.01.B0021 Other: Other: The power switch is located on the top left corner. Supports 38 HID++ 2.0 features: 0: ROOT {0000} 1: FEATURE SET {0001} 2: DEVICE FW VERSION {0003} Firmware: Bootloader BL1 12.00.B0017 00008B79E978 Firmware: Other Firmware: Firmware MPK 14.01.B0021 408E5E599E54 Firmware: Other Firmware: Other Unit ID: E39C9BCF Model ID: B35F408EC343 Transport IDs: {'btleid': 'B35F', 'wpid': '408E', 'usbid': 'C343'} 3: DEVICE NAME {0005} Name: G915 TKL LIGHTSPEED Wireless RGB Mechanical Gaming Keyboard Kind: keyboard 4: WIRELESS DEVICE STATUS {1D4B} 5: RESET {0020} 6: DEVICE FRIENDLY NAME {0007} Friendly Name: G915 TKL 7: BATTERY VOLTAGE {1001} Battery: 4142mV, full, 90. 8: CHANGE HOST {1814} Change Host : 1:aura 9: HOSTS INFO {1815} Host 0 (paired): aura Host 1 (unpaired): 10: RGB EFFECTS {8071} 11: PER KEY LIGHTING V2 {8081} 12: REPROG CONTROLS V4 {1B04} Key/Button Diversion (saved): {'209': 0, '210': 0} Key/Button Diversion : {'209': 0, '210': 0} 13: REPORT HID USAGE {1BC0} 14: ENCRYPTION {4100} 15: KEYBOARD DISABLE BY USAGE {4522} 16: KEYBOARD LAYOUT 2 {4540} 17: GKEY {8010} Divert G Keys (saved): False Divert G Keys : False 18: MKEYS {8020} 19: MR {8030} 20: BRIGHTNESS CONTROL {8040} 21: ONBOARD PROFILES {8100} Device Mode: On-Board 22: REPORT RATE {8060} Polling Rate (ms): 1 23: DFUCONTROL SIGNED {00C2} 24: DFU {00D0} 25: DEVICE RESET {1802} internal, hidden 26: unknown:1803 {1803} internal, hidden 27: CONFIG DEVICE PROPS {1806} internal, hidden 28: unknown:1813 {1813} internal, hidden 29: OOBSTATE {1805} internal, hidden 30: unknown:1830 {1830} internal, hidden 31: unknown:1890 {1890} internal, hidden 32: unknown:1891 {1891} internal, hidden 33: unknown:18A1 {18A1} internal, hidden 34: unknown:1E00 {1E00} hidden 35: unknown:1EB0 {1EB0} internal, hidden 36: unknown:1861 {1861} internal, hidden 37: unknown:18B0 {18B0} internal, hidden 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: 4142mV, full, 90. ```

Describe the bug

I have enabled "Divert G Keys" and set up a rule on G5 to toggle mute on Microsoft Teams on key-down and key-up, giving me a push-to-talk key. By default, the G5 key just maps to F5.

The rule on G5 works perfectly as a push to talk key, but what keeps happening is that when I've been silent for a while and I press G5 to talk, my Microsoft Teams window reloads, kicking me out of the call.

After this happened a few times I realized it's because the keyboard falls asleep (i.e. the backlights turned off and the keyboard entry in the Solaar GUI turns grey). If I press any of the G keys at this point, their default mapping is executed instead of my custom rules. After the keyboard turns on and appears as connected in the Solaar GUI, my custom rules now work as intended.

To Reproduce Steps to reproduce the behavior:

  1. Set up a rule on a diverted G key on a wireless Logitech keyboard
  2. Let the keyboard fall asleep due to inactivity
  3. Press your G key with the custom rule
  4. Your rule was not executed, instead the default mapping of the keyboard happened

Screenshots

Additional context I am using the "G915 KEYBOARD".

pfps commented 2 years ago

This appears to be unavoidable. When a device is sleeps it forgets the changes that have been made to it such as diversions. When a key is pressed in the sleeping state this wakes the device up but there is no chance to apply the changes before the key press is processed by the device.

As a workaround, you could try pressing some benign key first, like shift, and then waiting for a bit for Solaar to apply the diversion.

Hubro commented 2 years ago

As a workaround, you could try pressing some benign key first, like shift, and then waiting for a bit for Solaar to apply the diversion.

That's what I'm doing, but it's easy to forget since the keyboard falls asleep relatively quickly.

Does this behavior also happen on Windows with G-Suite? Seems strange that it should be impossible to avoid. :confused:


As a sidenote, I often use my keyboard plugged in, just so I don't have to remember to charge them. I primarily bought a wireless keyboard to make it easier to clean the desk, as I can just unplug the keyboard and move it away. It's also a bonus that I only need to plug the keyboard into a charger, not necessarily the computer.

As a result, it feels pretty pointless for the keyboard to fall asleep so quickly. Is there any way to extend or disable the sleep timer on the wireless keyboards?

pfps commented 2 years ago

Agreed. I am not aware of any way to extend the time before the keyboard sleeps.

It may be that the M keys are always "diverted" (even though the Solaar documentation hints otherwise). Try creating a rule for an M key and see whether this is triggered when the key is pressed while the keyboard is asleep.

pfps commented 2 years ago

It appears that the M keys are diverted by the G-key diversion and thus will also "misbehave" when the device is sleeping.