Commit a7707adf authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

usb gadget: use new serial core

Teach "gadget serial" to use the new abstracted (and bugfixed) TTY glue,
and remove all the orignal tangled-up code.  Update the documentation
accordingly.  This is a net object code shrink and cleanup; it should
make it a lot easier to see how the TTY glue should accomodate updates
to the TTY layer, be bugfixed, etc.

Notable behavior changes include:  it can now support getty even when
there's no USB connection; it fits properly into the mdev/udev world;
and RX handling is better (throttling works, and low latency).

Configurations with scripts setting up the /dev/ttygserial device node
(with "experimental" major number) may want to change that to be a
symlink pointing to the /dev/ttyGS0 file, as a migration aid; else,
just switch entirely over to mdev/udev.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c1dca562
Linux Gadget Serial Driver v2.0 Linux Gadget Serial Driver v2.0
11/20/2004 11/20/2004
(updated 8-May-2008 for v2.3)
License and Disclaimer License and Disclaimer
...@@ -31,7 +32,7 @@ Prerequisites ...@@ -31,7 +32,7 @@ Prerequisites
------------- -------------
Versions of the gadget serial driver are available for the Versions of the gadget serial driver are available for the
2.4 Linux kernels, but this document assumes you are using 2.4 Linux kernels, but this document assumes you are using
version 2.0 or later of the gadget serial driver in a 2.6 version 2.3 or later of the gadget serial driver in a 2.6
Linux kernel. Linux kernel.
This document assumes that you are familiar with Linux and This document assumes that you are familiar with Linux and
...@@ -40,6 +41,12 @@ standard utilities, use minicom and HyperTerminal, and work with ...@@ -40,6 +41,12 @@ standard utilities, use minicom and HyperTerminal, and work with
USB and serial devices. It also assumes you configure the Linux USB and serial devices. It also assumes you configure the Linux
gadget and usb drivers as modules. gadget and usb drivers as modules.
With version 2.3 of the driver, major and minor device nodes are
no longer statically defined. Your Linux based system should mount
sysfs in /sys, and use "mdev" (in Busybox) or "udev" to make the
/dev nodes matching the sysfs /sys/class/tty files.
Overview Overview
-------- --------
...@@ -104,15 +111,8 @@ driver. All this are listed under "USB Gadget Support" when ...@@ -104,15 +111,8 @@ driver. All this are listed under "USB Gadget Support" when
configuring the kernel. Then rebuild and install the kernel or configuring the kernel. Then rebuild and install the kernel or
modules. modules.
The gadget serial driver uses major number 127, for now. So you
will need to create a device node for it, like this:
mknod /dev/ttygserial c 127 0
You only need to do this once.
Then you must load the gadget serial driver. To load it as an Then you must load the gadget serial driver. To load it as an
ACM device, do this: ACM device (recommended for interoperability), do this:
modprobe g_serial use_acm=1 modprobe g_serial use_acm=1
...@@ -125,6 +125,23 @@ controller driver. This must be done each time you reboot the gadget ...@@ -125,6 +125,23 @@ controller driver. This must be done each time you reboot the gadget
side Linux system. You can add this to the start up scripts, if side Linux system. You can add this to the start up scripts, if
desired. desired.
Your system should use mdev (from busybox) or udev to make the
device nodes. After this gadget driver has been set up you should
then see a /dev/ttyGS0 node:
# ls -l /dev/ttyGS0 | cat
crw-rw---- 1 root root 253, 0 May 8 14:10 /dev/ttyGS0
#
Note that the major number (253, above) is system-specific. If
you need to create /dev nodes by hand, the right numbers to use
will be in the /sys/class/tty/ttyGS0/dev file.
When you link this gadget driver early, perhaps even statically,
you may want to set up an /etc/inittab entry to run "getty" on it.
The /dev/ttyGS0 line should work like most any other serial port.
If gadget serial is loaded as an ACM device you will want to use If gadget serial is loaded as an ACM device you will want to use
either the Windows or Linux ACM driver on the host side. If gadget either the Windows or Linux ACM driver on the host side. If gadget
serial is loaded as a bulk in/out device, you will want to use the serial is loaded as a bulk in/out device, you will want to use the
......
...@@ -24,7 +24,7 @@ obj-$(CONFIG_USB_M66592) += m66592-udc.o ...@@ -24,7 +24,7 @@ obj-$(CONFIG_USB_M66592) += m66592-udc.o
# #
g_zero-objs := zero.o usbstring.o config.o epautoconf.o g_zero-objs := zero.o usbstring.o config.o epautoconf.o
g_ether-objs := ether.o usbstring.o config.o epautoconf.o g_ether-objs := ether.o usbstring.o config.o epautoconf.o
g_serial-objs := serial.o usbstring.o config.o epautoconf.o g_serial-objs := serial.o u_serial.o usbstring.o config.o epautoconf.o
g_midi-objs := gmidi.o usbstring.o config.o epautoconf.o g_midi-objs := gmidi.o usbstring.o config.o epautoconf.o
gadgetfs-objs := inode.o gadgetfs-objs := inode.o
g_file_storage-objs := file_storage.o usbstring.o config.o \ g_file_storage-objs := file_storage.o usbstring.o config.o \
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment