'Can we generate keystrokes using a raw ASCII values using C++ in Linux?
I have barcode data received from a barcode scanner in ASCII format. I need to write a program to emulate keyboard using data received to the computer via the barcode scanner in Linux. I read source code available for USB-HIDKB driver for Linux as well (http://lxr.free-electrons.com/source/drivers/hid/usbhid/usbkbd.c) but I feel I have to do inverse of it. Exactly what I want to do is data is receiving from scanner as a data stream in ASCII format and need to generate key strokes using scanned data. Data reading part is almost done and need to find out a way to convert the ASCII data into key strokes.
example operation:
There is a barcode for CTRL + z (keyboard short cut for undo operation), once scan the barcode data will receive, 08 10 03 00 1a 00 18 0b is received as the data in HEX then data is 1a 00 18 0b. here first 4 bytes are header and remaining is the data portion.
now what I need to do is execute an undo operation instead of printing data.
I'm welcome any code example or suggestions have a start to coding. Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
