aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/usb/gadget_serial.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/usb/gadget_serial.txt')
-rw-r--r--Documentation/usb/gadget_serial.txt332
1 files changed, 332 insertions, 0 deletions
diff --git a/Documentation/usb/gadget_serial.txt b/Documentation/usb/gadget_serial.txt
new file mode 100644
index 000000000000..a938c3dd13d6
--- /dev/null
+++ b/Documentation/usb/gadget_serial.txt
@@ -0,0 +1,332 @@
1
2 Linux Gadget Serial Driver v2.0
3 11/20/2004
4
5
6License and Disclaimer
7----------------------
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License as
10published by the Free Software Foundation; either version 2 of
11the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public
19License along with this program; if not, write to the Free
20Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21MA 02111-1307 USA.
22
23This document and the the gadget serial driver itself are
24Copyright (C) 2004 by Al Borchers (alborchers@steinerpoint.com).
25
26If you have questions, problems, or suggestions for this driver
27please contact Al Borchers at alborchers@steinerpoint.com.
28
29
30Prerequisites
31-------------
32Versions of the gadget serial driver are available for the
332.4 Linux kernels, but this document assumes you are using
34version 2.0 or later of the gadget serial driver in a 2.6
35Linux kernel.
36
37This document assumes that you are familiar with Linux and
38Windows and know how to configure and build Linux kernels, run
39standard utilities, use minicom and HyperTerminal, and work with
40USB and serial devices. It also assumes you configure the Linux
41gadget and usb drivers as modules.
42
43
44Overview
45--------
46The gadget serial driver is a Linux USB gadget driver, a USB device
47side driver. It runs on a Linux system that has USB device side
48hardware; for example, a PDA, an embedded Linux system, or a PC
49with a USB development card.
50
51The gadget serial driver talks over USB to either a CDC ACM driver
52or a generic USB serial driver running on a host PC.
53
54 Host
55 --------------------------------------
56 | Host-Side CDC ACM USB Host |
57 | Operating | or | Controller | USB
58 | System | Generic USB | Driver |--------
59 | (Linux or | Serial | and | |
60 | Windows) Driver USB Stack | |
61 -------------------------------------- |
62 |
63 |
64 |
65 Gadget |
66 -------------------------------------- |
67 | Gadget USB Periph. | |
68 | Device-Side | Gadget | Controller | |
69 | Linux | Serial | Driver |--------
70 | Operating | Driver | and |
71 | System USB Stack |
72 --------------------------------------
73
74On the device-side Linux system, the gadget serial driver looks
75like a serial device.
76
77On the host-side system, the gadget serial device looks like a
78CDC ACM compliant class device or a simple vendor specific device
79with bulk in and bulk out endpoints, and it is treated similarly
80to other serial devices.
81
82The host side driver can potentially be any ACM compliant driver
83or any driver that can talk to a device with a simple bulk in/out
84interface. Gadget serial has been tested with the Linux ACM driver,
85the Windows usbser.sys ACM driver, and the Linux USB generic serial
86driver.
87
88With the gadget serial driver and the host side ACM or generic
89serial driver running, you should be able to communicate between
90the host and the gadget side systems as if they were connected by a
91serial cable.
92
93The gadget serial driver only provides simple unreliable data
94communication. It does not yet handle flow control or many other
95features of normal serial devices.
96
97
98Installing the Gadget Serial Driver
99-----------------------------------
100To use the gadget serial driver you must configure the Linux gadget
101side kernel for "Support for USB Gadgets", for a "USB Peripheral
102Controller" (for example, net2280), and for the "Serial Gadget"
103driver. All this are listed under "USB Gadget Support" when
104configuring the kernel. Then rebuild and install the kernel or
105modules.
106
107The gadget serial driver uses major number 127, for now. So you
108will need to create a device node for it, like this:
109
110 mknod /dev/ttygserial c 127 0
111
112You only need to do this once.
113
114Then you must load the gadget serial driver. To load it as an
115ACM device, do this:
116
117 modprobe g_serial use_acm=1
118
119To load it as a vendor specific bulk in/out device, do this:
120
121 modprobe g_serial
122
123This will also automatically load the underlying gadget peripheral
124controller driver. This must be done each time you reboot the gadget
125side Linux system. You can add this to the start up scripts, if
126desired.
127
128If gadget serial is loaded as an ACM device you will want to use
129either the Windows or Linux ACM driver on the host side. If gadget
130serial is loaded as a bulk in/out device, you will want to use the
131Linux generic serial driver on the host side. Follow the appropriate
132instructions below to install the host side driver.
133
134
135Installing the Windows Host ACM Driver
136--------------------------------------
137To use the Windows ACM driver you must have the files "gserial.inf"
138and "usbser.sys" together in a folder on the Windows machine.
139
140The "gserial.inf" file is given here.
141
142-------------------- CUT HERE --------------------
143[Version]
144Signature="$Windows NT$"
145Class=Ports
146ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
147Provider=%LINUX%
148DriverVer=08/17/2004,0.0.2.0
149; Copyright (C) 2004 Al Borchers (alborchers@steinerpoint.com)
150
151[Manufacturer]
152%LINUX%=GSerialDeviceList
153
154[GSerialDeviceList]
155%GSERIAL%=GSerialInstall, USB\VID_0525&PID_A4A7
156
157[DestinationDirs]
158DefaultDestDir=10,System32\Drivers
159
160[GSerialInstall]
161CopyFiles=GSerialCopyFiles
162AddReg=GSerialAddReg
163
164[GSerialCopyFiles]
165usbser.sys
166
167[GSerialAddReg]
168HKR,,DevLoader,,*ntkern
169HKR,,NTMPDriver,,usbser.sys
170HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
171
172[GSerialInstall.Services]
173AddService = usbser,0x0002,GSerialService
174
175[GSerialService]
176DisplayName = %GSERIAL_DISPLAY_NAME%
177ServiceType = 1 ; SERVICE_KERNEL_DRIVER
178StartType = 3 ; SERVICE_DEMAND_START
179ErrorControl = 1 ; SERVICE_ERROR_NORMAL
180ServiceBinary = %10%\System32\Drivers\usbser.sys
181LoadOrderGroup = Base
182
183[Strings]
184LINUX = "Linux"
185GSERIAL = "Gadget Serial"
186GSERIAL_DISPLAY_NAME = "USB Gadget Serial Driver"
187-------------------- CUT HERE --------------------
188
189The "usbser.sys" file comes with various versions of Windows.
190For example, it can be found on Windows XP typically in
191
192 C:\WINDOWS\Driver Cache\i386\driver.cab
193
194Or it can be found on the Windows 98SE CD in the "win98" folder
195in the "DRIVER11.CAB" through "DRIVER20.CAB" cab files. You will
196need the DOS "expand" program, the Cygwin "cabextract" program, or
197a similar program to unpack these cab files and extract "usbser.sys".
198
199For example, to extract "usbser.sys" into the current directory
200on Windows XP, open a DOS window and run a command like
201
202 expand C:\WINDOWS\Driver~1\i386\driver.cab -F:usbser.sys .
203
204(Thanks to Nishant Kamat for pointing out this DOS command.)
205
206When the gadget serial driver is loaded and the USB device connected
207to the Windows host with a USB cable, Windows should recognize the
208gadget serial device and ask for a driver. Tell Windows to find the
209driver in the folder that contains "gserial.inf" and "usbser.sys".
210
211For example, on Windows XP, when the gadget serial device is first
212plugged in, the "Found New Hardware Wizard" starts up. Select
213"Install from a list or specific location (Advanced)", then on
214the next screen select "Include this location in the search" and
215enter the path or browse to the folder containing "gserial.inf" and
216"usbser.sys". Windows will complain that the Gadget Serial driver
217has not passed Windows Logo testing, but select "Continue anyway"
218and finish the driver installation.
219
220On Windows XP, in the "Device Manager" (under "Control Panel",
221"System", "Hardware") expand the "Ports (COM & LPT)" entry and you
222should see "Gadget Serial" listed as the driver for one of the COM
223ports.
224
225To uninstall the Windows XP driver for "Gadget Serial", right click
226on the "Gadget Serial" entry in the "Device Manager" and select
227"Uninstall".
228
229
230Installing the Linux Host ACM Driver
231------------------------------------
232To use the Linux ACM driver you must configure the Linux host side
233kernel for "Support for Host-side USB" and for "USB Modem (CDC ACM)
234support".
235
236Once the gadget serial driver is loaded and the USB device connected
237to the Linux host with a USB cable, the host system should recognize
238the gadget serial device. For example, the command
239
240 cat /proc/bus/usb/devices
241
242should show something like this:
243
244T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 5 Spd=480 MxCh= 0
245D: Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
246P: Vendor=0525 ProdID=a4a7 Rev= 2.01
247S: Manufacturer=Linux 2.6.8.1 with net2280
248S: Product=Gadget Serial
249S: SerialNumber=0
250C:* #Ifs= 2 Cfg#= 2 Atr=c0 MxPwr= 2mA
251I: If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=acm
252E: Ad=83(I) Atr=03(Int.) MxPS= 8 Ivl=32ms
253I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=acm
254E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
255E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
256
257If the host side Linux system is configured properly, the ACM driver
258should be loaded automatically. The command "lsmod" should show the
259"acm" module is loaded.
260
261
262Installing the Linux Host Generic USB Serial Driver
263---------------------------------------------------
264To use the Linux generic USB serial driver you must configure the
265Linux host side kernel for "Support for Host-side USB", for "USB
266Serial Converter support", and for the "USB Generic Serial Driver".
267
268Once the gadget serial driver is loaded and the USB device connected
269to the Linux host with a USB cable, the host system should recognize
270the gadget serial device. For example, the command
271
272 cat /proc/bus/usb/devices
273
274should show something like this:
275
276T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 6 Spd=480 MxCh= 0
277D: Ver= 2.00 Cls=ff(vend.) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
278P: Vendor=0525 ProdID=a4a6 Rev= 2.01
279S: Manufacturer=Linux 2.6.8.1 with net2280
280S: Product=Gadget Serial
281S: SerialNumber=0
282C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 2mA
283I: If#= 0 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=serial
284E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
285E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
286
287You must explicitly load the usbserial driver with parameters to
288configure it to recognize the gadget serial device, like this:
289
290 modprobe usbserial vendor=0x0525 product=0xA4A6
291
292If everything is working, usbserial will print a message in the
293system log saying something like "Gadget Serial converter now
294attached to ttyUSB0".
295
296
297Testing with Minicom or HyperTerminal
298-------------------------------------
299Once the gadget serial driver and the host driver are both installed,
300and a USB cable connects the gadget device to the host, you should
301be able to communicate over USB between the gadget and host systems.
302You can use minicom or HyperTerminal to try this out.
303
304On the gadget side run "minicom -s" to configure a new minicom
305session. Under "Serial port setup" set "/dev/ttygserial" as the
306"Serial Device". Set baud rate, data bits, parity, and stop bits,
307to 9600, 8, none, and 1--these settings mostly do not matter.
308Under "Modem and dialing" erase all the modem and dialing strings.
309
310On a Linux host running the ACM driver, configure minicom similarly
311but use "/dev/ttyACM0" as the "Serial Device". (If you have other
312ACM devices connected, change the device name appropriately.)
313
314On a Linux host running the USB generic serial driver, configure
315minicom similarly, but use "/dev/ttyUSB0" as the "Serial Device".
316(If you have other USB serial devices connected, change the device
317name appropriately.)
318
319On a Windows host configure a new HyperTerminal session to use the
320COM port assigned to Gadget Serial. The "Port Settings" will be
321set automatically when HyperTerminal connects to the gadget serial
322device, so you can leave them set to the default values--these
323settings mostly do not matter.
324
325With minicom configured and running on the gadget side and with
326minicom or HyperTerminal configured and running on the host side,
327you should be able to send data back and forth between the gadget
328side and host side systems. Anything you type on the terminal
329window on the gadget side should appear in the terminal window on
330the host side and vice versa.
331
332