6ul USB OTG
The platform includes a single USB OTG port. The default kernel build includes several device profiles. Additional devices can be compiled into the kernel. Some device usage examples are outlined below.
USB Serial
modprobe g_serial use_acm=1
This will create a "/dev/ttyGS0" device on the platform itself. The host PC connected to it will appear as a CDC-ACM device. See the kernel documentation for more information:
USB Ethernet
modprobe g_ether
This provides a "usb0" network interface device to both the platform and the host PC which simulates an ethernet network connection between them. IP addresses can be statically assigned, or either computer can run its own DHCP server.
Mass Storage
modprobe g_mass_storage file=/dev/mmcblk0
This will present the SD card to the host PC connected to the USB port. Example of connection to a host PC:
[85421.087855] scsi 4:0:0:0: Direct-Access Linux File-Stor Gadget 0401 PQ: 0 ANSI: 2 [85421.088486] sd 4:0:0:0: Attached scsi generic sg2 type 0 [85421.089546] sd 4:0:0:0: [sdc] 31116288 512-byte logical blocks: (15.9 GB/14.8 GiB) [85421.196213] sd 4:0:0:0: [sdc] Write Protect is off [85421.196218] sd 4:0:0:0: [sdc] Mode Sense: 0f 00 00 00 [85421.306216] sd 4:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [85421.530556] sdc: sdc1 [85421.746283] sd 4:0:0:0: [sdc] Attached SCSI disk
With "g_mass_storage" whole disks can be exposed, partitions, or even just files on a disk. Note that it is generally not safe to export a mounted disk in this way.