USB2.0 Study Note Series (iii): General USB Driver parsing

Source: Internet
Author: User

For USB driver Development, readers can use the Windows DDK, DriverStudio and other development tools to achieve USB driver, but the driver development process is more complex, and it is easy to cause the USB host memory leak and panic. So for the author like to do hardware research and development on the software is not very cold child paper, how to quickly develop a USB drive. In fact, many USB chip companies have been to many users to provide development packages, such as the author used by the Cypress company to provide the development package to meet the requirements of the vast number of users, this is still a value of praise, about how to use these development packages for USB2.0 driver development, the author will write in the following blog one by one.

So before completing the USB drive, let's look at the architecture of the USB driver.

I did not know the USB drive before, but I often think, I will USB device to the computer's USB interface, then the main opportunity to identify my device, to drive the installation, and then communicate and management, then how to achieve this process?

With this problem, I searched for some information.

The driver of USB device is the bridge between USB host application and USB external device, and the USB driver of university is the key to the development of USB device. Then the most critical two files in the driver, one is the driver file (*.sys): The core file of the hardware device driver, provides the communication channel and method of the application and the external hardware device, the other is the device information file (*.inf): contains the corresponding hardware device and its driver details, This information includes the hardware device name, what driver files are used, storage of hardware device information in the system registry, and so on. A driver needs to be installed with an INF file.

As can be seen above, the driver has two files that must be used together (*.sys) and (*.inf). Let's review the installation process for USB devices, as shown in:

The USB device needs to be retrieved and installed after the host detects the USB device. This installation process is to find the corresponding USB device ID (*.inf) file, if the host automatic retrieval found in the (*.inf) file, will show that the installation is successful, if the INF file is not found, then will be prompted to find the driver, this time need to manually (*.inf) file configuration. The configuration information inside the INF file is also very important, which is a driver INF file that I open freely. What information is in the INF file? Which of our users can be modified? What does each message mean?

INF file consists of three important sections: section, key (value), as shown in [version] is a section, class is the key, and USB is the value of the key class. Each section can contain a key and a value, as shown in.

So what does the corresponding sections mean?

Version: The release section, at the beginning of the INF file, is used primarily for versioning and version description information.

Version versions section is generally located at the beginning of the INF file, important for versioning, mainly includes the content as follows: Signature: Defines what system the INF file needs to run under, typically there are several operating system versions

? $Windows nt$
? $Chicago $
? $Windows 95$

Class is used to describe the category that the driver belongs to, commonly used in the following categories:

Classguid are generally fixed values, as shown in:

Provider Items
The Provider entry for version section is used to indicate the vendor name of the driver INF file.
catalogfile Items
The Catalogfile entry for version section, which indicates the file name of the driver digital signature file, whose extension
The name is. Cat.

DriverVer Items
The DriverVer entry for version section, which indicates the version information for the driver. The format of the version is
MM/DD/YYYY[,X.Y.V.Z]. which
MM/DD/YYYY: Indicates the month/day/year.
X.Y.V.Z: Indicates the version number of the driver.

Source file disk abstracted (SourceDisksNames)

The source file disk abstracted (SourceDisksNames) is used to list the source file, the drive character sequence code, the disk descriptor, the disk volume
Label and disk serial number. The syntax format of the statement in the source file disk abstracted (SourceDisksNames) is as follows:
Disk-ordinal= "Disk-description", Disk-label,disk-serial-number
The meanings of these items are as follows:
Disk-ordinal: Represents the drive letter sequence code. Disk-ordinal identifies a source disk that has uniqueness. Generally it can be
To set to an integer that increments from 1, the drive letter sequence number cannot be duplicated when there are multiple source disks. Value
Note that 0 is not a valid drive-letter sequence code.
? Disk-description: Represents the disk descriptor, which is a string or string macro enclosed in double quotation marks to achieve
Description of the contents of the disk and other purposes. The installation engine displays the string in a dialog box to prompt the user.
? Disk-label: Represents the volume identity of the source disk.
? Disk-serial-number: Generally not used, but must be set to 0.
It is important to note that for a driver INF file, disk-ordinal and Disk-description are
Required option. The sample code for the typical source file disk abstracted (SourceDisksNames) is as follows:

