sezanzeb / input-remapper

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

Internal keyboard & touchpad stop working randomly until next restart #402

Open RatnadeepBiswakarma opened 2 years ago

RatnadeepBiswakarma commented 2 years ago

Hey, absolutely love it, this piece of software made it possible to use my mac keyboard with Ubuntu.

I have no issue with the injection or mapping of keys instead I noticed something else.

After installing it and configuring the mac keyboard, sometimes either my internal keyboard or touchpad stops working randomly. It's not always obvious, both may or may not work at the same time or any of the touchpad and keyboard will work. Mostly after reboot it happens. Though the mouse and external magic keyboard (which I configured with key mapper) work all the time without any issue.

Environment details: OS: Ubuntu 20.04.4 LTS x86_64 Laptop: Swift SF314-55G V1.07 Kernel: 5.13.0-41-generic Desktop Env: GNOME

Thanks for the awesome work!

sezanzeb commented 2 years ago

Hey, absolutely love it, this piece of software made it possible to use my mac keyboard with Ubuntu. Thanks for the awesome work!

Thanks! You're welcome :)

You should probably consider upgrading to ubuntu 22.04 first

RatnadeepBiswakarma commented 2 years ago

Hey, absolutely love it, this piece of software made it possible to use my mac keyboard with Ubuntu. Thanks for the awesome work!

Thanks! You're welcome :)

You should probably consider upgrading to ubuntu 22.04 first

Thanks for your reply. Does this have any compatibility issue with ubuntu 20.04? I never faced this before. Anyway, I tried this solution yesterday and it seems to be working fine till now.

sezanzeb commented 2 years ago

Does this have any compatibility issue with ubuntu 20.04?

I don't know, but ubuntu has somewhat outdated packages in some cases, and running the newest stable version is usually a good thing.

sezanzeb commented 2 years ago

whats the status on this? Did you upgrade your system?

Tesla-Tank commented 2 years ago

I'm also having the same problem but my mouse completely freezes and the only way to fix it (besides restarting) is to manually remove and plug it back. If I don't restart, none of the configuration is loaded (default settings) and will not inject. I tried figuring out on how to recreate the issues but I don't have an idea yet. I tried randomly hitting keys and quickly, but its works fine. Thanks for responding.

Environment details: OS: Kubuntu 22.04 Kernel: 5.15.0-43-generic Desktop Env: KDE Graphics Platform: X11

sezanzeb commented 2 years ago

@Tesla-Tank I assume you are trying to change the keys of your mouse? I have a really hard time following what your problem with rebooting is. Do you have "autoload" activated? Do you want it to inject after rebooting? Why would it not work when hitting keys randomly?

Tesla-Tank commented 2 years ago

So I already have a preset config for my mouse and keypad that has autoload enable (Autoloads even without the application open, which is really nice). I usually play RTS games and I rarely have to change the key binds if I'm playing another game. I don't mind restarting if the keys does not work but not in-game, since it freezes my mouse and I have to go behind my pc to reattach it, just to finish the game without my preset. As for hitting the keys randomly, I was trying to figure out on whats causing the error. I honestly don't know or how its messing up. Thanks again.

sezanzeb commented 2 years ago

ok thanks. We have to first figure out if the input-remapper service or something from the environment is freezing.

Please run sudo evtest, there you should see a device that says "... forwarded":

/dev/input/event9:  input-remapper USB Optical Mouse forwarded

select that one and check if there are still events being written when your mouse freezes.

Tesla-Tank commented 2 years ago

I haven't crashed yet, but there are repeating devices showing up. I don't know if this is intentional or not but I'll get back to you when the mouse freezes. image Update: Event275 detects the movement/keys. My assumption to the other two events are the keybinds? Everything is still working, I'll get back to you when it freezes.

sezanzeb commented 2 years ago

Are there also exactly three "Razer Razer Tartarus V2" (without "input-remapper") devices? And exactly three "Razer Razer Naga Trinity" devices?

Tesla-Tank commented 2 years ago

Screenshot_20220724_135548 Yep I have them lined out too since they are not in order. Everything is still working so far but I haven't been using my PC for gaming lately.

sezanzeb commented 2 years ago

I'll get back to you when the mouse freezes.

Any updates?

Tesla-Tank commented 2 years ago

Sorry for the late response, but I switched to Nobara (Fedora Modified) and I haven't gotten the change to test it yet.

Tesla-Tank commented 1 year ago

The same problem is happening on Nobara (Fedora Modified) and using the command sudo evtest still shows the same devices (Before and After freezing). I'll get a screenshot of this if it happens again. Thanks again.

Tesla-Tank commented 1 year ago

Another late update, I originally thought polychromatic was causing the issue but that wasnt the case. The random freezing still happens and now sometimes a key can get stuck and repeats itself unless I alt tab out to input remapper to change the profile. My temporary fix for this is to use systemctl reload-or-restart input-remapper but I would have to manually switch my start my profile. I forgot to take a screenshot but I will next time.

sezanzeb commented 1 year ago

A picture of the preset would be nice yes

Start the injection, run sudo evtest, locate the "input-remapper ..." device that reports mouse movements. Does this device still report mouse movement after it freezes?

Tesla-Tank commented 1 year ago

I have a new problem but I cant tell if its the apps fault or my system. My new issues is that my computer completely freezes. I cant do anything and not even reisub. The closest I've gotten to using the sudo evtest was after the input remapper stopped working, used the terminal but couldn't do anything since at that point my pc freeze. I just don't know what to do at this point.

sezanzeb commented 1 year ago

