Skip to content

Commit e5ce14a

Browse files
committed
README: added table of contents
The README is long. Added table of contents in order to save reader from being overwhelmed. Updated README where appropriate. Signed-off-by: Filip Kubicz <[email protected]>
1 parent 177daa5 commit e5ce14a

File tree

1 file changed

+56
-47
lines changed

1 file changed

+56
-47
lines changed

README.md

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,38 @@
1-
# HIDAPI library for Windows, Linux, FreeBSD and Mac OS X
1+
## HIDAPI library for Windows, Linux, FreeBSD and macOS
2+
3+
HIDAPI is a multi-platform library which allows an application to interface
4+
with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and macOS.
5+
HIDAPI can be either built as a shared library (`.so`, `.dll` or `.dylib`) or
6+
can be embedded directly into a target application by adding a single source
7+
file (per platform) and a single header.
28

39
HIDAPI library was originally developed by Alan Ott ([signal11](https://github.com/signal11)).
410

5-
HIDAPI was moved to [libusb/hidapi](https://github.com/libusb/hidapi) on June 4th, 2019, in order to merge important bugfixes and continue development of the library.
11+
It was moved to [libusb/hidapi](https://github.com/libusb/hidapi) on June 4th, 2019, in order to merge important bugfixes and continue development of the library.
12+
13+
## Table of Contents
14+
15+
* [About](#about)
16+
* [What Does the API Look Like?](#what-does-the-api-look-like)
17+
* [License](#license)
18+
* [Download](#download)
19+
* [Build Instructions](#build-instructions)
20+
* [Prerequisites](#prerequisites)
21+
* [Linux](#linux)
22+
* [FreeBSD](#freebsd)
23+
* [Mac](#mac)
24+
* [Windows](#windows)
25+
* [Building HIDAPI into a shared library on Unix Platforms](#building-hidapi-into-a-shared-library-on-unix-platforms)
26+
* [Building the manual way on Unix platforms](#building-the-manual-way-on-unix-platforms)
27+
* [Building on Windows](#building-on-windows)
28+
* [Cross Compiling](#cross-compiling)
29+
* [Prerequisites](#prerequisites-1)
30+
* [Building HIDAPI](#building-hidapi)
631

732
## About
833

9-
HIDAPI is a multi-platform library which allows an application to interface
10-
with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and Mac
11-
OS X. HIDAPI can be either built as a shared library (`.so` or `.dll`) or
12-
can be embedded directly into a target application by adding a single source
13-
file (per platform) and a single header.
14-
1534
HIDAPI has five back-ends:
16-
* Windows (using hid.dll)
35+
* Windows (using `hid.dll`)
1736
* Linux/hidraw (using the Kernel's hidraw driver)
1837
* Linux/libusb (using libusb-1.0)
1938
* FreeBSD (using libusb-1.0)
@@ -22,7 +41,8 @@ HIDAPI has five back-ends:
2241
On Linux, either the hidraw or the libusb back-end can be used. There are
2342
tradeoffs, and the functionality supported is slightly different.
2443

25-
Linux/hidraw (`linux/hid.c`):
44+
__Linux/hidraw__ (`linux/hid.c`):
45+
2646
This back-end uses the hidraw interface in the Linux kernel. While this
2747
back-end will support both USB and Bluetooth, it has some limitations on
2848
kernels prior to 2.6.39, including the inability to send or receive feature
@@ -31,12 +51,13 @@ hidraw nodes associated with them. Keyboards, mice, and some other devices
3151
which are blacklisted from having hidraw nodes will not work. Fortunately,
3252
for nearly all the uses of hidraw, this is not a problem.
3353

34-
Linux/FreeBSD/libusb (`libusb/hid.c`):
54+
__Linux/FreeBSD/libusb__ (`libusb/hid.c`):
55+
3556
This back-end uses libusb-1.0 to communicate directly to a USB device. This
3657
back-end will of course not work with Bluetooth devices.
3758

3859
HIDAPI also comes with a Test GUI. The Test GUI is cross-platform and uses
39-
Fox Toolkit (http://www.fox-toolkit.org). It will build on every platform
60+
Fox Toolkit <http://www.fox-toolkit.org>. It will build on every platform
4061
which HIDAPI supports. Since it relies on a 3rd party library, building it
4162
is optional but recommended because it is so useful when debugging hardware.
4263

@@ -112,17 +133,11 @@ int main(int argc, char* argv[])
112133
}
113134
```
114135
115-
If you have your own simple test programs which communicate with standard
116-
hardware development boards (such as those from Microchip, TI, Atmel,
117-
FreeScale and others), please consider sending me something like the above
118-
for inclusion into the HIDAPI source. This will help others who have the
119-
same hardware as you do.
120-
121136
## License
122-
HIDAPI may be used by one of three licenses as outlined in LICENSE.txt.
137+
HIDAPI may be used by one of three licenses as outlined in [LICENSE.txt](LICENSE.txt).
123138
124139
## Download
125-
HIDAPI can be downloaded from github
140+
HIDAPI can be downloaded from GitHub
126141
```sh
127142
git clone git://github.com/libusb/hidapi.git
128143
```
@@ -138,8 +153,8 @@ HIDAPI can be built in several different ways. If you elect to build a
138153
shared library, you will need to build it from the HIDAPI source
139154
distribution. If you choose instead to embed HIDAPI directly into your
140155
application, you can skip the building and look at the provided platform
141-
Makefiles for guidance. These platform Makefiles are located in linux/
142-
libusb/ mac/ and windows/ and are called Makefile-manual. In addition,
156+
Makefiles for guidance. These platform Makefiles are located in `linux/`,
157+
`libusb/`, `mac/` and `windows/` and are called `Makefile-manual`. In addition,
143158
Visual Studio projects are provided. Even if you're going to embed HIDAPI
144159
into your project, it is still beneficial to build the example programs.
145160

@@ -193,17 +208,17 @@ ports X11 libraries which are not compatible with the Apple X11
193208
libraries. If you install Fox with ports and then try to distribute
194209
your built app bundle, it will simply fail to run on other systems.
195210
To install Fox-Toolkit manually, download the source package from
196-
http://www.fox-toolkit.org, extract it, and run the following from
211+
<http://www.fox-toolkit.org>, extract it, and run the following from
197212
within the extracted source:
198213
```sh
199214
./configure && make && make install
200215
```
201216

202217
#### Windows:
203218
On Windows, if you want to build the test GUI, you will need to get
204-
the hidapi-externals.zip package from the download site. This
219+
the `hidapi-externals.zip` package from the download site. This
205220
contains pre-built binaries for Fox-toolkit. Extract
206-
hidapi-externals.zip just outside of hidapi, so that
221+
`hidapi-externals.zip` just outside of hidapi, so that
207222
hidapi-externals and hidapi are on the same level, as shown:
208223
```
209224
Parent_Folder
@@ -217,8 +232,8 @@ test GUI.
217232

218233
### Building HIDAPI into a shared library on Unix Platforms:
219234

220-
On Unix-like systems such as Linux, FreeBSD, Mac, and even Windows, using
221-
Mingw or Cygwin, the easiest way to build a standard system-installed shared
235+
On Unix-like systems such as Linux, FreeBSD, macOS, and even Windows, using
236+
MinGW or Cygwin, the easiest way to build a standard system-installed shared
222237
library is to use the GNU Autotools build system. If you checked out the
223238
source from the git repository, run the following:
224239

@@ -229,7 +244,7 @@ make
229244
make install # as root, or using sudo
230245
```
231246

232-
If you downloaded a source package (ie: if you did not run git clone), you
247+
If you downloaded a source package (i.e.: if you did not run git clone), you
233248
can skip the `./bootstrap` step.
234249

235250
`./configure` can take several arguments which control the build. The two most
@@ -253,7 +268,7 @@ to build a program which embeds HIDAPI directly inside of it. These should
253268
really be used as examples only. If you want to build a system-wide shared
254269
library, use the Autotools method described above.
255270

256-
To build HIDAPI using the manual makefiles, change to the directory
271+
To build HIDAPI using the manual Makefiles, change to the directory
257272
of your platform and run make. For example, on Linux run:
258273
```sh
259274
cd linux/
@@ -269,19 +284,20 @@ make -f Makefile-manual
269284
### Building on Windows:
270285

271286
To build the HIDAPI DLL on Windows using Visual Studio, build the `.sln` file
272-
in the windows/ directory.
287+
in the `windows/` directory.
273288

274289
To build the Test GUI on windows using Visual Studio, build the `.sln` file in
275-
the testgui/ directory.
290+
the `testgui/` directory.
276291

277292
To build HIDAPI using MinGW or Cygwin using Autotools, use the instructions
278-
in the section titled "Building HIDAPI into a shared library on Unix
279-
Platforms" above. Note that building the Test GUI with MinGW or Cygwin will
280-
require the Windows procedure in the Prerequisites section above (ie:
281-
hidapi-externals.zip).
293+
in the section [Building HIDAPI into a shared library on Unix Platforms](#building-hidapi-into-a-shared-library-on-unix-platforms)
294+
above. Note that building the Test GUI with MinGW or Cygwin will
295+
require the Windows procedure in the [Prerequisites](#prerequisites-1) section
296+
above (i.e.: `hidapi-externals.zip`).
282297

283298
To build HIDAPI using MinGW using the Manual Makefiles, see the section
284-
"Building the manual way on Unix platforms" above.
299+
[Building the manual way on Unix platforms](#building-the-manual-way-on-unix-platforms)
300+
above.
285301

286302
HIDAPI can also be built using the Windows DDK (now also called the Windows
287303
Driver Kit or WDK). This method was originally required for the HIDAPI build
@@ -293,16 +309,16 @@ not. To build using the DDK:
293309
2. From the Start menu, in the Windows Driver Kits folder, select Build
294310
Environments, then your operating system, then the x86 Free Build
295311
Environment (or one that is appropriate for your system).
296-
3. From the console, change directory to the windows/ddk_build/ directory,
312+
3. From the console, change directory to the `windows/ddk_build/` directory,
297313
which is part of the HIDAPI distribution.
298314
4. Type build.
299315
5. You can find the output files (DLL and LIB) in a subdirectory created
300316
by the build system which is appropriate for your environment. On
301-
Windows XP, this directory is objfre_wxp_x86/i386.
317+
Windows XP, this directory is `objfre_wxp_x86/i386`.
302318

303319
## Cross Compiling
304320

305-
This section talks about cross compiling HIDAPI for Linux using autotools.
321+
This section talks about cross compiling HIDAPI for Linux using Autotools.
306322
This is useful for using HIDAPI on embedded Linux targets. These
307323
instructions assume the most raw kind of embedded Linux build, where all
308324
prerequisites will need to be built first. This process will of course vary
@@ -322,7 +338,7 @@ $ export HOST=arm-linux
322338

323339
Note that the build of libudev is the very basic configuration.
324340

325-
Build Libusb. From the libusb source directory, run:
341+
Build libusb. From the libusb source directory, run:
326342
```sh
327343
./configure --host=$HOST --prefix=$STAGING
328344
make
@@ -346,10 +362,3 @@ PKG_CONFIG_LIBDIR=$STAGING/lib/pkgconfig:$STAGING/share/pkgconfig \
346362
PKG_CONFIG_SYSROOT_DIR=$STAGING \
347363
./configure --host=$HOST --prefix=$STAGING
348364
```
349-
350-
Signal 11 Software \
351-
2010-04-11 \
352-
2010-07-28 \
353-
2011-09-10 \
354-
2012-05-01 \
355-
2012-07-03

0 commit comments

Comments
 (0)