Where to begin and how to get started writing your new libusbK based application.
|This library is divided into the following sections |
|USB General (LibK)|
General libusbK library functions, defines, and structures.
|USB Core (UsbK)|
Module for core UsbK device functions.
|Device List (LstK)|
Module for USB device discovery and enumeration.
|Overlapped I/O (OvlK)|
Module for USB pipe specific async I/O.
|Hotplug Event Notifier (HotK)|
Module for USB device notification.
|Pipe Stream (StmK)|
Module for thread assisted USB pipe streaming transfers.
|Advanced ISO (IsoK)|
Module for advanced isochronous transfers.
- Before you begin, connect your device and use the kList test application to verify one of the Supported Drivers has been properly installed. If kList cannot find your device then refer back to Installation.
There are several examples to help along the way, but the following are meant for user new to the library. These examples show basic library functionality like finding and opening a device:
Writing the code:
- Init and Free
- All modules implement an Init and a Free function for creating and and detroying a handle or context specific to the module.
- Function Returns
- Nearly all function have a
BOOL return type. If a function does not complete as expected it returns FALSE (0). To get extended error information, the user must call the
GetLastError() Windows API function. These are very generalized errors, the Windows API/MSDN provides ways to lookup error strings for the extended error number but is advisable not to use them! Instead refer to this documentation under the function that caused the error.
- Structure Packing
- The following structures are packed at 1 byte:
- All other structures assume natural packing.
Building the examples:
- Examples should be built from the dev-kit package. If you have not allready downloaded it, get it now.
- Choose your compiler/IDE:
- VStudio 2008: Each example has a project file. All examples are contained within an examples solution.
- WDK: Each example has a WDK sources file. You can use standard WDK building conventions to build all or a single example.
- Get and install Windows Driver Kit.
- Open a build environment command prompt
- Navigate to the examples folder to build all or the examples project to build one.
- Execute: build /cegZ
- Mingw64: Each example has a Mingw64 build script for 32bit or 64bit GCC builds. All examples are contained in a single solution-like build script which can be used to build all or any of the examples.
- Get and install TDM64-GCC
- Open a Mingw64 build command prompt.
- Navigate to the examples folder and execute make:
Running the examples:
- The output EXEs will be placed in different locations depending on the compiler/IDE used. Generally they are placed in compiler/IDE default locations.
- Most examples are meant to be modifed prior to use. It is not advisabe to run these examples as-is before reviewing the example code. The one exception is if your device is an official Benchmark USB Device.