Both Microsoft Windows and Linux offer a generic driver for using a USB to serial converter device. This page details the steps required to make use of them.
On Microsoft Windows, the standard USB serial driver is named usbser.sys and is part of the standard set of drivers. It has been available since Windows 98SE. However, conversely to other generic driver such as the one for Mass Storage Devices (MSD), usbser.sys is not automatically loaded when a CDC device is plugged in.
For Windows to recognize the device correctly, it is necessary to write a .inf file. The Windows Driver Development Kit (DDK) contains information on this topic. A basic driver, named 6119.inf in the example software provided, will now be described. The driver file is made up of several sections.
The first section of the .inf file must be the [Version] section. It contains information about the driver version, provider, release data, and so on.
[Version]
Signature="$Chicago$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%ATMEL%
DriverVer=09/12/2006,1.1.1.1
The Signature attribute is mandatory and can be either "$Windows 95$", "$Windows NT$" or "$Chicago$", depending on which Windows version(s) the driver supports. "$Chicago$" is used to notify that every Windows version is supported. Since in this example, the USB to serial converter is a virtual COM port, the Class attribute should be equal to "Ports". The value of ClassGuid depends on which class the device uses. The Provider value indicates that the string descriptor for the driver provider will be defined further, under the tag ATMEL. Finally, the last tag show the driver version and release date. For the version number, each digit is optional (except the first one), but must not be null if present.
Next come two sections, [SourceDisksNames] and [SourceDisksFiles]. They are used to specify the installation disks required and the location of each needed files on these disks. But they are not implemented because the file is offered by windows or its install disk automatically.
;[SourceDisksNames]
;1="Windows Install CD"
;[SourceDisksFiles]
;usbser.sys=1
The driver file must now specify where copied files will be stored, using the [DestinationDirs] section.
[DestinationDirs] DefaultDestDir=12
The target directory must be identified by its ID, which is system-defined. The ID for the drivers directory is 12.
The [Manufacturer] section lists the possible manufacturers for all devices supported by this driver. In this case, the only supported device is an ATMEL one, so this will be the only value.
[Manufacturer] %ATMEL%=AtmelMfg
The attribute must be a string tag; its value must be the name of the Models section in which all supported devices from this manufacturer will be listed. In this case, it will be named AtmelMfg, which is the next section.
Each Models section must list the hardware ID of each supported device. For USB devices, the hardware ID is made up of the Vendor ID, the Product ID and (optionally) the Device Release Number. Those values are extracted from the device descriptor provided during the enumeration phase.
[AtmelMfg] %USBtoSerialConverter%=USBtoSer.Install,USB\VID_03EB&PID_6119
The attribute name is again a string tag, which will be used to describe the device. The value is comprised of both the device install section name (USBtoSer.Install) and the hardware ID. The hardware ID is the same as the one defined in "CDC Serial Device IDs".
Now, the .inf file must detail the install section of each device previously listed. In this example, there is only one install section, named [USBtoSer.Install]:
[USBtoSer.Install] CopyFiles=USBtoSer.CopyFiles AddReg=USBtoSer.AddReg [USBtoSer.CopyFiles] usbser.sys,,,0x00000002 [USBtoSer.AddReg] HKR,,DevLoader,,*ntkern HKR,,NTMPDriver,,usbser.sys [USBtoSer.Install.Services] AddService=usbser,0x00000002,USBtoSer.AddService [USBtoSer.AddService] DisplayName=%USBSer% ServiceType=1r StartType=3 ServiceBinary=%12%\usbser.sys
The install section is actually divided in five. In the first section, two other section names are specified: one for the list of files to copy, and one for the keys to add to the Windows registry. There is only one file to copy, usbser.sys; a flag (0x00000002) is used to specify that the user cannot skip copying it. The registry keys are needed to install the driver on older versions of Windows (such as Windows 98). For newer versions, the [USBtoSer.Install.Services] registers the needed kernel services; each service is actually listed in a section on its own.
Finally, the last section, [Strings], defines all the string constants used through this file:
[Strings] ATMEL="ATMEL Corp." USBtoSerialConverter="AT91 USB to Serial Converter" USBSer="USB Serial Driver"
When a new device is plugged in for the first time, Windows looks for an appropriate specific or generic driver to use it. If it does not find one, the user is asked what to do.
This is the case with the USB to serial converter, since there is no generic driver for it. To install the custom driver given in the previous section, Windows must be told where to look for it. This can be done by selecting the second option, "Install from a list or specific location", when the driver installation wizards pops up. It will then ask for the directory where the driver is located. After that, it should recognize the "AT91 USB to Serial Converter" driver as an appropriate one and display it in the list.
During the installation, the wizard asks for the location of the usbser.sys file. If it is already installed on the system, it can be found in "C:\Windows\System32\Drivers\". Otherwise, it is present on the Windows installation CD.
Once the driver is installed properly, a new COM port is added to the system and can be used with HyperTerminal, for example.
Linux has two different generic drivers which are appropriate for a USB to serial converter. The first one is an Abstract Control Model driver designed for modem devices, and is simply named acm. The other one is a generic USB to serial driver named usbserial.
If the support for the acm driver has been compiled in the kernel, Linux will automatically load it. A new terminal device will be created under /dev/ttyACMx.
The usbserial driver must be loaded manually by using the modprobe command with the vendor ID and product ID values used by the device:
modprobe usbserial vendor=0x03EB product=0x6119
Once the driver is loaded, a new terminal entry appears and should be named /dev/ttyUSBx.