Description
Want
to develop a USB HID device? Need Windows PC application
software,
but don't want to deal with custom device drivers? Want to
develop
a quick and easy host PC application to test your USB HID device? The UsbHidApi
dynamic link library (DLL) is for you. Did you know that you
don't
need a custom driver to access your USB device. If it's a Human
Interface
Class (HID) device, you can take advantage of existing Windows
drivers.
Used mainly for keyboards, mice, and joysticks, this class is also
well-suited
for special-purpose applications including access and control of
custom-developed
devices. UsbHidApi encapsulates API calls that give you
easy
access to your device. These API calls can be used in any
development
environment that accepts DLLs (e.g., Visual C++ & Visual
Basic).
Also compatible with LabView and
LabWindows/CVI
(see note below).
Also
included is UsbHidApi_NET, a special API version that contains
a
wrapper for .NET compatibility
(see note
below). Compiled using the Visual C++ Toolkit 2003, UsbHidApi_NET
is recommended for Visual C++ .NET developers.
You
get both the UsbHidApi and the UsbHidApi_NET for the
same
low
price!
Check
out these features:
Easy to use API calls - Open( ), Read( ), Write( ), etc.
No custom drivers (uses USB HID drivers already included in
Windows)
Develop PC host applications quickly
Write applications for USB HID devices
Includes two API libraries: UsbHidApi and UsbHidApi_NET
Two available demonstration applications: Generic and U4x1
(UsbHidApi only)
Free demo source code included: Visual C++ 6.0 and
Visual Basic
VC++ 6.0 demo source available for either generic demo app
or U4x1 demo
app
VB demo source available for generic demo app only
Compatible with LabView and LabWindows/CVI (see note)
Also includes API for Visual C++ .NET developers (see note)
Use implicit- or explicit-linking (DLL required for both
options, included)
Includes dynamic library library (DLL) file
Advertisement:
|
U4x1
Device Control
Are
you interested in writing a custom application for a UsbMicro U401 or
U421
device? Click here to
discover how.

|
Designing
Firmware for Your USB Device?
One
of the key elements in developing firmware for your custom USB device
is
defining the descriptors. This is important for proper device
enumeration
by the host. There are several types of descriptors including
configuration,
device, and report. Many times users will define a valid set of
descriptors,
but fail to properly classify the device. The device is classified by
its
"usage" such as a keyboard, joystick, or mouse. These devices are
typically allocated for exclusive use by the operating system. If
you are developing a custom device (e.g., temperature controller,
digital
input/output board, etc.) using the HID class, your report descriptor
should
indicate a "Vendor Defined" usage as indicated in the sample report
descriptor
below (courtesy of L. Zadra):
/*------ Report Descriptor
Group ---------------------*/
/* This is a basic report descriptor. All
data in the
*/
/* reports are vendor defined and
therefore the host
*/
/* doesn't care what we
transfer
*/
BYTE code
abromReportDescriptor[SIZEOF_REPORT_DESCRIPTOR]
=
{
0x06, 0xA0, 0xFF, // Usage
Page (FFA0H =
vendor defined)
0x09, 0x01, // Usage (vendor
defined)
0xA1, 0x01, // Start
Collection (Application)
// INPUT DEFINITION
0x09, 0x01, // Usage (vendor
defined)
0x15, 0x00, // Logical
Minimum (0)
0x25, 0xff, // Logical
Maximum (255)
0x75, 0x08, // Report Size (
8 BITS)
0x95, EP1_MAX_REPORT_SIZE,
// Report Count
(16 Bytes)
0x81, 0x00, // Input (Data,
Variable, Absolute)
// OUTPUT DEFINITION
0x09, 0x02, // Usage (vendor
defined)
0x75, 0x08, // Report Size (8 BITS)
0x95, EP0_MAX_REPORT_SIZE, //
Report Count (16
Bytes)
0x91, 0x00, // 0utput (Data,
Variable, Absolute)
0xC0 // End Collection
};
|
Compatibility
UsbHidApi
has been tested on Windows platforms including 98, 2000, XP, &
Vista
and has been used with a variety of HID class devices. For those
with compatibility concerns or unusual interfacing requirements, we
offer
a 30-day unregistered evaluation. This limited-use version allows
you to test the library with your application on a trial basis.
To
request the evaluation, click the link above. Those interested in
programming for applications including .NET and LabView should read the
following notices:
.NET
programmers:
| Also
included is an API version that contains a wrapper for .NET
compatibility.
Compiled using the Visual C++ Toolkit 2003, UsbHidApi_NET
is recommended for Visual C++ .NET developers. |
LabView
and LabWindows/CVI programmers:
| UsbHidApi
may also be used in LabView and LabWindows/CVI applications. For
compatibility with ANSI C compilers, include the following header file
in your application: UsbHidApi_2.h. This is a specially
modified
version of the original header and is intended for use in ANSI C
applications.
Add
the following statement to your C source file:
#include
"UsbHidApi_2.h"
Add
the following library to your list of build objects:
UsbHidApi.lib
See
the following application notes for additional details:
FAQ:
Using Dynamic Link Libraries with LabWindows/CVI
Integrating
external code using Import Shared Lib. Wizard
Writing
win32 DLLs and Calling them from LabView
(Larry
Tell has developed a LabWindows/CVI demo using UsbHidApi.
The demo is available free of charge and can be downloaded using one of
the following links:
-
Download
full demo including source code (~12Mb)
-
Download
source code files only (~80Kb)
|
|