Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I read input from a USB HID device?

Tags:

c#

usb

hid

I'm making an application to run in the background on a salespoint to read input from a usb scanner. How can I get the input of the scanner from C#? And can I differentiate between the scanner and a usb keyboard? (Scanner is a HID device)

like image 420
dkarzon Avatar asked Sep 07 '10 00:09

dkarzon


People also ask

How does HID USB work?

The USB HID class keyboard is normally designed with an IN endpoint that communicates keystrokes to the computer and an OUT endpoint that communicates the status of the keyboard's LEDs from the computer to the keyboard.

What is USB HID port?

Human Interface Devices (HID) is a device class definition to replace PS/2-style connectors with a generic USB driver to support HID devices such as keyboards, mice, game controllers, and so on.

How do I connect my HID device?

To open an HID connection, first access a HIDDevice object. For this, you can either prompt the user to select a device by calling navigator. hid. requestDevice() , or pick one from navigator.

What is the difference between HID and USB?

As for the difference between HID and USB serial, serial is bulk while HID is control and interrupt. That's fundamental for USB, and means HID has (potentially) lower latency but serial has higher capacity.


1 Answers

I did this successfully before using a “Raw Input” implementation on CodeProject:

  • Raw Input

It allows you to receive both the input (what “keys” are pressed if it mimics a “keyboard”) as well distinguish which device it came from.

like image 121
Timwi Avatar answered Oct 03 '22 14:10

Timwi