© 2014 Digi International Inc.
12
ConnectCore 6 Linux BSP Reference Manual
Serial gadget
To load the serial gadget:
The serial gadget exposes a TTY style serial line interface, usable with
minicom
and similar tools.
Most Linux hosts can talk to this using the generic usb-serial driver. The latest versions of this
driver implement the CDC ACM class. This driver works with the MS-Windows usbser.sys driver,
the Linux cdc-acm driver, and many other USB Host systems. The kernel has a detailed
documentation file at
Documentation/usb/gadget_serial.txt
with information on how to set up
this driver with both Windows and Linux systems. Follow the instructions in this file for exposing
your target as a serial port to the eyes of a USB host.
Ethernet gadget
By loading the Ethernet gadget the target enumerates to the host computer as an Ethernet
device, using the usbnet driver on Linux hosts or Microsoft's RNDIS driver on Windows hosts.
To load the Ethernet gadget:
This command will create an Ethernet interface in the target called
usb0
and will assign random
MAC addresses to the target and the host.
We need to give this new network interface
usb0
an IP address, for example:
On a host computer, the
usbnet
module must be loaded so that the device is recognized:
Now the target can be accessed via the USB cable as if it was an Ethernet port. You can do a
ping or open a telnet session from the host to the target or viceversa.
File-backed mass storage gadget
This gadget implements the USB Mass Storage class, appearing to the host as a SCSI disk drive.
A file or block device can be used as a backing store for the drive.
# modprobe configfs
# modprobe libcomposite
# modprobe usb_f_acm
# modprobe u_serial
# cd
# modprobe configfs
# modprobe libcomposite
# modprobe g_ether
# ifconfig usb0 192.168.44.30 netmask 255.255.255.0
$ sudo modprobe usbnet
$ ifconfig usb0 192.168.44.1 netmask 255.255.255.0