[SourceDisksNames]
1=%cyusb_install%,,,

Source file section (SourceDisksFiles)

The source file section (SourceDisksFiles) is used to specify the source file and the character sequence code, the disk descriptor to use when installing.
The syntax for a statement within a source file section (SourceDisksFiles) is as follows:
File-name=disk-number[,subdir] [, File-size]
The meanings of these items are as follows:
? File-name: Represents the name of the file on the source disk.
? Disk-number: Represents the drive letter sequence code that contains the source disk of the File-name specified file, which requires
Listed in the source file disk abstracted (SourceDisksNames), and is greater than or equal to 1.
? SubDir: The subdirectory that specifies the source disk where the file is located, if omitted, the source disk is the default installation path.
? File-size: Used to indicate the size of the file, in bytes (byte).
It is important to note that for a driver INF file, File-name is the required option. A typical source text
The sample Code for section (SourceDisksFiles) is as follows:
[SourceDisksFiles]
Htdghusbme.sys = 1
Htdghusb.sys = 1
HTDGHUSB.SPD = 1

Target Disk section (DestinationDirs)

Target Disk section (DestinationDirs) is used to specify default actions for CopyFiles, RenFiles, or DelFiles portals
Table of contents, with syntax in the following format:
File-list-section=ldid, [SubDir]
Where subdir represents the directory address, and Ldid is the target directory type, the value of Ldid is as follows:
? LDID=01, indicates the target directory is the current directory;
? Ldid=04, indicates that the target directory is the back directory;
? Ldid=10, indicates that the target directory is the Windows directory;
? Ldid=11, indicates the target directory is the system directory;
? LDID=12, indicates the target directory is the driver directory;
? Ldid=13, indicates that the target directory is the command directory;
? Ldid=14, indicates that the target directory is the Control Panel directory;
? Ldid=15, indicates the target directory is the printer directory;
? Ldid=16, indicates that the target directory is a workgroup directory;
? Ldid=17, indicates the target directory is the INF directory;
? Ldid=18, indicates that the target directory is the Help directory;
? LDID=19, indicates the target directory is the Administrator directory;
? Ldid=20, indicates that the target directory is a font directory;
? Ldid=21, indicates that the target directory is the reader directory;
? When ldid=22, indicates that the target directory is the VMM directory;
? Ldid=23, indicates the target directory is a color directory;
? Ldid=25, indicates that the target directory is a shared directory;
? Ldid=26, indicates the target directory is the Winboot directory;
? Ldid=28, indicates the target directory is the host Winboot directory;
? Ldid=30, indicates that the target directory is the current root directory;
? Ldid=50, indicates that the target directory is the System directory;
? LDID=51, indicates the target directory is the Spool directory;
? Ldid=52, indicates that the target directory is Spool driver directory;
? Ldid=53, indicates that the target directory is the user configuration directory;
? When ldid=55, indicates that the target directory is the print processor directory.
The sample code for a typical target disk section (DestinationDirs) is as follows:

[DestinationDirs]
HTDGHUSBME.FILES.EXT = 10,system32\drivers
HTDGHUSB.FILES.EXT = 10,system32\drivers

Strings section (String)

The string section is used to define a string variable. The string section (string) length is used in the INF file for intermediate frequency
The occurrence of certain strings in a complex manner. Instead of using a string variable, you can achieve the purpose of simplifying the input.
The string variable is then used to represent the string that appears in the INF file. The format is defined as follows:
strkey= "String"
The meanings of these items are as follows:
? Strkey represents the name of a string, which consists of numbers and letters.
? String represents the contents of a string.
The sample code for a typical string section (string) is as follows:
[Strings]

Provider= "Cypress"
Mfgname= "Cypress"
Cyusb_install= "Cypress Generic USB Driver installation Disk"
vid_04b4&pid_8614.devicedesc= "Cypress ez-usb fx2lp-eeprom Missing"
vid_04b4&pid_6473.devicedesc= "Cypress ez-usb fx1-eeprom Missing"
vid_04b4&pid_1004.devicedesc= "Cypress ez-usb Example Device"
cyusb.svcdesc= "Cypress Generic USB Driver"

USB2.0 Study Note Series (iii): General USB Driver parsing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.