python-uinput icon indicating copy to clipboard operation
python-uinput copied to clipboard

failing to create output using examples on Debian Stretch

Open GeekAnnoyed opened this issue 9 years ago • 1 comments

Hello, Sorry if this is "user error" I'm still learning python and trying to learn by doing a project.

I've looked at the joystick and example and then it failed to provide me with /dev/input/js4 or other device in the KDE joystick manager. so I tried to use the example for the keyboard

import uinput

device = uinput.Device([
        uinput.KEY_E,
        uinput.KEY_H,
        uinput.KEY_L,
        uinput.KEY_O,
        ])

device.emit_click(uinput.KEY_H)
device.emit_click(uinput.KEY_E)
device.emit_click(uinput.KEY_L)
device.emit_click(uinput.KEY_L)
device.emit_click(uinput.KEY_O)

and I was expecting this to output Hello on my terminal but I'm getting nothing, no errors or output.

I don't know how to get more debugging information out of python at the moment.

GeekAnnoyed avatar Jan 07 '17 08:01 GeekAnnoyed

if you run it as a python script, this script runs very fast, and Xorg has no time to add new evdev, before device is deleted.

you need to add a short sleep after device is created.

just like the examples in source code.

zhangn1985 avatar Jan 27 '18 12:01 zhangn1985