evdev

Simulating controller dpad button being held down with Python evdev

只谈情不闲聊 提交于 2021-01-27 20:32:21
问题 I'm trying to simulate holding down a DPad button on a controller using Python evdev. So far I've managed to successfully press a button like so: import os import time from evdev import uinput, ecodes as e, list_devices, InputDevice, ff dev = InputDevice(str(os.path.realpath("/dev/input/by-id/usb-Sony_Interactive_Entertainment_Wireless_Controller-if03-event-joystick"))) dev.write(e.EV_ABS, e.ABS_HAT0X, 1) dev.write(e.EV_ABS, e.ABS_HAT0X, 0) dev.write(e.EV_SYN, 0, 0) but haven't been able to

Calibrating and configuring evdevtouch on embedded qt project

一个人想着一个人 提交于 2020-03-05 05:38:46
问题 I have a Qt project running on a icoremx6solo with linux. I've setted up the graphics and run the code, but i can't handle touch inputs. Enabling the input logging with export QT_LOGGING_RULES="qt.qpa.input=true" i discovered that the coordinates ar not setted, i think that this is the main problem with that: qt.qpa.input: evdevtouch: /dev/input/event0: Protocol type B (multi) qt.qpa.input: evdevtouch: /dev/input/event0: min X: 0 max X: -1 qt.qpa.input: evdevtouch: /dev/input/event0: min Y: 0

Integrating HID access with evdev on linux with Python twisted

…衆ロ難τιáo~ 提交于 2020-01-04 06:28:29
问题 On a linux machine (Debian wheezy) I am trying to write an event-based server that does the following: Grab exclusive input to the input device (a special keyboard) to prevent the keystroke get into the usual event chain. Register for events in the twisted reactor Register callback at the deferred returned from waiting for events. This callback would then send an HTTP request after a special key sequence is received. This is the sample code from the pyevdev package. It works that I get

Reading multitouch using libevdev

我们两清 提交于 2019-12-22 17:23:08
问题 I'm trying to read raw multitouch data from my touchpad, though I'm not getting the results I expect. I started by identifying what my device ID was, using lsinput : /dev/input/event0 bustype : BUS_HOST vendor : 0x0 product : 0x5 version : 0 name : "Lid Switch" phys : "PNP0C0D/button/input0" bits ev : EV_SYN EV_SW /dev/input/event1 bustype : BUS_HOST vendor : 0x0 product : 0x1 version : 0 name : "Power Button" phys : "PNP0C0C/button/input0" bits ev : EV_SYN EV_KEY /dev/input/event2 bustype :

Python evdev and bar code scanner

房东的猫 提交于 2019-12-22 01:39:18
问题 I have a following code which I use to catch input from bar code scanner. The problem is in that I want to save whole scanned code in database, but every character of code prints on new line: #!/usr/bin/env python from evdev import InputDevice, ecodes, list_devices from select import select keys = "X^1234567890XXXXqwertzuiopXXXXasdfghjklXXXXXyxcvbnmXXXXXXXXXXXXXXXXXXXXXXX" dev = InputDevice("/dev/input/event10") barcode = "" while True: r,w,x = select([dev], [], []) for event in dev.read():

Python evdev equivalent for OSX

邮差的信 提交于 2019-12-19 17:43:09
问题 I have written a python script that polls evdev for a HID barcode scanner (emulates a keyboard): the script works well on Linux platforms (Ubuntu). Is there an OS X Python equivalent for evdev that would allow minor porting of the existing python script? If you have Python experience and have configured it for a HID device input, please indicate this in your response. 回答1: I got a simple test working using cython-hidapi (installable as pip install hidapi - note this is different to the one

Python evdev detect device unplugged

蹲街弑〆低调 提交于 2019-12-12 14:15:22
问题 I'm using the great "evdev" library to listen to a USB barcode reader input and I need to detect if the device suddenly gets unplugged/unresponsive because otherwise the python script reading the loop goes to 100% cpu usage on a single thread and slowly starts to eat all available memory which leads to the entire system crashing after a bit. The idea is to detect when the device is unplugged and kill the current script leading to supervisor trying to restart it until the device is plugged

Looking for a string in device capabilities; evdev; python

扶醉桌前 提交于 2019-12-11 15:38:57
问题 in evdev i'm trying to check to see if there is a mouse and keyboard plugged in and if so assign the device path to a variable to be used. This worked for a while as i just checked for the name Mouse or Keyboard in the device name by using this code if ("KEYBOARD" in device.name) or ("Keyboard" in device.name): print ("This is a Keyboard") keyboarddir = device.path keyboard = evdev.InputDevice(keyboarddir) After plugging in a different mouse i discovered that they don't all say mouse in there

why does the file evdev in /usr/share/X11/xkb/rules not match with evdev.lst?

老子叫甜甜 提交于 2019-12-10 10:16:17
问题 it seems that some options to setxkbmap which are listed in evdev.lst are not actually supported by the accompanying evdev file. For example ctrl:nocaps is supported but ctrl:swap_lalt_lctl is not, as evidenced by $ grep 'ctrl:nocaps' /usr/share/X11/xkb/rules/evdev{,.lst} /usr/share/X11/xkb/rules/evdev: ctrl:nocaps = +ctrl(nocaps) /usr/share/X11/xkb/rules/evdev.lst: ctrl:nocaps Caps Lock as Ctrl $ grep 'ctrl:swap_lalt_lctl_lwin' /usr/share/X11/xkb/rules/evdev{,.lst} /usr/share/X11/xkb/rules

Reading multitouch using libevdev

北城余情 提交于 2019-12-06 13:16:15
I'm trying to read raw multitouch data from my touchpad, though I'm not getting the results I expect. I started by identifying what my device ID was, using lsinput : /dev/input/event0 bustype : BUS_HOST vendor : 0x0 product : 0x5 version : 0 name : "Lid Switch" phys : "PNP0C0D/button/input0" bits ev : EV_SYN EV_SW /dev/input/event1 bustype : BUS_HOST vendor : 0x0 product : 0x1 version : 0 name : "Power Button" phys : "PNP0C0C/button/input0" bits ev : EV_SYN EV_KEY /dev/input/event2 bustype : BUS_HOST vendor : 0x0 product : 0x1 version : 0 name : "Power Button" phys : "LNXPWRBN/button/input0"