sezanzeb / input-remapper

🎮 ⌨ An easy to use tool to change the behaviour of your input devices.
GNU General Public License v3.0
3.89k stars 161 forks source link

key-mapper freezes external usb mouse and keyboard #140

Open spi43984 opened 3 years ago

spi43984 commented 3 years ago

I've been using key-mapper 0.8.0 (on Ubuntu 20.04) to remap keys on an internal notebook keyboard (to swap pos1/end to f11/f12 and back) and (XF86Calculater to control_l+xf86calculator) on an external usb Logitech Craft keyboard (which is connected through an usb hub connectd to a Thunderbolt hub).

Most times this setup works smoothly. But recently when connecting the notebook to the Thunderbolt hub both the external usb keyboard and mouse stop working in gnome. Both mouse and keyboard still work in text console (e.g. ctrl-alt-f3) though. After killing all key-mapper* processes mouse and keyboard start working again. Just disconnecting the Thunderbolt connection doesn't solve the issue.

Updated today to key-mapper version 1.0.0 to see if it helps solving the issue.

If issue still persists with version 1.0.0 I was thinking to change udev rules to reload key-mapper completely.

sezanzeb commented 3 years ago

Both mouse and keyboard still work in text console (e.g. ctrl-alt-f3) though

All issues for which key-mapper somehow magically won't work in an environment are pretty much unsolvable for me, I don't even know how to debug X/Gnome or where to start. Sorry

spi43984 commented 3 years ago

What does key-mapper do when connecting a new input device (like keyboard or mouse)? I do see several key-mapper-* processes and it seems that at some time there is a race condition or a service just hangs - then my input devices hang too and I need to kill all key-mapper services.

I could try to debug that further but would need to understand the dependencies better.

sezanzeb commented 3 years ago

sudo key-mapper-service -d shows verbose debug logs

here is some info on how it works: https://github.com/sezanzeb/key-mapper/blob/main/readme/development.md#how-it-works

sezanzeb commented 3 years ago

There is one process for each hardware device that is being injected for

https://github.com/sezanzeb/key-mapper/tree/main/keymapper/injection

spi43984 commented 3 years ago

I do see three /usr/bin/python3 /usr/bin/key-mapper-service --hide-info -d processes on a notebook with a keyboard, touchpad and one external Bluetooth mouse. Only for the internal keyboard some keys get autoloaded, so I'd expect to see one process instead of three though.

Why is key-mapper-service started by default with -d for debugging? How can it be started without -d? Seems to be hardcoded...

sezanzeb commented 3 years ago

The third process is possibly the SharedDict from https://github.com/sezanzeb/key-mapper/blob/main/keymapper/injection/macros.py#L53

which is used for macros to set and read variables globally across injection processes

spi43984 commented 3 years ago

The third process is possibly the SharedDict from https://github.com/sezanzeb/key-mapper/blob/main/keymapper/injection/macros.py#L53

which is used for macros to set and read variables globally across injection processes

And the second? First is for injections in internal keyboard.

sezanzeb commented 3 years ago

One service that listens on DBus and starts injections (the main service process), one SharedDict and one Injection

spi43984 commented 3 years ago

Why is key-mapper-service started by default with -d for debugging? How can it be started without -d? Seems to be hardcoded...

How can I disable all the logging?

sezanzeb commented 3 years ago

debuglogs are not hardcoded anymore since https://github.com/sezanzeb/key-mapper/commit/b1b88a0a1fb6923bcba8cb301f5ba3de7bccbc6b

as for info logs like Found "Razer Razer Naga Trinity", "Logitech USB Keyboard", there is no way to disable them

spi43984 commented 3 years ago

debuglogs are not hardcoded anymore since b1b88a0

excellent! Thx!

The only thing I am still seeing in syslog, is hundreds of

Jul 22 14:37:25 sp02 gnome-shell[4216]: Window manager warning: Overwriting existing binding of keysym 38 with keysym 38 (keycode 11).

gnome-shell posts this with key-mapper being active and every time injecting a key. It is quite annoying as the syslog gets flooded with every single pressed mapped key.

Any idea how to get rid of that?

There are already bug reports opened without any solutions though. Bug #1857392 and Bug #1920867

spi43984 commented 3 years ago

Issue happend today again. After connecting external Logitech mouse and keyboard to notebook external devices wouldn't work. Killed all key-mapper-* instances and external devices started to work again. There is no injection for the external devices, only the internal keyboard, still key-mapper seems to freeze some times.

Is there any way to gracefully shut down key-mapper when connecting new input devices and start again? Could though do some udev rule but maybe it's easier to be done by key-mapper itself.

sezanzeb commented 3 years ago

Any idea how to get rid of that?

