python-evdev
python-evdev copied to clipboard
Troubleshooting UInput() OSError Error 22 Invalid argument
I'm unable to create a uinput device and I'm not sure what's preventing me from doing it:
root@go2-white:~# uname -a
Linux go2-white 4.4.189 #1 SMP Fri May 22 14:46:51 CEST 2020 aarch64 GNU/Linux
root@go2-white:~# python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from evdev import InputDevice, categorize, ecodes, UInput
>>> ui=UInput()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/dist-packages/evdev/uinput.py", line 146, in __init__
_uinput.setup(self.fd, name, vendor, product, version, bustype, absinfo)
OSError: [Errno 22] Invalid argument
>>>
root@go2-white:~# ls -l /dev/uinput
crw------- 1 root root 10, 223 Sep 3 18:20 /dev/uinput
It started to happen once I used pip3 to install evdev 1.3.0 (the stock version is 1.1.2 in Debian 10 (aarch64)). Any ideas why?
Here's a note for my future self (because I spent an hour again around this problem, having forgotten about it!) - in order for the code above to work I had to downgrade to version 1.1.2 of evdev:
sudo pip3 install evdev==1.1.2