Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ueno/libusb-gadget
Simple wrapper library to access Linux USB GadgetFS
https://github.com/ueno/libusb-gadget
Last synced: 15 days ago
JSON representation
Simple wrapper library to access Linux USB GadgetFS
- Host: GitHub
- URL: https://github.com/ueno/libusb-gadget
- Owner: ueno
- License: lgpl-3.0
- Created: 2009-05-18T05:32:39.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2009-06-29T02:21:25.000Z (over 15 years ago)
- Last Synced: 2024-10-13T08:12:57.186Z (30 days ago)
- Language: C
- Homepage:
- Size: 91.8 KB
- Stars: 48
- Watchers: 7
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README
- License: COPYING.LESSER
Awesome Lists containing this project
README
* What's this?
libusb-gadget is a simple wrapper around Linux USB GadgetFS[1], which enables
USB target development in userspace. It allows developers to write a
trivial gadget in ~200 lines, while the original GadgetFS example[2]
is ~1700 lines.* Requirements
- linux 2.6.XX
* Quick start
I assume that you are using Debian GNU/Linux. Since the USB gadget
framework is not compiled in the stock kernel (as of 2.6.29-1), you
will need to generate a couple of kernel modules by hand:$ sudo apt-get install linux-source-2.6.XX linux-headers-2.6.XX
$ cd /usr/src
$ tar xf linux-source-2.6.XX.tar.bz2
$ cd libusb-gadget/scripts
$ ./generate-kernel-modules /usr/src/linux-source-2.6.XXAfter successful build, you will find "dummy_hcd.ko" and
"gadgetfs.ko" in the current working directory. You can load them with:$ sudo insmod dummy_hcd.ko
$ sudo insmod gadgetfs.koand mount the GadgetFS:
$ sudo mkdir /dev/gadget
$ sudo mount -t gadgetfs none /dev/gadgetNow you can try libusb-gadget.
$ cd libusb-gadget
$ ./configure
$ maketests/ contains an example gadget.
$ cd tests
$ sudo ./loopback 00FF:0000 # VEND:PRODOn another terminal:
$ cd libusb-gadget/tests
$ sudo ./loopback-test 00FF:0000 # VEND:PROD* Limitations
- Multithreading is necessary since /dev/gadget/$ENDPOINT (except for
ep0) do not support polling.- The endpoint number in the endpoint descriptor must be specified
explicitly, while the kernel space API assigns them automatically.- The max packet size is also mandatory in that descriptor.
* License
LGPLv3+. See COPYING.LESSER for detail.
Footnotes:
[1] http://www.linux-usb.org/gadget/
[2] http://www.linux-usb.org/gadget/usb.c* Copyright
All files are under the copyright of:
Copyright (C) 2009 Daiki Ueno
except src/usbstring.[ch] which are based on the version by David
Brownell and under the copyright of:Copyright (C) 2003 David Brownell