evdev

Python evdev and bar code scanner

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 21:48:50
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(): if event.type == 1 and event.value == 1: barcode += (keys[event.code]) print barcode # sudo ./bar-code

python 3, headless RaspPi, locale de_DE not possible for python-evdev

老子叫甜甜 提交于 2019-12-02 19:08:14
问题 After the main problem is solved try to read from multiple HID inputs I open here a new question for the following (and different) problem: I installed minibian on a RaspPi. The entire system is running on 'de_DE' , in details: root@ddpi:~# locale LANG=de_DE.UTF-8 LANGUAGE= LC_CTYPE="de_DE.UTF-8" LC_NUMERIC="de_DE.UTF-8" LC_TIME="de_DE.UTF-8" LC_COLLATE="de_DE.UTF-8" LC_MONETARY="de_DE.UTF-8" LC_MESSAGES="de_DE.UTF-8" LC_PAPER="de_DE.UTF-8" LC_NAME="de_DE.UTF-8" LC_ADDRESS="de_DE.UTF-8" LC

python 3, headless RaspPi, locale de_DE not possible for python-evdev

断了今生、忘了曾经 提交于 2019-12-02 08:14:48
After the main problem is solved try to read from multiple HID inputs I open here a new question for the following (and different) problem: I installed minibian on a RaspPi. The entire system is running on 'de_DE' , in details: root@ddpi:~# locale LANG=de_DE.UTF-8 LANGUAGE= LC_CTYPE="de_DE.UTF-8" LC_NUMERIC="de_DE.UTF-8" LC_TIME="de_DE.UTF-8" LC_COLLATE="de_DE.UTF-8" LC_MONETARY="de_DE.UTF-8" LC_MESSAGES="de_DE.UTF-8" LC_PAPER="de_DE.UTF-8" LC_NAME="de_DE.UTF-8" LC_ADDRESS="de_DE.UTF-8" LC_TELEPHONE="de_DE.UTF-8" LC_MEASUREMENT="de_DE.UTF-8" LC_IDENTIFICATION="de_DE.UTF-8" LC_ALL= and root

Python evdev equivalent for OSX

这一生的挚爱 提交于 2019-12-01 17:54:06
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. I got a simple test working using cython-hidapi (installable as pip install hidapi - note this is different to the one linked in the comments but seems to be similar in function). I also had installed hidapi-devel from macports