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

Backlight setting from Rules Actions does not work for MX Keys Mini #2127

Closed sidevesh closed 1 year ago

sidevesh commented 1 year ago

Information

``` solaar version 1.1.9 Bolt Receiver Device path : /dev/hidraw11 USB id : 046d:C548 Serial : 45453134364637443541353133313941 Has 2 paired device(s) out of a maximum of 6. Notifications: wireless (0x000100) Device activity counters: 1=80, 2=216 1: MX Master 3S Device path : None WPID : B034 Codename : MX Master 3S Kind : mouse Protocol : HID++ 4.5 Serial number: 05965733 Model ID: B03400000000 Unit ID: 05965733 Bootloader: BL1 69.00.B0003 Firmware: RBM 22.00.B0003 Other: The power switch is located on the (unknown). Supports 36 HID++ 2.0 features: 0: ROOT {0000} V0 1: FEATURE SET {0001} V0 2: DEVICE FW VERSION {0003} V4 Firmware: Bootloader BL1 69.00.B0003 B03438FCA4E6 Firmware: Firmware RBM 22.00.B0003 B03438FCA4E6 Firmware: Other Unit ID: 05965733 Model ID: B03400000000 Transport IDs: {'btleid': 'B034'} 3: DEVICE NAME {0005} V0 Name: MX Master 3S 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: MX Master 3S 8: UNIFIED BATTERY {1004} V3 Battery: 90%, discharging. 9: REPROG CONTROLS V4 {1B04} V5 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, Mouse Gesture Button:Gesture Button Navigation, Smart Shift:Smart Shift} 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, Mouse Gesture Button:Gesture Button Navigation, Smart Shift:Smart Shift} Key/Button Diversion (saved): {Middle Button:Diverted, Back Button:Regular, Forward Button:Regular, Mouse Gesture Button:Mouse Gestures, Smart Shift:Mouse Gestures} Key/Button Diversion : {Middle Button:Diverted, Back Button:Regular, Forward Button:Regular, Mouse Gesture Button:Diverted, Smart Shift:Diverted} 10: CHANGE HOST {1814} V1 Change Host : 2:Lenovo-Yoga-7 11: HOSTS INFO {1815} V2 Host 0 (paired): SWAPNILS-PC Host 1 (paired): Lenovo-Yoga-7 Host 2 (paired): Meta Quest 2 12: XY STATS {2250} V1 13: ADJUSTABLE DPI {2201} V2 Sensitivity (DPI) (saved): 1000 Sensitivity (DPI) : 1000 14: SMART SHIFT {2110} V0 Scroll Wheel Ratcheted (saved): Ratcheted Scroll Wheel Ratcheted : Ratcheted Scroll Wheel Ratchet Speed (saved): 25 Scroll Wheel Ratchet Speed : 25 15: HIRES WHEEL {2121} V1 Multiplier: 15 Has invert: Normal wheel motion Has ratchet switch: Normal wheel mode Low resolution mode HID notification Scroll Wheel Direction (saved): False Scroll Wheel Direction : False Scroll Wheel Resolution (saved): False Scroll Wheel Resolution : False Scroll Wheel Diversion (saved): False Scroll Wheel Diversion : False 16: THUMB WHEEL {2150} V0 Thumb Wheel Direction (saved): False Thumb Wheel Direction : False Thumb Wheel Diversion (saved): True Thumb Wheel Diversion : True 17: WHEEL STATS {2251} V0 18: DFUCONTROL {00C3} V0 19: DEVICE RESET {1802} V0 internal, hidden, unknown:000010 20: unknown:1803 {1803} V0 internal, hidden, unknown:000010 21: CONFIG DEVICE PROPS {1806} V8 internal, hidden, unknown:000010 22: unknown:1816 {1816} V0 internal, hidden, unknown:000010 23: OOBSTATE {1805} V0 internal, hidden 24: unknown:1830 {1830} V0 internal, hidden, unknown:000010 25: unknown:1891 {1891} V7 internal, hidden, unknown:000008 26: unknown:18A1 {18A1} V0 internal, hidden, unknown:000010 27: unknown:1E00 {1E00} V0 hidden 28: unknown:1E02 {1E02} V0 internal, hidden 29: unknown:1602 {1602} V0 30: unknown:1EB0 {1EB0} V0 internal, hidden, unknown:000010 31: unknown:1861 {1861} V1 internal, hidden, unknown:000010 32: unknown:9300 {9300} V0 internal, hidden, unknown:000010 33: unknown:9001 {9001} V0 internal, hidden, unknown:000010 34: unknown:1E22 {1E22} V0 internal, hidden, unknown:000010 35: unknown:9205 {9205} V0 internal, hidden, unknown:000010 Has 8 reprogrammable keys: 0: Left Button , default: Left Click => Left Click mse, analytics key events, pos:0, group:1, group mask:g1 reporting: default 1: Right Button , default: Right Click => Right Click mse, 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, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2 reporting: diverted 3: Back Button , default: Mouse Back Button => Mouse Back Button mse, reprogrammable, divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2 reporting: default 4: Forward Button , default: Mouse Forward Button => Mouse Forward Button mse, reprogrammable, divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2 reporting: default 5: Mouse Gesture Button , default: Gesture Button Navigation => Gesture Button Navigation mse, reprogrammable, divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2 reporting: diverted, raw XY diverted 6: Smart Shift , default: Smart Shift => Smart Shift mse, reprogrammable, divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2 reporting: diverted, raw XY diverted 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 Battery: 90%, discharging. 2: MX Keys Mini Device path : None WPID : B369 Codename : MX Keys Mini Kind : keyboard Protocol : HID++ 4.5 Serial number: 45215CFE Model ID: B36900000000 Unit ID: 45215CFE Bootloader: BL1 53.01.B0006 Firmware: RBK 73.01.B0006 Other: The power switch is located on the (unknown). Supports 32 HID++ 2.0 features: 0: ROOT {0000} V0 1: FEATURE SET {0001} V0 2: DEVICE FW VERSION {0003} V4 Firmware: Bootloader BL1 53.01.B0006 B369FD70F4 Firmware: Firmware RBK 73.01.B0006 B369FD70F4 Firmware: Other Unit ID: 45215CFE Model ID: B36900000000 Transport IDs: {'btleid': 'B369'} 3: DEVICE NAME {0005} V0 Name: MX Keys Mini Kind: keyboard 4: WIRELESS DEVICE STATUS {1D4B} V0 5: CONFIG CHANGE {0020} V0 6: DEVICE FRIENDLY NAME {0007} V0 Friendly Name: MX Keys Mini 7: UNIFIED BATTERY {1004} V2 Battery: 80%, discharging. 8: REPROG CONTROLS V4 {1B04} V5 Key/Button Diversion (saved): {Backlight Down:Regular, Backlight Up:Regular, Play/Pause Fn:Regular, Mute Fn:Regular, Volume Down Fn:Regular, Volume Up Fn:Regular, Voice Dictation:Regular, Open Emoji Panel:Regular, Snipping Tool:Regular, Delete:Regular, Mute Microphone:Diverted} Key/Button Diversion : {Backlight Down:Regular, Backlight Up:Regular, Play/Pause Fn:Regular, Mute Fn:Regular, Volume Down Fn:Regular, Volume Up Fn:Regular, Voice Dictation:Regular, Open Emoji Panel:Regular, Snipping Tool:Regular, Delete:Regular, Mute Microphone:Diverted} 9: CHANGE HOST {1814} V1 Change Host : 2:Lenovo-Yoga-7 10: HOSTS INFO {1815} V1 Host 0 (paired): SWAPNILS-PC Host 1 (paired): Lenovo-Yoga-7 Host 2 (paired): Meta Quest 2 11: BACKLIGHT2 {1982} V1 Backlight (saved): True Backlight : True 12: K375S FN INVERSION {40A3} V0 Swap Fx function (saved): True Swap Fx function : True 13: LOCK KEY STATE {4220} V0 14: KEYBOARD DISABLE KEYS {4521} V0 Disable keys (saved): {Caps Lock:False, Insert:False, Win:False} Disable keys : {Caps Lock:False, Insert:False, Win:False} 15: MULTIPLATFORM {4531} V1 Set OS (saved): Windows Set OS : Windows 16: DFUCONTROL {00C3} V0 17: DEVICE RESET {1802} V0 internal, hidden, unknown:000010 18: unknown:1803 {1803} V0 internal, hidden, unknown:000010 19: CONFIG DEVICE PROPS {1806} V8 internal, hidden, unknown:000010 20: unknown:1816 {1816} V0 internal, hidden, unknown:000010 21: OOBSTATE {1805} V0 internal, hidden 22: unknown:1830 {1830} V0 internal, hidden, unknown:000010 23: unknown:1891 {1891} V6 internal, hidden, unknown:000008 24: unknown:18A1 {18A1} V0 internal, hidden, unknown:000010 25: unknown:1E00 {1E00} V0 hidden 26: unknown:1E02 {1E02} V0 internal, hidden 27: unknown:1602 {1602} V0 28: unknown:1EB0 {1EB0} V0 internal, hidden, unknown:000010 29: unknown:1861 {1861} V0 internal, hidden, unknown:000010 30: unknown:1A20 {1A20} V0 internal, hidden, unknown:000010 31: unknown:18B0 {18B0} V0 internal, hidden, unknown:000010 Has 16 reprogrammable keys: 0: Host Switch Channel 1 , default: HostSwitch Channel 1 => HostSwitch Channel 1 is FN, FN sensitive, analytics key events, pos:1, group:0, group mask:empty reporting: default 1: Host Switch Channel 2 , default: HostSwitch Channel 2 => HostSwitch Channel 2 is FN, FN sensitive, analytics key events, pos:2, group:0, group mask:empty reporting: default 2: Host Switch Channel 3 , default: HostSwitch Channel 3 => HostSwitch Channel 3 is FN, FN sensitive, analytics key events, pos:3, group:0, group mask:empty reporting: default 3: Backlight Down , default: Backlight Down => Backlight Down is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:4, group:0, group mask:empty reporting: default 4: Backlight Up , default: Backlight Up => Backlight Up is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:5, group:0, group mask:empty reporting: default 5: Voice Dictation , default: Voice Dictation => Voice Dictation is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:6, group:0, group mask:empty reporting: default 6: Open Emoji Panel , default: Open Emoji Panel => Open Emoji Panel is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:7, group:0, group mask:empty reporting: default 7: Snipping Tool , default: Snipping Tool => Snipping Tool is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:8, group:0, group mask:empty reporting: default 8: Mute Microphone , default: Mute Microphone => Mute Microphone is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:9, group:0, group mask:empty reporting: diverted 9: Play/Pause Fn , default: Play/Pause => Play/Pause is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:10, group:0, group mask:empty reporting: default 10: Mute Fn , default: Mute => Mute is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:11, group:0, group mask:empty reporting: default 11: Volume Down Fn , default: Volume Down => Volume Down is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:12, group:0, group mask:empty reporting: default 12: Volume Up Fn , default: Volume Up => Volume Up nonstandard, reprogrammable, divertable, analytics key events, pos:13, group:0, group mask:empty reporting: default 13: Delete , default: Delete => Delete nonstandard, reprogrammable, divertable, analytics key events, pos:14, group:0, group mask:empty reporting: default 14: F Lock , default: Do Nothing One => Do Nothing One is FN, analytics key events, pos:0, group:0, group mask:empty reporting: default 15: FN Key , default: Do Nothing One => Do Nothing One nonstandard, analytics key events, pos:0, group:0, group mask:empty reporting: default Battery: 80%, discharging. ```
``` - 1.1.9 - _NAME: MX Keys Mini _absent: [hi-res-scroll, lowres-scroll-mode, hires-smooth-invert, hires-smooth-resolution, hires-scroll-mode, scroll-ratchet, smart-shift, thumb-scroll-invert, thumb-scroll-mode, onboard_profiles, report_rate, pointer_speed, dpi, speed-change, backlight-timed, reprogrammable-keys, persistent-remappable-keys, crown-smooth, divert-crown, divert-gkeys, m-key-leds, mr-key-led, gesture2-gestures, gesture2-divert, gesture2-params, sidetone, equalizer, adc_power_management] _battery: 4100 _modelId: B36900000000 _sensitive: {backlight: false, change-host: false, divert-keys: false} _serial: 45215CFE _unitId: 45215CFE _wpid: B369 backlight: true change-host: null disable-keyboard-keys: {1: false, 8: false, 16: false} divert-keys: {226: 0, 227: 0, 229: 0, 231: 0, 232: 0, 233: 0, 259: 0, 264: 0, 266: 0, 279: 0, 284: 1} fn-swap: true multiplatform: 0 - _NAME: MX Master 3S _absent: [hi-res-scroll, lowres-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, gesture2-gestures, gesture2-divert, gesture2-params, sidetone, equalizer, adc_power_management] _battery: 4100 _modelId: B03400000000 _sensitive: {change-host: false, divert-keys: false, dpi: false, hires-smooth-resolution: false, reprogrammable-keys: false, scroll-ratchet: false, smart-shift: false, thumb-scroll-invert: false, thumb-scroll-mode: false} _serial: 05965733 _unitId: 05965733 _wpid: B034 change-host: null divert-keys: {82: 1, 83: 0, 86: 0, 195: 2, 196: 2} dpi: 1000 hires-scroll-mode: false hires-smooth-invert: false hires-smooth-resolution: false reprogrammable-keys: {80: 80, 81: 81, 82: 82, 83: 83, 86: 86, 195: 195, 196: 196} scroll-ratchet: 2 smart-shift: 25 thumb-scroll-invert: false thumb-scroll-mode: true ```