So rereading all of this, we don't know yet if the input-remapper process freezes, or something else entirely. Which is why we wanted to look at evtest.

Using evtest, after the mouse freezes, it would be good to know if the input-remapper ... forwarded device that usually reports the events still reports events.

sezanzeb commented 1 year ago

My new issues is that my computer completely freezes

Hmm, maybe you have some luck looking at journalctl, but I have never heard of something like this related to input-remapper, not that I can remember.

When my computer completely freezes it's usually because the memory is full. Which is why I'm using earlyoom. It could theoretically be possible for input-remapper to have a memory leak of some sort, but you'd have to watch your memory usage to verify that.

Tesla-Tank commented 1 year ago

I've actually managed to get input remapper to stop working before my crashing my pc. Using sudo evtest and selecting input-remapper for the mouse works. The preset is not detected but the default mouse binds are working.

sezanzeb commented 1 year ago

The preset is not detected

What does that mean?

Tesla-Tank commented 1 year ago

My mistake, the preset isn't loaded. The default keys are working but my custom preset isn't.

So I'm trying to come up with a temporary solution by creating a bash script to restart input-remapper and apply my preset to all of my devices. The problem is that not all of the devices were detected and trying to use the command wouldn't do anything. image It shows up on the gui with no problems. image

Edit: I forgot the part where my preset wouldn't loaded. Using systemctl reload-or-restart input-remapper does work but the preset will not load properly.

sezanzeb commented 1 year ago

When input-remapper can't detect your device, does any of the following commands list it?

sudo python3 -c "import evdev; print([evdev.InputDevice(device).name for device in evdev.list_devices()])"
sudo evtest
sudo input-remapper-control --list-devices
Tesla-Tank commented 1 year ago

Oh that is my mistake, I didnt run it as sudo. I now gotta figure out how to make the script run with sudo since I'm going to be using my stream deck to quickly restart input-remapper. On the streamdeck I cant use sudo in the command line, so I have to figure out how to use sudo within my script and without asking for the password (or if its even a good idea to have a script that doesnt need a password to execute). Using stop and start instead of reload-or-restart for systemctl fixes the broken presets.

sezanzeb commented 1 year ago

or if its even a good idea to have a script that doesnt need a password to execute

it isn't, setuid is usually disabled for scripts because of security problems

Have you had a chance to check the systemctl status input-remapper output when things break?

Tesla-Tank commented 1 year ago

Have you had a chance to check the systemctl status input-remapper output when things break?


[tesla@tesla-pc ~]$ systemctl status input-remapper
● input-remapper.service - Service to inject keycodes without the GUI application
Loaded: loaded (/usr/lib/systemd/system/input-remapper.service; enabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/service.d
└─10-timeout-abort.conf
Active: active (running) since Mon 2023-08-21 11:31:48 EDT; 3h 11min ago
Main PID: 1369 (input-remapper-)
Tasks: 9 (limit: 76959)
Memory: 13.3M
CPU: 6min 28.693s
CGroup: /system.slice/input-remapper.service
├─ 1369 /usr/bin/python3 /usr/bin/input-remapper-service
├─ 1743 /usr/bin/python3 /usr/bin/input-remapper-service
├─ 4375 /usr/bin/python3 /usr/bin/input-remapper-service
├─ 4471 /usr/bin/python3 /usr/bin/input-remapper-service
└─24018 /usr/bin/python3 /usr/bin/input-remapper-service

Aug 21 14:39:32 tesla-pc input-remapper-service[4375]: ERROR: select.select timed out Aug 21 14:39:36 tesla-pc input-remapper-service[4375]: ERROR: select.select timed out Aug 21 14:39:37 tesla-pc input-remapper-service[4375]: ERROR: select.select timed out Aug 21 14:39:44 tesla-pc input-remapper-service[4375]: ERROR: select.select timed out Aug 21 14:39:46 tesla-pc input-remapper-service[4375]: ERROR: select.select timed out Aug 21 14:39:52 tesla-pc input-remapper-service[4375]: ERROR: select.select timed out Aug 21 14:39:56 tesla-pc input-remapper-service[4375]: ERROR: select.select timed out Aug 21 14:40:00 tesla-pc input-remapper-service[4375]: ERROR: select.select timed out Aug 21 14:40:02 tesla-pc input-remapper-service[4375]: ERROR: select.select timed out Aug 21 14:40:16 tesla-pc input-remapper-service[4375]: ERROR: select.select timed out


Here it is. Thanks for responding.
sezanzeb commented 1 year ago

ok, apparently we need the logs to go back a bit more. Try journalctl -b | grep input-remapper when it breaks

Tesla-Tank commented 1 year ago

ok, apparently we need the logs to go back a bit more. Try journalctl -b | grep input-remapper when it breaks

My mouse froze ingame. I'll see if I can get my keypad to break I'm going to upload it to pastebin since the output has too many lines. https://pastebin.com/Ut1YJE25

Tesla-Tank commented 9 months ago

I'm still having the same issues on Nobara 39. I made a script that restarts input-remapper and loads the presets manually but I would have to put in the password twice.

Tesla-Tank commented 1 month ago

Using latest commit on Nobara 40 KDE and still having the same issue: https://pastebin.com/uW0W0cee

Tesla-Tank commented 2 weeks ago

So I actually think the cause of this is because of suspending or hibernating my PC. I disabled my PC from going to sleep or hibernating and haven't noticed any issues with my keypad, keyboard, or mouse from freezing. If issue #390 is solved, this can be the solution to my problem.