With this python script you can capture keyboard (emulators) and barcode scanners trough evdev (event device), this way the part of code will only execute when the device is sending keys:

output:

Another python script example:

Output: …

USB – HID human interface device Lees meer »

Barcode scanners NETUM NT-2012 Wired 1D Laser Barcode Scanner Features: Handheld Laser barcode scanner can be used to scan and decode linear one-dimensional (1D) colored barcodes Decode Capability: Code11, Code39, Code93, Code32, Code128, Coda Bar, UPC-A, UPC-E, ISBN, EAN-8, EAN-13, …

USB Apparaat – Barcode scanner Lees meer »