Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing multiple keyboards input by C++ (or python) in linux

I want to read the input of (up to 4) keyboards attached the a computer in my own application.

My situation

For a small event I'd like to attach three USB barcode scanners to a laptop (having a keyboard)

By default, a barcode scanner simply work like a keyboard. If it scans a barcode it just enters the number and presses the "return" key. That's great and works out of the box.

For my application three barcode scanner will work simultaneous and might get in conflict with a default application. Also there should be an opinion to enter the barcode manually on the laptops keyboard.

The goal

Therefore I need to read the input of the four keyboards with my custom application (C++ or python) and handle them separately.

The environment

My specific environment is Ubuntu 11.04 on a laptop having three barcode scanners attached. The application is written either in C++ or python (depending on the answers to this question).

Thanks in advance for any hint or answer

like image 765
Benjamin Schulte Avatar asked Apr 18 '12 12:04

Benjamin Schulte


1 Answers

Why dont go to the device node

maybe found here cat /dev/input/by-path/yourDevice

and read the code here

like they do here

(Note: original link is broken but content may be found on web.archive.org)

like image 97
tingel2k Avatar answered Nov 16 '22 10:11

tingel2k