Describe the bug Setting the backlight to any value using the Backlight setting in Rules Actions, either of the two Backlight options (one that sets a numeric value and the other that sets On Off Toggle) does not do anything. Seems like reading the Backlight value works though as Condition.

pfps commented 1 year ago

Can you control the backlight from the GUI? You should have a backlight setting there.

If so, please provide output of solaar -ddd as a rule that changes the backlight runs.

Also provide the contents of your rule file ~/.config/solaar/rules.yaml

pfps commented 1 year ago

I agree that it isn' t great that there are two choices with the same name. You want the one that matches the choices in the GUI - in your case the one that takes a toggle.

sidevesh commented 1 year ago

I can control it from the GUI, its only a toggle for me though, does that mean I can only ON OFF TOGGLE the backlight for this keyboard but not adjust the illumination level ? The Backlight Up and Down keys on this keyboard do control the backlight level with 8 steps in total from 0 to highest brightness.

sidevesh commented 1 year ago

My bad, looks like the Set -> Backlight action that has ON OFF and TOGGLE does work. I guess then my issue is why and is it possible for the illumination level control to be available for this keyboard ?

pfps commented 1 year ago

The interface to the backlight does not allow software to set levels. Why this is the case is unknown to me.

sidevesh commented 1 year ago

Ah okay, thanks for the help in debugging this, my usecase was to show some kind of notification when the backlight level changes, is it possible to be notified / do some action when backlight level changes ? or is the interface unaware when backlight level changes happen ?

