Open SamuelBorn opened 9 months ago
Same issue here using MX Master 3s on a Lenovo Flex but it tends to happen when the laptop is left unattended for a while. Not sure if it's related to the laptop going into some "sleep" state (don´t think so as I have configured it not to but the laptop's screen still goes dark) or the mouse going to sleep.
I can recover from the issue by executing the following command: systemctl restart input-remapper.service && input-remapper-control --command autoload
Same here with the MX Master 3 connected via Bluetooth. Service says:
input-remapper-service[17283]: ERROR: fd broke, was the device unplugged?
input-remapper-service[17283]: read loop for /dev/input/event13 stopped
Version:
input-remapper 2.0.0 9e04df79ca4dca77516a9864d740b9b2d4aef788 https://github.com/sezanzeb/input-remapper
python-evdev 1.4.0
Using Ubuntu 22.04 LTS.
I can recover from the issue by executing the following command:
systemctl restart input-remapper.service && input-remapper-control --command autoload
For me just input-remapper-control --command autoload
works too
Adding a quote of my comment on a possibly related issue as it might help with yours.
This is definitely not the Right Way (tm) to do this, but it works for my use case with a single bluetooth device being remapped and input-remapper sometimes failing on reconnect. If you have multiple devices being remapped, this will cause an interruption whenever a device disconnects. Also, it's quite hacky as I didn't spend a lot of time learning the codebase
¯\_(ツ)_/¯
I updated
inputremapper/injection/event_reader.py
to sendstop_all
andautoload
commands to the daemon upon device disconnect. Here's the diff with added lines identified with +'s, surrounding lines (without "+") are provided for context:# Added lines for inputremapper/injection/event_reader.py # ---------------- import daemon methods ---------------- from inputremapper.input_event import InputEvent from inputremapper.logger import logger +# Load daemon methods to send commands upon device disconnect +import inputremapper.daemon as ir_daemon + class Context(Protocol): # ---------------- send `stop_all` and `autoload` to daemon ---------------- loop.remove_reader(self._source.fileno()) logger.debug("read loop stopped") + # Connect to daemon and send "stop_all" and "autoload" commands + daemon = ir_daemon.Daemon.connect() + await daemon.send_stop_all() + await daemon.send_autoload() return events_ready.clear()
Modified
event_reader.py
attached, had to rename toevent_reader.py.txt
because GH restricts attachment file types.
** My report
I am using my MX Master 3s (bluetooth connected, not thunderbolt) on my Dell XPS 15 7590.
The autoload works fine if I connect to the mouse while the laptop is running.
But when I close the lid and reopen+unlock the laptop, the remaps do not work anymore.
Turning off and on again bluetooth fixes the problem, is annoying though.
System Information and logs
input-remapper-control --version
fedora 39
gnome
sudo ls -l /proc/1/exe
to check if you are using systemdlrwxrwxrwx. 1 root root 0 Dec 12 15:42 /proc/1/exe -> /usr/lib/systemd/systemd
cat ~/.config/input-remapper-2/config.json
to see if the "autoload" config is written correctlysystemctl status input-remapper -n 50
the service has to be runningDec 12 15:42:53 fedora-xps input-remapper-service[1005]: Autoloading for "Logitech MX Master 3S" Dec 12 15:42:53 fedora-xps input-remapper-service[1005]: Request to start injecting for "Logitech MX Master 3S" Dec 12 15:42:53 fedora-xps input-remapper-service[1005]: Loading preset from "/home/born/.config/input-remapper-2/presets/Logitech MX Master 3S/Remap Mouse To Switch Workspaces.json" Dec 12 15:42:53 fedora-xps input-remapper-service[3433]: Starting injecting the preset for "Logitech MX Master 3S" Dec 12 16:31:00 fedora-xps input-remapper-service[3433]: ERROR: fd broke, was the device unplugged? Dec 12 16:31:00 fedora-xps input-remapper-service[3433]: read loop for /dev/input/event17 stopped Dec 12 16:31:15 fedora-xps input-remapper-service[1005]: Request to autoload for "Logitech MX Master 3S" Dec 12 16:31:15 fedora-xps input-remapper-service[1005]: Found "Sleep Button", "AT Translated Set 2 keyboard", "SynPS/2 Synaptics TouchPad", "SYNA2393:00 06CB:7A13 Mouse", "Video Bus", "Intel HID events", "input-remapper keyboard", "input-remapper Logitech MX Master 3S forwarded", "Logitech MX Master 3S" Dec 12 16:31:15 fedora-xps input-remapper-service[1005]: Autoloading for "Logitech MX Master 3S" Dec 12 16:31:15 fedora-xps input-remapper-service[1005]: Request to start injecting for "Logitech MX Master 3S" Dec 12 16:31:15 fedora-xps input-remapper-service[1005]: Loading preset from "/home/born/.config/input-remapper-2/presets/Logitech MX Master 3S/Remap Mouse To Switch Workspaces.json" Dec 12 16:31:15 fedora-xps input-remapper-service[1005]: Stopping injecting keycodes for group "Logitech MX Master 3S" Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: Starting injecting the preset for "Logitech MX Master 3S" Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: Process Logitech MX Master 3S: Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: Traceback (most recent call last): Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: File "/usr/lib64/python3.12/site-packages/evdev/device.py", line 125, in init Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: fd = os.open(dev, os.O_RDWR | os.O_NONBLOCK) Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: FileNotFoundError: [Errno 2] No such file or directory: '/dev/input/event19' Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: During handling of the above exception, another exception occurred: Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: Traceback (most recent call last): Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: File "/usr/lib64/python3.12/multiprocessing/process.py", line 314, in _bootstrap Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: self.run() Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: File "/usr/lib/python3.12/site-packages/inputremapper/injection/injector.py", line 414, in run Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: forward_devices[device_hash] = self._create_forwarding_device(device) Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: File "/usr/lib/python3.12/site-packages/inputremapper/injection/injector.py", line 361, in _create_forwarding_device Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: forward_to = evdev.UInput( Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: ^^^^^^^^^^^^^ Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: File "/usr/lib64/python3.12/site-packages/evdev/uinput.py", line 155, in init Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: self.device = self._find_device() Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: ^^^^^^^^^^^^^^^^^^^ Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: File "/usr/lib64/python3.12/site-packages/evdev/uinput.py", line 282, in _find_device Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: d = device.InputDevice(path) Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: ^^^^^^^^^^^^^^^^^^^^^^^^ Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: File "/usr/lib64/python3.12/site-packages/evdev/device.py", line 127, in init Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: fd = os.open(dev, os.O_RDONLY | os.O_NONBLOCK) Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Dec 12 16:31:15 fedora-xps input-remapper-service[9955]: FileNotFoundError: [Errno 2] No such file or directory: '/dev/input/event19' Dec 12 16:31:25 fedora-xps input-remapper-service[1005]: Request to autoload for "Logitech MX Master 3S" Dec 12 16:31:25 fedora-xps input-remapper-service[1005]: Found "Sleep Button", "AT Translated Set 2 keyboard", "SynPS/2 Synaptics TouchPad", "SYNA2393:00 06CB:7A13 Mouse", "Video Bus", "Intel HID events", "input-remapper keyboard", "Logitech MX Master 3S" Dec 12 16:31:25 fedora-xps input-remapper-service[1005]: Autoloading for "Logitech MX Master 3S" Dec 12 16:31:25 fedora-xps input-remapper-service[1005]: Not autoloading the same preset "Remap Mouse To Switch Workspaces" again for group "Logitech MX Master 3S" Dec 12 16:31:46 fedora-xps input-remapper-service[1005]: Request to autoload for "Logitech MX Master 3S" Dec 12 16:31:46 fedora-xps input-remapper-service[1005]: Found "Sleep Button", "AT Translated Set 2 keyboard", "SynPS/2 Synaptics TouchPad", "SYNA2393:00 06CB:7A13 Mouse", "Video Bus", "Intel HID events", "input-remapper keyboard", "Logitech MX Master 3S" Dec 12 16:31:46 fedora-xps input-remapper-service[1005]: Autoloading for "Logitech MX Master 3S" Dec 12 16:31:46 fedora-xps input-remapper-service[1005]: Request to start injecting for "Logitech MX Master 3S" Dec 12 16:31:46 fedora-xps input-remapper-service[1005]: Loading preset from "/home/born/.config/input-remapper-2/presets/Logitech MX Master 3S/Remap Mouse To Switch Workspaces.json" Dec 12 16:31:46 fedora-xps input-remapper-service[1005]: Stopping injecting keycodes for group "Logitech MX Master 3S" Dec 12 16:31:46 fedora-xps input-remapper-service[10132]: Starting injecting the preset for "Logitech MX Master 3S"
Connected to the service Daemon answered with "hello" Done