Bring in libusb20 examples from FreeBSD.
[dragonfly.git] / share / examples / libusb20 / README
1 As I dug my own way through the documentation of libusb 2.0 that ships
2 with FreeBSD 8+ as the OS'es own USB library API, I noticed there are
3 only few code examples around under /usr/src (namely, usbconfig
4 itself).
5
6 The libusb20(3) man page is a starting point, but it's a reference
7 manual, nothing less, nothing more.  Using just a reference, it's not
8 very easy to start writing your own code based on that.
9
10 So I started writing my own examples, to "get a feeling" about how to
11 use the library.  I covered two typical scenarios which are common for
12 a number of devices.
13
14 The first one is called "bulk", and uses bulk output (host to device)
15 and input transfers to talk to an USB device.
16
17 The second one is called "control", and can use both control output
18 and input transfers, as well as so-called interrupt transfers.  The
19 latter are used for data that are being reported frequently or
20 repeatedly, like position updates from a pointing device (mouse).
21 Despite of its name, the host has to poll devices for their interrupt
22 transfers on each USB frame (i.e., each 1 ms).
23
24 Recommended reading is the USB 3.0 specification (the older 2.0 one
25 would do as well), to be found under
26
27 http://www.usb.org/developers/docs/
28
29 as well as documents for individual USB device classes where
30 appropriate.
31
32 Feel free to be liberal in the licensing of these examples: while the
33 beer-ware license mandates to keep the license notice, this only
34 applies to modifications of the original examples itself.  For
35 copy&pasting (even a larger) piece of an example into your own work, I
36 won't imply you have to reproduce the beer-ware license text there.
37 Feel free to credit my name in your derived work if you want.
38
39 Dresden, July 2012
40 Joerg Wunsch <joerg@FreeBSD.org>
41
42 # $FreeBSD: head/share/examples/libusb20/README 238603 2012-07-18 21:30:17Z joerg $