Izurii / Lenovo-Y720-KB-Led-Controller

Controller for the backlight of the Lenovo Legion Y720 keyboard.
GNU General Public License v3.0
50 stars 13 forks source link

Hotkey doesn't work #36

Open mmalisz opened 3 years ago

mmalisz commented 3 years ago

Describe the bug The hotkey is not detected.

To Reproduce Steps to reproduce the behavior:

  1. Open the application
  2. Press FN + Space
  3. The profile hasn't been changed

Expected behavior The profiles are changed.

Desktop (please complete the following information):

My guess is that in this line https://github.com/Izurii/Lenovo-Y720-KB-Led-Controller/blob/master/main.js#L251 the regex should be more precies, as xinput returns:

xinput --list | tee | grep -v "Radio" | grep "ITE.*8910.*keyboard"
    ↳ ITE Tech. Inc. ITE Device(8910) Keyboard  id=11   [slave  keyboard (3)]
    ↳ ITE Tech. Inc. ITE Device(8910) Consumer Control  id=17   [slave  keyboard (3)]

The device with id-11 doesn't catch the Fn + key combinations, whereas the id=17 does.\ Additionally, the xinput --test 17 doesn't detect regular keystrokes and just outputs them.

PS. The README file should state that xinput is required to handle the hotkey.\ I didn't have it installed and just got some errors, however the app itself was working.

Izurii commented 3 years ago

Thank you for the report! I'll be taking a look at the way I handle the hotkey to see where I could improve, as you stated the regex is one of the things that needs to be looked.

About the README, thanks for the advice, I'll be writing the requirements to get the software running.

mesiu84 commented 2 years ago

xinput is only for Xorg, if you use Wayland output is different since it's managed by libinput

Izurii commented 2 years ago

xinput is only for Xorg, if you use Wayland output is different since it's managed by libinput

I'll take note of that.

mmalisz commented 2 years ago

Hi @Izurii,\ the latest release seems to fix the issue with the hotkey, however provided udev rule doesn't work for me.\ I had to replace it with

KERNEL=="event*", SUBSYSTEM=="input", MODE="0666"

The caveat is that it changes the chmod for all of /dev/input/event* devices - setting it to a single one doesn't work, as it changes each reboot...

Izurii commented 2 years ago

@mmalisz That's what I wanted to avoid, I don't wanna change permissions for every input device, until we found something that works correctly I think that's going to be the solution.

Happy to know that the new release worked for you, v2 is really a big release, I changed almost every part of the software, including the way I develop it, one of the most cool things that I did, is writing how I got a hold of lenovo driver to make this software work, you can those out here:

mmalisz commented 2 years ago

@Izurii,\ I've read the Hotkey Monitor README file and remembered about the previous issue with the regex in the JS file.

It seems that my laptop / system treats regular and fn keys as seperate devices.\ Therefore, I've modified the udev rule to:

SUBSYSTEM=="input", ATTRS{name}=="*8910*", MODE="0666"

This works as well, however it also gives access to the pointer device (touchpad?).\ Here's xinput output:

xinput --list | tee | grep -v "Radio" | grep "ITE.*8910"
⎜   ↳ ITE Tech. Inc. ITE Device(8910) Consumer Control  id=13   [slave  pointer  (2)]
    ↳ ITE Tech. Inc. ITE Device(8910) Keyboard  id=12   [slave  keyboard (3)]
    ↳ ITE Tech. Inc. ITE Device(8910) Consumer Control  id=24   [slave  keyboard (3)]

Even though xinput adds the [keyboard] part, adding a keyboard keyword to the rule selects only the xinput's ID=12 device, therefore the wildcard for ID.