Comments (14)
I had this problem in Arch, had this exact problem with the keyboard example and solved it by adding a time.sleep(1) before sending the inputs
from python-uinput.
hi
I do this
sudo addgroup uinput
sudo adduser $USER uinput
and restart the machine
from python-uinput.
I had a similar problem on Arch, solved it by enabling uinput with modprobe
:
sudo modprobe uinput
sudo python keyboard.py
from python-uinput.
The error OSError: [Errno 13] Failed to open the uinput device: Permission denied
is expected, because by default, /dev/uinput
is normally readable/writable only by root. So in order to use uinput, you either have to be root, or you have to change the group and/or permissions of /dev/uinput
.
But the case where you run the example with sudo with no visible effects is more interesting. There's couple of ways to debug the issue:
-
Switch to any virtual terminal (
Ctrl + Alt + F3
for example) and login. Runsudo python keyboard.py
there. Does anything get printed? -
Install
evtest
package. Editkeyboard.py
and increase the sleep time to say 15secs or more. Runsudo python keyboard.py
and then in another terminal runsudo evtest
. It should listpython-uinput
as one of the devices (probably the last in the list). Select it and wait until the sleep expires inkeyboard.py
.evtest
should print something like this:Event: time 1443032198.289810, type 1 (EV_KEY), code 35 (KEY_H), value 1
Event: time 1443032198.289810, type 1 (EV_KEY), code 35 (KEY_H), value 0
Event: time 1443032198.289810, -------------- EV_SYN ------------
Event: time 1443032198.289889, type 1 (EV_KEY), code 18 (KEY_E), value 1
Event: time 1443032198.289889, type 1 (EV_KEY), code 18 (KEY_E), value 0
Event: time 1443032198.289889, -------------- EV_SYN ------------
Event: time 1443032198.289931, type 1 (EV_KEY), code 38 (KEY_L), value 1
Event: time 1443032198.289931, type 1 (EV_KEY), code 38 (KEY_L), value 0
Event: time 1443032198.289931, -------------- EV_SYN ------------
Event: time 1443032198.289960, type 1 (EV_KEY), code 38 (KEY_L), value 1
Event: time 1443032198.289960, type 1 (EV_KEY), code 38 (KEY_L), value 0
Event: time 1443032198.289960, -------------- EV_SYN ------------
Event: time 1443032198.289983, type 1 (EV_KEY), code 24 (KEY_O), value 1
Event: time 1443032198.289983, type 1 (EV_KEY), code 24 (KEY_O), value 0
Event: time 1443032198.289983, -------------- EV_SYN ------------
Event: time 1443032198.290018, -------------- EV_SYN ------------
from python-uinput.
Hi!!
Thanks for your help.
With the first way, I still got nothing. I've runned with sudo and root user, but still nothing shows.
Using the second way, still nothing. There is no python-uinput in the list.
from python-uinput.
I have the exact same problem, except my program is in c. I am developing a virtual keyboard program in Ubuntu 14.04, and the device just cannot get built simply because I do not have root privileges for uinput.
from python-uinput.
@Guha01Gubin Like I explained earlier, /dev/uinput
is readable and writable only by root by default. You should either run it as root, or modify /dev/uinput
mode bits and/or owner/group.
from python-uinput.
Hi, I have the same problem as @LuisDiazUgena.
For me it shows:
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "python-uinput"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 18 (KEY_E)
Event code 24 (KEY_O)
Event code 35 (KEY_H)
Event code 38 (KEY_L)
Properties:
Testing ... (interrupt to exit)
Event: time 1470245126.875007, type 1 (EV_KEY), code 35 (KEY_H), value 1
Event: time 1470245126.875007, type 1 (EV_KEY), code 35 (KEY_H), value 0
Event: time 1470245126.875007, -------------- EV_SYN ------------
Event: time 1470245126.875077, type 1 (EV_KEY), code 18 (KEY_E), value 1
Event: time 1470245126.875077, type 1 (EV_KEY), code 18 (KEY_E), value 0
Event: time 1470245126.875077, -------------- EV_SYN ------------
Event: time 1470245126.875128, type 1 (EV_KEY), code 38 (KEY_L), value 1
Event: time 1470245126.875128, type 1 (EV_KEY), code 38 (KEY_L), value 0
Event: time 1470245126.875128, -------------- EV_SYN ------------
Event: time 1470245126.875177, type 1 (EV_KEY), code 38 (KEY_L), value 1
Event: time 1470245126.875177, type 1 (EV_KEY), code 38 (KEY_L), value 0
Event: time 1470245126.875177, -------------- EV_SYN ------------
Event: time 1470245126.875223, type 1 (EV_KEY), code 24 (KEY_O), value 1
Event: time 1470245126.875223, type 1 (EV_KEY), code 24 (KEY_O), value 0
Event: time 1470245126.875223, -------------- EV_SYN ------------
expected 16 bytes, got -1
evtest: error reading: No such device
What can i do to fix this?
If its of any interest, I have used VNC and SSH and OS is Raspian Jessie
from python-uinput.
@vagol942 thank you! I am under arch and I was having the same problem. Your suggestion fixed it.
from python-uinput.
@HiggsWRX I'm glad. This is interesting, I thought it might be something related to my machine, but it seems the Device creation involves a non blocking process; thus the program continues before the input file has fully initialized.
from python-uinput.
It worked in my machine (Fedora 25), but I first needed to load uinput module, so udev can successfully found uinput module in misc class(aka /sys/class/misc/uinput).
from python-uinput.
I had this problem in Arch, had this exact problem with the keyboard example and solved it by adding a time.sleep(1) before sending the inputs
This also worked for me, and I'm on a vanilla Ubuntu setup. It seems like we need a way to wait for the device to be created. Does this need to be fixed upstream in https://github.com/tuomasjjrasanen/libsuinput?
from python-uinput.
Expanding on @hajungong007 's solution to the "Permission denied" error, here's my complete solution for Fedora 30:
Create a group designated for users that can read/write to /dev/uinput
. The particular name doesn't matter.
sudo groupadd uinput
Add users to ths new group. Start with yourself:
sudo usermod -a G uinput "$USER"
Permissions before:
$ ls -ld /dev/uinput
crw-------. 1 root root 10, 223 Oct 5 17:52 /dev/uinput
Change group ownership and permissions on /dev/uinput
:
sudo chmod g+rw /dev/uinput
sudo chgrp uinput /dev/uinput
Permissions after:
$ ls -ld /dev/uinput
crw-rw----. 1 root uinput 10, 223 Oct 5 17:56 /dev/uinput
from python-uinput.
I would like to mention about two things.
Firstly, the part in @robin-a-meade 's comment
Add users to ths new group. Start with yourself:
sudo usermod -a G uinput "$USER"
should be (there is a dash missing)
sudo usermod -a -G uinput "$USER"
After that everything works, considering time.sleep(1)
is inserted -per other comments- after the uinput.Device
creation, i guess it needs some time for initialization.
The second thing is, after a reboot, permissions and group ownership on /dev/uinput
resets. You may have to run chmod
and chgrp
commands at startup with a cronjob hoping /dev/uinput
is already created by the kernel driver by the time cronjob runs.
With the recommendations above combined, the old example is still working without any problem.
from python-uinput.
Related Issues (20)
- python-uinput mouse clicks don't work with libinput HOT 6
- Advance Mame HOT 5
- Extended characters
- Process /usr/sbin/th-cmd failed with exit code 1 HOT 1
- [Issue] Can't install uinput on OpenSuse Tumbleweed
- I can't find the keycode for a colon HOT 1
- How to do scrolling?
- Link to homepage in README.rst is broken
- wrong keyboard mapping HOT 2
- Works in interactive shell, not via script
- uinput joystick not detected by Pygame HOT 1
- Dead/Abandoned repo? HOT 3
- Anyone get joystick working?
- how to make ABS_X and ABS_Y attributes work with mouse pointer movement HOT 2
- sysconfig.get_config_var("SO") deprecated and removed in python 3.11 HOT 7
- Distutils module removed in Python 3.12 HOT 2
- Project unmaintained? HOT 1
- python-uinput2 (fork) HOT 10
- Pypi package transition HOT 4
- Build failure on 32-bit OS with newer Linux kernel due to usage of time64-unsafe data structure
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-uinput.