Click here to Skip to main content
16,022,296 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I want to read stream of data from HID Keyboard device i.e. "Barcode Scanner".

Through reading stream I want to pass that to web application.

The barcode shows under Keyboard in Device Manager.

in DeviceManager --> Keyboard --> HID Keyboard Device.

What is the best link or tutorial.

What I have tried:

Tried many libraries but not working or reading data in node.js.
New to node.js.
Some libs detect HID device but does not read.
Posted
Updated 27-Jun-24 5:22am

1 solution

Basically, you probably can't - most barcode scanners are configured to operate as a keyboard emulation and the code comes in to your browser as a stream of key presses, and you cannot detect if any particular keypress came from a "real keyboard" or a "virtual keyboard" (which would include scanners).

It is generally possible to configure the scanner to give specific lead-in and tail-out sequences so you can tell "this is barcode data" but how you configure that will depend on the specific scanner: you would have to talk to the manufacturer to change the setting.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900