Where to begin and how to get started writing your new libusbK based application.
Getting Started
- Note
- 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:
- show-device.c
- open-device.c
- load-driver-api.c
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.
- Handles
- 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:
- Note
- The output EXEs will be placed in different locations depending on the compiler/IDE used. Generally they are placed in compiler/IDE default locations.
- Attention
- 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.