sidevesh commented 1 year ago

Also, closing this

pfps commented 1 year ago

Solaar sees a notification (event) when the backlight changes. To see documentation on the event you can look at the file x1982_backlight_v2.pdf in https://drive.google.com/drive/folders/0BxbRzx7vEV7eWmgwazJ3NUFfQ28?resourcekey=0-dQ-Lx1FORQl0KAdOHQaE1A You will have to read and understand the Solaar rules documentation for the TestBytes rule condition and use it to check what the new level is. Start with a Feature condition to check for backlight notifications, then a Report condition for the report number (0), and then grab the level byte.

sidevesh commented 1 year ago

Figured it out! Thanks for pointing me in the right direction, gotta say, every time I think up something with these Logitech devices that is clearly impossible with official software and has to be impossible to achieve even otherwise, Solaar seems to always have a way to make things work. I keep using and buying Logitech hardware solely because of this project, and thanks again for all your work on this project @pfps !

This is what I was trying to achieve btw, having gnome's native osd show up for backlight changes just like the built in keyboard of a laptop:

https://github.com/pwr-Solaar/Solaar/assets/17254413/9c1174e6-b571-4bd0-b3fa-4baf1a466dc3

DanishFayaz commented 1 year ago

@sidevesh How did you connect mx keys mini to solaar. I have a unifying receiver that I got with the mx master 3 and I am able to connect both master 3 and keys mini on windows but it doesn't work on solaar on ubuntu 20.04 lts. It detects my master 3 under unifying receiver but it doesn't detect my mx keys mini.

pfps commented 1 year ago

@DanishFayaz What version of Solaar are you running?

DanishFayaz commented 1 year ago

It's the latest version. Got it from apt

pfps commented 1 year ago

Which version number?