input-remapper
input-remapper copied to clipboard
investigate behavior when suspending or hibernating
See https://github.com/sezanzeb/input-remapper/pull/219#issuecomment-988001940,
I think someone mentioned in a blog or something that suspend or whatever doesn't work with input-remapper
- [ ] Does a running injection stop? If yes, do the uinputs disapper? Are errors logged? Anything funny in debug logs?
- [ ] https://github.com/tmclane/jingpad/blob/main/99_jingpad_wakeup would
key-mapper-control --command autoload
without a config dir suffice?
I'm not facing any issues when suspending
I'm not getting hibernate to work on my pc, someone else has to test it
I am experiencing this issue on a S76 Meerkat with Pop!_OS 22.04 LTS installed. Where may I find the kind of logs you'd be interested in?
I also tried adding this file to my /usr/lib/systemd/system-sleep dir, but while it runs, it does not fix the issue:
#!/bin/sh
case "$1" in
suspend|hibernate)
/usr/bin/input-remapper-control --command stop-all
;;
resume|thaw)
/usr/bin/input-remapper-control --command autoload
;;
esac
exit 0
If I then manually run the command in a terminal after waking from sleep, it works just fine. I've tried adding a sleep in there before the command runs with values from 1 to 30 but that didn't work either, so it seems that there is something different about executing the script in the systemd context and executing it as a user.
Try adding timeouts before calling input-remapper-control
As far as I remember this is controlled by the udev rule: https://github.com/sezanzeb/input-remapper/blob/main/data/99-input-remapper.rules. The file contains some information on how to debug udev.
systemctl status input-remapper
might contain some useful information
Some logs can also be found in journalctl -b | grep input-remapper
I have to (re)Apply the preset after resuming from sleep, Fedora 39.
Dec 09 13:09:21 biscoito input-remapper-service[1701]: Request to autoload for "BY Tech Usb Gaming Keyboard"
Dec 09 13:09:21 biscoito input-remapper-service[1701]: Autoloading for "BY Tech Usb Gaming Keyboard"
Dec 09 13:09:21 biscoito input-remapper-service[1701]: Not autoloading the same preset "ck61" again for group "BY Tech Usb Gaming Keyboard"
Dec 09 13:09:22 biscoito input-remapper-service[24737]: Process BY Tech Usb Gaming Keyboard:
Dec 09 13:09:22 biscoito input-remapper-service[24737]: Traceback (most recent call last):
Dec 09 13:09:22 biscoito input-remapper-service[24737]: File "/usr/lib64/python3.12/site-packages/evdev/device.py", line 125, in __init__
Dec 09 13:09:22 biscoito input-remapper-service[24737]: fd = os.open(dev, os.O_RDWR | os.O_NONBLOCK)
Dec 09 13:09:22 biscoito input-remapper-service[24737]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dec 09 13:09:22 biscoito input-remapper-service[24737]: FileNotFoundError: [Errno 2] No such file or directory: '/dev/input/event19'
Dec 09 13:09:22 biscoito input-remapper-service[24737]: During handling of the above exception, another exception occurred:
Dec 09 13:09:22 biscoito input-remapper-service[24737]: Traceback (most recent call last):
Dec 09 13:09:22 biscoito input-remapper-service[24737]: File "/usr/lib64/python3.12/multiprocessing/process.py", line 314, in _bootstrap
Dec 09 13:09:22 biscoito input-remapper-service[24737]: self.run()
Dec 09 13:09:22 biscoito input-remapper-service[24737]: File "/usr/lib/python3.12/site-packages/inputremapper/injection/injector.py", line 414, in run
Dec 09 13:09:22 biscoito input-remapper-service[24737]: forward_devices[device_hash] = self._create_forwarding_device(device)
Dec 09 13:09:22 biscoito input-remapper-service[24737]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dec 09 13:09:22 biscoito input-remapper-service[24737]: File "/usr/lib/python3.12/site-packages/inputremapper/injection/injector.py", line 361, in _create>
Dec 09 13:09:22 biscoito input-remapper-service[24737]: forward_to = evdev.UInput(
Dec 09 13:09:22 biscoito input-remapper-service[24737]: ^^^^^^^^^^^^^
Dec 09 13:09:22 biscoito input-remapper-service[24737]: File "/usr/lib64/python3.12/site-packages/evdev/uinput.py", line 155, in __init__
Dec 09 13:09:22 biscoito input-remapper-service[24737]: self.device = self._find_device()
Dec 09 13:09:22 biscoito input-remapper-service[24737]: ^^^^^^^^^^^^^^^^^^^
Dec 09 13:09:22 biscoito input-remapper-service[24737]: File "/usr/lib64/python3.12/site-packages/evdev/uinput.py", line 282, in _find_device
Dec 09 13:09:22 biscoito input-remapper-service[24737]: d = device.InputDevice(path)
Dec 09 13:09:22 biscoito input-remapper-service[24737]: ^^^^^^^^^^^^^^^^^^^^^^^^
Dec 09 13:09:22 biscoito input-remapper-service[24737]: File "/usr/lib64/python3.12/site-packages/evdev/device.py", line 127, in __init__
Dec 09 13:09:22 biscoito input-remapper-service[24737]: fd = os.open(dev, os.O_RDONLY | os.O_NONBLOCK)
Dec 09 13:09:22 biscoito input-remapper-service[24737]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dec 09 13:09:22 biscoito input-remapper-service[24737]: FileNotFoundError: [Errno 2] No such file or directory: '/dev/input/event19'
currently resorting to this method.
I also have to stop-injection and re-apply after suspension/standby, on Ubuntu.
EDIT: seems to be fixed; autoload wasn't enabled after the device was renamed by switching from USB interface to Bluetooth interface.
$ journalctl -b | grep input-remapper | tail -n30 # after resume from suspend/standby (no hibernation)
Jan 24 15:44:36 mypc systemd-udevd[296977]: input87: Process '/bin/input-remapper-control --command autoload --device ' failed with exit code 2.
Jan 24 15:44:36 mypc input-remapper-service[2247]: Request to autoload for "UniversalFoldableKb Keyboard"
Jan 24 15:44:37 mypc input-remapper-service[2247]: Found "UniversalFoldableKb Keyboard", "MX Anywhere 2S Mouse", "input-remapper mouse", "Extra Buttons", "SynPS/2 Synaptics TouchPad", "Video Bus", "AT Translated Set 2 keyboard", "Sleep Button"
Jan 24 15:46:53 mypc input-remapper-service[2247]: Stopping injecting keycodes for group "MX Anywhere 2S Mouse"
Jan 24 15:46:54 mypc input-remapper.desktop[183001]: Applying preset "MX 2S Mapping" for "MX Anywhere 2S Mouse"
Jan 24 15:46:54 mypc input-remapper-service[2247]: Loaded config from "/home/myuser/.config/input-remapper/config.json"
Jan 24 15:46:54 mypc input-remapper-service[2247]: Found "UniversalFoldableKb Keyboard", "MX Anywhere 2S Mouse", "input-remapper mouse", "Extra Buttons", "SynPS/2 Synaptics TouchPad", "Video Bus", "AT Translated Set 2 keyboard", "Sleep Button"
Jan 24 15:46:54 mypc input-remapper-service[2247]: Loading preset from "/home/myuser/.config/input-remapper/presets/MX Anywhere 2S Mouse/MX 2S Mapping.json"
Jan 24 15:46:54 mypc input-remapper-service[2247]: Stopping injecting keycodes for group "MX Anywhere 2S Mouse"
Jan 24 15:46:54 mypc input-remapper-service[300169]: Starting injecting the mapping for "MX Anywhere 2S Mouse"
Jan 24 15:46:54 mypc kernel: input: input-remapper MX Anywhere 2S Mouse forwarded as /devices/virtual/input/input88
Jan 24 15:46:54 mypc systemd-udevd[300172]: input88: Process '/bin/input-remapper-control --command autoload --device ' failed with exit code 2.
Jan 24 15:46:54 mypc input-remapper.desktop[183001]: Group "MX Anywhere 2S Mouse" is currently mapped
Jan 24 15:46:55 mypc systemd-udevd[300172]: mouse4: Process '/bin/input-remapper-control --command autoload --device /dev/input/mouse4' failed with exit code 1.
Jan 24 15:46:55 mypc systemd-udevd[300176]: event24: Process '/bin/input-remapper-control --command autoload --device /dev/input/event24' failed with exit code 1.
$ journalctl -b | grep input-remapper | tail -n30 # after manually clicking "stop injection" and "apply".
Jan 24 15:52:16 mypc input-remapper-service[2247]: Stopping injecting keycodes for group "MX Anywhere 2S Mouse"
Jan 24 15:52:18 mypc input-remapper.desktop[183001]: Applying preset "MX 2S Mapping" for "MX Anywhere 2S Mouse"
Jan 24 15:52:18 mypc input-remapper-service[2247]: Loaded config from "/home/myuser/.config/input-remapper/config.json"
Jan 24 15:52:18 mypc input-remapper-service[2247]: Found "UniversalFoldableKb Keyboard", "MX Anywhere 2S Mouse", "input-remapper mouse", "Extra Buttons", "SynPS/2 Synaptics TouchPad", "Video Bus", "AT Translated Set 2 keyboard", "Sleep Button"
Jan 24 15:52:18 mypc input-remapper-service[2247]: Loading preset from "/home/myuser/.config/input-remapper/presets/MX Anywhere 2S Mouse/MX 2S Mapping.json"
Jan 24 15:52:18 mypc input-remapper-service[2247]: Stopping injecting keycodes for group "MX Anywhere 2S Mouse"
Jan 24 15:52:18 mypc input-remapper-service[307745]: Starting injecting the mapping for "MX Anywhere 2S Mouse"
Jan 24 15:52:18 mypc kernel: input: input-remapper MX Anywhere 2S Mouse forwarded as /devices/virtual/input/input89
Jan 24 15:52:18 mypc systemd-udevd[307699]: input89: Process '/bin/input-remapper-control --command autoload --device ' failed with exit code 2.
Jan 24 15:52:18 mypc input-remapper.desktop[183001]: Group "MX Anywhere 2S Mouse" is currently mapped
Jan 24 15:52:18 mypc systemd-udevd[307699]: mouse4: Process '/bin/input-remapper-control --command autoload --device /dev/input/mouse4' failed with exit code 1.
Jan 24 15:52:18 mypc systemd-udevd[307749]: event24: Process '/bin/input-remapper-control --command autoload --device /dev/input/event24' failed with exit code 1.
$ systemctl status input-remapper
● input-remapper-daemon.service - Service to inject keycodes without the GUI application
Loaded: loaded (/lib/systemd/system/input-remapper-daemon.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2024-01-18 21:18:58 +0530; 5 days ago
Main PID: 2247 (input-remapper-)
Tasks: 6 (limit: 33328)
Memory: 23.3M
CPU: 34min 7.631s
CGroup: /system.slice/input-remapper-daemon.service
├─ 2247 /usr/bin/python3 /usr/bin/input-remapper-service
├─ 2497 /usr/bin/python3 /usr/bin/input-remapper-service
├─ 9847 /usr/bin/python3 /usr/bin/input-remapper-service
└─307745 /usr/bin/python3 /usr/bin/input-remapper-service
Jan 24 15:46:54 mypc input-remapper-service[2247]: Found "UniversalFoldableKb Keyboard", "MX Anywhere 2S Mouse", "input-remapper mouse", "Extra Buttons", "SynPS/2 Synaptics TouchPad", "Video Bus", "AT Translated Set 2 keyboard", "Sleep Button"
Jan 24 15:46:54 mypc input-remapper-service[2247]: Loading preset from "/home/myuser/.config/input-remapper/presets/MX Anywhere 2S Mouse/MX 2S Mapping.json"
Jan 24 15:46:54 mypc input-remapper-service[2247]: Stopping injecting keycodes for group "MX Anywhere 2S Mouse"
Jan 24 15:46:54 mypc input-remapper-service[300169]: Starting injecting the mapping for "MX Anywhere 2S Mouse"
Jan 24 15:52:16 mypc input-remapper-service[2247]: Stopping injecting keycodes for group "MX Anywhere 2S Mouse"
Jan 24 15:52:18 mypc input-remapper-service[2247]: Loaded config from "/home/myuser/.config/input-remapper/config.json"
Jan 24 15:52:18 mypc input-remapper-service[2247]: Found "UniversalFoldableKb Keyboard", "MX Anywhere 2S Mouse", "input-remapper mouse", "Extra Buttons", "SynPS/2 Synaptics TouchPad", "Video Bus", "AT Translated Set 2 keyboard", "Sleep Button"
Jan 24 15:52:18 mypc input-remapper-service[2247]: Loading preset from "/home/myuser/.config/input-remapper/presets/MX Anywhere 2S Mouse/MX 2S Mapping.json"
Jan 24 15:52:18 mypc input-remapper-service[2247]: Stopping injecting keycodes for group "MX Anywhere 2S Mouse"
Jan 24 15:52:18 mypc input-remapper-service[307745]: Starting injecting the mapping for "MX Anywhere 2S Mouse"
Issue is on the MX Anywhere 2S mouse, used via Bluetooth (because, somehow, the usb dongle isn't recognized anymore and had no time to figure out a fix).