You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]>
Copy file name to clipboardExpand all lines: README.md
+56-47Lines changed: 56 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff 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.
2
8
3
9
HIDAPI library was originally developed by Alan Ott ([signal11](https://github.com/signal11)).
4
10
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)
6
31
7
32
## About
8
33
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
-
15
34
HIDAPI has five back-ends:
16
-
* Windows (using hid.dll)
35
+
* Windows (using `hid.dll`)
17
36
* Linux/hidraw (using the Kernel's hidraw driver)
18
37
* Linux/libusb (using libusb-1.0)
19
38
* FreeBSD (using libusb-1.0)
@@ -22,7 +41,8 @@ HIDAPI has five back-ends:
22
41
On Linux, either the hidraw or the libusb back-end can be used. There are
23
42
tradeoffs, and the functionality supported is slightly different.
24
43
25
-
Linux/hidraw (`linux/hid.c`):
44
+
__Linux/hidraw__ (`linux/hid.c`):
45
+
26
46
This back-end uses the hidraw interface in the Linux kernel. While this
27
47
back-end will support both USB and Bluetooth, it has some limitations on
28
48
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
31
51
which are blacklisted from having hidraw nodes will not work. Fortunately,
32
52
for nearly all the uses of hidraw, this is not a problem.
33
53
34
-
Linux/FreeBSD/libusb (`libusb/hid.c`):
54
+
__Linux/FreeBSD/libusb__ (`libusb/hid.c`):
55
+
35
56
This back-end uses libusb-1.0 to communicate directly to a USB device. This
36
57
back-end will of course not work with Bluetooth devices.
37
58
38
59
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
40
61
which HIDAPI supports. Since it relies on a 3rd party library, building it
41
62
is optional but recommended because it is so useful when debugging hardware.
42
63
@@ -112,17 +133,11 @@ int main(int argc, char* argv[])
112
133
}
113
134
```
114
135
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
-
121
136
## 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).
123
138
124
139
## Download
125
-
HIDAPI can be downloaded from github
140
+
HIDAPI can be downloaded from GitHub
126
141
```sh
127
142
git clone git://github.com/libusb/hidapi.git
128
143
```
@@ -138,8 +153,8 @@ HIDAPI can be built in several different ways. If you elect to build a
138
153
shared library, you will need to build it from the HIDAPI source
139
154
distribution. If you choose instead to embed HIDAPI directly into your
140
155
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,
143
158
Visual Studio projects are provided. Even if you're going to embed HIDAPI
144
159
into your project, it is still beneficial to build the example programs.
145
160
@@ -193,17 +208,17 @@ ports X11 libraries which are not compatible with the Apple X11
193
208
libraries. If you install Fox with ports and then try to distribute
194
209
your built app bundle, it will simply fail to run on other systems.
195
210
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
197
212
within the extracted source:
198
213
```sh
199
214
./configure && make && make install
200
215
```
201
216
202
217
#### Windows:
203
218
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
205
220
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
207
222
hidapi-externals and hidapi are on the same level, as shown:
208
223
```
209
224
Parent_Folder
@@ -217,8 +232,8 @@ test GUI.
217
232
218
233
### Building HIDAPI into a shared library on Unix Platforms:
219
234
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
222
237
library is to use the GNU Autotools build system. If you checked out the
223
238
source from the git repository, run the following:
224
239
@@ -229,7 +244,7 @@ make
229
244
make install # as root, or using sudo
230
245
```
231
246
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
233
248
can skip the `./bootstrap` step.
234
249
235
250
`./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
253
268
really be used as examples only. If you want to build a system-wide shared
254
269
library, use the Autotools method described above.
255
270
256
-
To build HIDAPI using the manual makefiles, change to the directory
271
+
To build HIDAPI using the manual Makefiles, change to the directory
257
272
of your platform and run make. For example, on Linux run:
258
273
```sh
259
274
cd linux/
@@ -269,19 +284,20 @@ make -f Makefile-manual
269
284
### Building on Windows:
270
285
271
286
To build the HIDAPI DLL on Windows using Visual Studio, build the `.sln` file
272
-
in the windows/ directory.
287
+
in the `windows/` directory.
273
288
274
289
To build the Test GUI on windows using Visual Studio, build the `.sln` file in
275
-
the testgui/ directory.
290
+
the `testgui/` directory.
276
291
277
292
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`).
282
297
283
298
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.
285
301
286
302
HIDAPI can also be built using the Windows DDK (now also called the Windows
287
303
Driver Kit or WDK). This method was originally required for the HIDAPI build
@@ -293,16 +309,16 @@ not. To build using the DDK:
293
309
2. From the Start menu, in the Windows Driver Kits folder, select Build
294
310
Environments, then your operating system, then the x86 Free Build
295
311
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,
297
313
which is part of the HIDAPI distribution.
298
314
4. Type build.
299
315
5. You can find the output files (DLL and LIB) in a subdirectory created
300
316
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`.
302
318
303
319
## Cross Compiling
304
320
305
-
This section talks about cross compiling HIDAPI for Linux using autotools.
321
+
This section talks about cross compiling HIDAPI for Linux using Autotools.
306
322
This is useful for using HIDAPI on embedded Linux targets. These
307
323
instructions assume the most raw kind of embedded Linux build, where all
308
324
prerequisites will need to be built first. This process will of course vary
@@ -322,7 +338,7 @@ $ export HOST=arm-linux
322
338
323
339
Note that the build of libudev is the very basic configuration.
324
340
325
-
Build Libusb. From the libusb source directory, run:
341
+
Build libusb. From the libusb source directory, run:
0 commit comments