
embedded24.net - USB HID Host driver for Windows
USB HID devices are widely used in control and electronics in general. There are many microcontrollers from many manufacturers with built-in USB support. The needful firmware for the devices is provided by the manufacturers. But on the Host side, it is still hard to develop a driver. Stop racking your brain and start using AHID Dynamic Link Library - a simple way to interface USB HID devices!
Functions
- AHid_Init(): Driver initialization.
- AHid_Register(): Interface registration.
- AHid_Deregister(): Remove from registration.
- AHid_Write(): Write data.
- AHid_Read(): Read data.
- AHid_Request(): Request a Feature Report.
- AHid_Attached(): Device connected or removed?
- AHid_Find(): Find the device.
- AHid_Info(): Show an info box.
Concept
Initialize the AHID Dynamic Link Library by a call to AHid_Init(). The next step is to create an interface with
AHid_Register(). The function returns a handle to your USB device.
AHid_Write() sends data to your device. It's done using Interrupt or Control (Feature Reports)
transfers, depending on the setting used in AHid_Register().

Figure: Transfer between USB-Device and Host-Application
Using Interrupt Transfers, data reception is done automatically. The AHID.DLL creates an additional thread to listen for incoming data.
After data detection, the AHID.DLL sends a RECEIVED message to your Window Message Loop where you collect the data by a call to AHid_Read().
Feature Reports are requested by a call to AHid_Request(). And again, the AHID.DLL sends a RECEIVED message to your application
after data reception. Call AHid_Read() to collect the data. This approach delegates all incoming data to the same place, so the implementation of
a State Machine is very easy.
The AHid_Attached() function is called after removing or attaching your device from USB. The return value indicates its new
state (connected/disconnected). AHid_Find() is quite similar. It searches active for your device and returns true
when it is detected.
AHid_Info() has no function in normal operation. It simply displays a message box with some information
about the AHID Dynamic Link Library.

Figure: Transfer between USB-Device and Host-Application
Features
- HID USB Host Driver DLL for Windows
- Use with C++, C++/CLI, C#, VB and more
- Support of 32 and 64 Bit Windows
- Can be used with Composite Devices
- Including automatic Device Detection
- Multithreaded Approach for non blocking Data Transfer
- Based on Windows Messaging System
- To use with Input, Output and Feature Reports
- Allows different Report Id's
- Recommended for low and high Throughput
- Very high Data Rate with up to 64 kBytes/s
- Demo Applications for C++/CLI, C# and VB available
