USB Gadget/Mass storage –

This allows your devices act as a USB mass storage like external hard drive or thumb drive.

Kernel support

Currently, the g_mass_storage module is not compiled as part of default kernel configuration.

To enable this, follow same kernel building information as previous section USB Ethernet support but instead of compiling “Ethernet Gadget”, select the following to “m”:

Device Drivers  --->
	USB support  --->
		USB Gadget Support  --->
			<M>     Mass Storage Gadget

You can now continue following manual build howto to continue kernel compilation and installation.

Preparing shared storage device

See “Backing Storage for the Mass Storage Gadget” for full instructions and recommendations.

Be aware that shared storage cannot be used in “read write” mode if both systems (device and host) are using it at same time except if you accept to corrupt your data…

An existing physical partition or a logical volume can be used as shared storage device; another

Read More

ueno/libusb-gadget: Simple wrapper library to access Linux USB GadgetFS

* 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.XX

After 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.ko

and mount the GadgetFS:

 $ sudo mkdir /dev/gadget
 $ sudo mount -t gadgetfs none /dev/gadget

Now you can try libusb-gadget.

 $ cd libusb-gadget
Read More