1*3b9676efSJoerg WunschAs I dug my own way through the documentation of libusb 2.0 that ships 2*3b9676efSJoerg Wunschwith FreeBSD 8+ as the OS'es own USB library API, I noticed there are 3*3b9676efSJoerg Wunschonly few code examples around under /usr/src (namely, usbconfig 4*3b9676efSJoerg Wunschitself). 5*3b9676efSJoerg Wunsch 6*3b9676efSJoerg WunschThe libusb20(3) man page is a starting point, but it's a reference 7*3b9676efSJoerg Wunschmanual, nothing less, nothing more. Using just a reference, it's not 8*3b9676efSJoerg Wunschvery easy to start writing your own code based on that. 9*3b9676efSJoerg Wunsch 10*3b9676efSJoerg WunschSo I started writing my own examples, to "get a feeling" about how to 11*3b9676efSJoerg Wunschuse the library. I covered two typical scenarios which are common for 12*3b9676efSJoerg Wunscha number of devices. 13*3b9676efSJoerg Wunsch 14*3b9676efSJoerg WunschThe first one is called "bulk", and uses bulk output (host to device) 15*3b9676efSJoerg Wunschand input transfers to talk to an USB device. 16*3b9676efSJoerg Wunsch 17*3b9676efSJoerg WunschThe second one is called "control", and can use both control output 18*3b9676efSJoerg Wunschand input transfers, as well as so-called interrupt transfers. The 19*3b9676efSJoerg Wunschlatter are used for data that are being reported frequently or 20*3b9676efSJoerg Wunschrepeatedly, like position updates from a pointing device (mouse). 21*3b9676efSJoerg WunschDespite of its name, the host has to poll devices for their interrupt 22*3b9676efSJoerg Wunschtransfers on each USB frame (i.e., each 1 ms). 23*3b9676efSJoerg Wunsch 24*3b9676efSJoerg WunschRecommended reading is the USB 3.0 specification (the older 2.0 one 25*3b9676efSJoerg Wunschwould do as well), to be found under 26*3b9676efSJoerg Wunsch 27*3b9676efSJoerg Wunschhttp://www.usb.org/developers/docs/ 28*3b9676efSJoerg Wunsch 29*3b9676efSJoerg Wunschas well as documents for individual USB device classes where 30*3b9676efSJoerg Wunschappropriate. 31*3b9676efSJoerg Wunsch 32*3b9676efSJoerg WunschFeel free to be liberal in the licensing of these examples: while the 33*3b9676efSJoerg Wunschbeer-ware license mandates to keep the license notice, this only 34*3b9676efSJoerg Wunschapplies to modifications of the original examples itself. For 35*3b9676efSJoerg Wunschcopy&pasting (even a larger) piece of an example into your own work, I 36*3b9676efSJoerg Wunschwon't imply you have to reproduce the beer-ware license text there. 37*3b9676efSJoerg WunschFeel free to credit my name in your derived work if you want. 38*3b9676efSJoerg Wunsch 39*3b9676efSJoerg WunschDresden, July 2012 40*3b9676efSJoerg WunschJoerg Wunsch <joerg@FreeBSD.org> 41