no, I don't know anything about gnome internals, I don't even use gnome, I'm on xfce4 and X11.

Maybe you should actually try if it works better in xfce4, it has generally been much more stable than gnome for me and also has a good reputation for being stable and efficient. It looks ugly out of the box, but can be themed. However, xfce4 doesn't run on wayland, if that should be important to your for any reason. https://xubuntu.org/

Is there any way to gracefully shut down key-mapper when connecting new input devices and start again?

unplugging the device that is being injected for and plugging it back in will stop injections for that particular device, does that work for you?

spi43984 commented 3 years ago

Maybe you should actually try if it works better in xfce4, it has generally been much more stable than gnome for me and also has a good reputation for being stable and efficient. It looks ugly out of the box, but can be themed. However, xfce4 doesn't run on wayland, if that should be important to your for any reason. https://xubuntu.org/

That's unfortunately not an option.

Is there any way to gracefully shut down key-mapper when connecting new input devices and start again?

unplugging the device that is being injected for and plugging it back in will stop injections for that particular device, does that work for you?

No, unplugging doesn't help. Key-mapper-* processes seem to freeze. I need to kill them all, then immediately mouse/keyboard start working again, then I restart key-mapper and everything including key injection works again. As key-mapper waits for new input devices to be connected I thought it might be easy for key-mapper to restart gracefully by itself. If not I'll prepare an udev rule to kill key-mapper and restart it as soon a new external input device gets connected.

sezanzeb commented 3 years ago

The next time stuff freezes up please run sudo evtest and check if new events appear while everything is frozen.

It should output something like:

/dev/input/event25:     key-mapper Razer Razer Naga Trinity forwarded

then select the "key-mapper ... forwarded" device and hit keys that are not mapped. Are events appearing?

sezanzeb commented 3 years ago

Since you already pointed out

Both mouse and keyboard still work in text console (e.g. ctrl-alt-f3) though

it cannot be that key-mapper is frozen. If that still holds true, then I expect events to pop up in evtest. Which would mean the environment (gnome, etc) freezes, not key-mapper.

You can also run key-mapper-control --command hello to check if the dbus daemon is still accepting new messages

spi43984 commented 3 years ago

So, it just now happened. External input devices are frozen.

evtest shows events for both the internal keyboard (with keys being injected) and the external one (without any injection).

key-mapper-control --command hello is answered by

Connected to the service
Daemon answered with "hello"

But still, external keyboard and mouse do not work.

sudo systemctl restart key-mapper.service doesn't help.

Need to kill the key-mapper-* processes to get external keyboard and mouse working again.

sezanzeb commented 3 years ago

so key-mapper is not frozen, it writes events into an uinput like it is supposed to do.

I don't know why it is required to kill the key-mapper-* processes. What does systemctl status key-mapper say after the systemctl restart? I'm not aware of any differences between systemctl stop key-mapper and pkill -f key-mapper

sezanzeb commented 3 years ago

By default, a SIGTERM is sent, followed by 90 seconds of waiting followed by a SIGKILL.

https://stackoverflow.com/a/42979206/4417769

LunNova commented 2 years ago

Similar issues for me intermittently when using a USB KVM switch and disconnecting/connecting input devices.

Log messages when this happens:

<no messages mentioning key-mapper before this point>
Jan 16 07:57:15 lun-kosame-nixos systemd-udevd[727]: input1: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:15 lun-kosame-nixos systemd-udevd[721]: input0: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:15 lun-kosame-nixos systemd-udevd[691]: input2: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:15 lun-kosame-nixos systemd-udevd[712]: input4: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:15 lun-kosame-nixos systemd-udevd[709]: input5: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:15 lun-kosame-nixos systemd-udevd[724]: input3: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:16 lun-kosame-nixos systemd-udevd[712]: input8: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:16 lun-kosame-nixos systemd-udevd[717]: input7: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:16 lun-kosame-nixos key-mapper-service[929]: Found "ELAN1201:00 04F3:3098 Mouse", "Asus WMI hotkeys", "Video Bus", "Sleep Button", "Asus Wireless Radio Control"
Jan 16 07:57:16 lun-kosame-nixos key-mapper-service[929]: Optional `xmodmap` command not found. This is not critical.
Jan 16 07:57:16 lun-kosame-nixos key-mapper-service[929]: This output is also stored in "/var/log/key-mapper"
Jan 16 07:57:16 lun-kosame-nixos key-mapper-service[929]: Logging to "/var/log/key-mapper"
Jan 16 07:57:16 lun-kosame-nixos key-mapper-service[929]: key-mapper-service 1.2.1 2803bb841e19232ec08c57bdfca66d0535131dab https://github.com/sezanzeb/key-mapper
Jan 16 07:57:16 lun-kosame-nixos key-mapper-service[929]: python-evdev 1.4.0
Jan 16 07:57:16 lun-kosame-nixos key-mapper-service[929]: Request to autoload for "ELAN1201:00 04F3:3098 Mouse"
Jan 16 07:57:16 lun-kosame-nixos key-mapper-service[929]: Request to autoload for "ELAN1201:00 04F3:3098 Mouse"
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[717]: input10: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[709]: input9: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[713]: input18: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[716]: input11: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[733]: input15: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[749]: input6: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[714]: input17: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[731]: input12: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[740]: input16: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[739]: input30: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[680]: input29: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[683]: input13: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[724]: input31: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[712]: input14: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[684]: mouse2: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/mouse2' failed with exit code 1.
Jan 16 07:57:17 lun-kosame-nixos key-mapper-service[929]: Request to autoload for "MOSART Semi. 2.4G Keyboard Mouse"
Jan 16 07:57:17 lun-kosame-nixos key-mapper-service[929]: Request to autoload for "Razer Razer Tartarus V2"
Jan 16 07:57:17 lun-kosame-nixos key-mapper-service[929]: Request to autoload for "MOSART Semi. 2.4G Keyboard Mouse"
Jan 16 07:57:17 lun-kosame-nixos key-mapper-service[929]: Request to autoload for "MOSART Semi. 2.4G Keyboard Mouse"
Jan 16 07:57:17 lun-kosame-nixos key-mapper-service[929]: Request to autoload for "MOSART Semi. 2.4G Keyboard Mouse"
Jan 16 07:57:17 lun-kosame-nixos key-mapper-service[929]: Request to autoload for "Razer Razer Tartarus V2"
Jan 16 07:57:17 lun-kosame-nixos key-mapper-service[929]: Request to autoload for "Razer Razer Tartarus V2"
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[713]: mouse4: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/mouse4' failed with exit code 1.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[727]: event9: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event9' failed with exit code 1.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[714]: event10: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event10' failed with exit code 1.
Jan 16 07:57:17 lun-kosame-nixos systemd-udevd[682]: event6: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event6' failed with exit code 1.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[681]: event16: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event16' failed with exit code 1.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[683]: event11: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event11' failed with exit code 1.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[732]: input27: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[686]: input24: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[697]: input25: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[712]: input26: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[728]: input19: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[727]: input21: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[684]: input23: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[683]: input22: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[681]: input20: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[686]: event22: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event22' failed with exit code 1.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[722]: event24: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event24' failed with exit code 1.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[680]: event25: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event25' failed with exit code 1.
Jan 16 07:57:18 lun-kosame-nixos key-mapper-service[929]: Request to autoload for "Asus Keyboard"
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[726]: event23: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event23' failed with exit code 1.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[739]: mouse3: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/mouse3' failed with exit code 1.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[727]: event21: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event21' failed with exit code 1.
Jan 16 07:57:18 lun-kosame-nixos systemd-udevd[680]: input32: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:19 lun-kosame-nixos systemd-udevd[680]: input35: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:19 lun-kosame-nixos systemd-udevd[686]: input34: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device ' failed with exit code 2.
Jan 16 07:57:19 lun-kosame-nixos systemd-udevd[685]: mouse3: Process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/mouse3' failed with exit code 1.
Jan 16 07:58:17 lun-kosame-nixos systemd-udevd[717]: event8: Spawned process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event8' [1809] is taking longer than 59s to complete
Jan 16 07:58:17 lun-kosame-nixos systemd-udevd[709]: event7: Spawned process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event7' [1759] is taking longer than 59s to complete
Jan 16 07:58:19 lun-kosame-nixos systemd-udevd[742]: event19: Spawned process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event19' [2434] is taking longer than 59s to complete
Jan 16 07:58:19 lun-kosame-nixos systemd-udevd[683]: event20: Spawned process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event20' [2432] is taking longer than 59s to complete
Jan 16 07:58:19 lun-kosame-nixos systemd-udevd[681]: event18: Spawned process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event18' [2453] is taking longer than 59s to complete
Jan 16 08:00:17 lun-kosame-nixos systemd-udevd[709]: event7: Spawned process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event7' [1759] timed out after 2min 59s, killing
Jan 16 08:00:19 lun-kosame-nixos systemd-udevd[681]: event18: Spawned process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event18' [2453] timed out after 2min 59s, killing
Jan 16 08:00:19 lun-kosame-nixos systemd-udevd[683]: event20: Spawned process '/nix/store/mfxzvwg6lliaas18la5lk9ck7q8md67d-key-mapper-1.2.1/bin/key-mapper-control --command autoload --device /dev/input/event20' [2432] timed out after 2min 59s, killing
Jan 16 08:18:50 lun-kosame-nixos key-mapper-service[929]: Loaded config from "/home/lun/.config/key-mapper/config.json"
Jan 16 08:18:50 lun-kosame-nixos key-mapper-service[929]: Stopping all injections
Jan 16 08:18:50 lun-kosame-nixos key-mapper-service[929]: Loaded config from "/home/lun/.config/key-mapper/config.json"
Jan 16 08:18:50 lun-kosame-nixos key-mapper-service[929]: Autoloading for all devices
Jan 16 08:18:50 lun-kosame-nixos key-mapper-service[929]: Found "Logitech G604 ", "Asus Keyboard", "Razer Razer Tartarus V2", "MOSART Semi. 2.4G Keyboard Mouse", "ELAN1201:00 04F3:3098 Mouse", "Asus WMI hotkeys", "Video Bus", "Sleep Button", "Asus Wireless Radio Control"
Jan 16 08:18:50 lun-kosame-nixos key-mapper-service[929]: Autoloading for "Razer Razer Tartarus V2"
Jan 16 08:18:50 lun-kosame-nixos key-mapper-service[929]: Loading preset from "/home/lun/.config/key-mapper/presets/Razer Razer Tartarus V2/Default.json"
Jan 16 08:18:50 lun-kosame-nixos key-mapper-service[48731]: Starting injecting the mapping for "Razer Razer Tartarus V2"
Jan 16 08:18:50 lun-kosame-nixos kernel: input: key-mapper Razer Razer Tartarus V2 mapped as /devices/virtual/input/input41
Jan 16 08:18:50 lun-kosame-nixos kernel: input: key-mapper Razer Razer Tartarus V2 forwarded as /devices/virtual/input/input42
Jan 16 08:18:50 lun-kosame-nixos systemd-logind[986]: Watching system buttons on /dev/input/event21 (key-mapper Razer Razer Tartarus V2 forwarded)
Jan 16 08:18:50 lun-kosame-nixos key-mapper-service[48731]: ERROR: Failed to get ABS info of "device /dev/input/event27, name "Razer Razer Tartarus V2", phys "usb-0000:04:00.3-1.4/input1"" for key 0: {0: [0, 1, 2, 3, 4, 20], 1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 113, 114, 115, 116, 117, 119, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 142, 143, 144, 150, 152, 155, 156, 158, 159, 161, 163, 164, 165, 166, 167, 168, 169, 171, 172, 173, 174, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 206, 207, 208, 209, 210, 212, 216, 217, 219, 224, 225, 228, 229, 230, 234, 235, 240, 241, 244, 256, 353, 354, 358, 362, 366, 370, 372, 374, 375, 376, 377, 378, 379, 380, 381, 383, 384, 386, 387, 389, 392, 393, 396, 397, 398, 399, 400, 401, 402, 403, 405, 407, 408, 409, 410, 412, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 439, 442, 576, 577, 578, 579, 580, 581, 582, 583, 585, 592, 593], 2: [6, 12], 3: [(32, AbsInfo(value=0, min=0, max=572, fuzz=0, flat=0, resolution=0)), (40, AbsInfo(value=0, min=0, max=255, fuzz=0, flat=0, resolution=0))], 4: [4]}
Jan 16 08:18:50 lun-kosame-nixos kernel: input: key-mapper Razer Razer Tartarus V2 forwarded as /devices/virtual/input/input43
Jan 16 08:18:50 lun-kosame-nixos systemd-logind[986]: Watching system buttons on /dev/input/event22 (key-mapper Razer Razer Tartarus V2 forwarded)

Need to test again on 1.3.0.

LunNova commented 2 years ago

Doesn't happen if I remove the udev rule for autoload and manually trigger autoload once a few seconds after connecting the device.

spi43984 commented 2 years ago

Doesn't happen if I remove the udev rule for autoload and manually trigger autoload once a few seconds after connecting the device.

Does it work though if you added some delay in the udev rule?

LunNova commented 2 years ago

@spi43984 Not sure how to do this correctly, the udev rules are supposed to run quickly. (and it looks like the current issue might be that they're hanging for ages from the log?)

Start a shell script which then runs input-remappper-control in the background after a delay, and immediately exits so it doesn't delay udev stuff?

sezanzeb commented 2 years ago

Instead of modifying the udev rule, you could also try to add a time.sleep(5) statement in /bin/input-remapper-control before it attempts to autoload

sezanzeb commented 2 years ago

is this still an issue?

spi43984 commented 2 years ago

is this still an issue?

I haven't seen any freezes for quite some time now. The only thing I see are the hundreds of warnings flooding my log:

gnome-shell[4216]: Window manager warning: Overwriting existing binding of keysym