Design and Implementation of a USB Device That Can Automatically Identify WIN8 System

With the promotion of Microsoft's WIN8 system, Microsoft proposed a new MBIM network card specification. Therefore, for the existing wireless network card device, in order to achieve the effect of the free drive network card, the MBIM network card device must be enumerated on the WIN8 system. However, for WIN7 and XP systems, since the standard NIC device supported by the system is RNDIS, it is necessary to enumerate different USB NIC devices for different systems. Based on this problem, how to correctly identify the WIN8 system by the USB network card device becomes an urgent problem to be solved.

This article refers to the address: http://

If you want the USB device to automatically recognize whether the current operating system is a WIN8 system, you must find the difference between the WIN8 system and other WIN7/XP systems in the enumeration message when a USB device is connected to the host computer to start enumeration.

This article is to support multiple sets of USB configuration information on the USB device side, and use Microsoft defined MODs message as the basis to realize the purpose of USB device to automatically identify WIN8 system.

1 Overview of automatic identification of WIN8 system methods

1.1 Existing methods for identifying operating systems

1) The USB device is first virtualized as an optical disk device. When the user inserts the USB, the user needs to install the program in the optical disk and simultaneously install a filter driver on the PC. And in the driver to pre-implement the identification code agreed with the USB device, such as WINDOS system will issue 0xa1, WIN7 system will issue 0xa2. The downside of this approach is that vendors need to provide additional filtering drivers that affect the stability and user experience of the user's computer.

2) Using the SCSI command, different switching commands are pre-defined for different operating systems when the CD is ejected, thereby achieving the purpose of identifying the operating system. This method needs to implement the function of the self-contained optical disc in the USB device, which is inconvenient for the user's use.

3) Through the extended MODs of Microsoft, the system automatically recognizes the purpose in the device enumeration process. The method can only recognize that the PC currently connected to the USB device is a LINUX core system or a non-LINUX core system. For a non-LINUX core system, the effect of distinguishing between WIN8/WIN7 cannot be achieved.

1.2 Identifying WIN8 system methods through MODs messages and multiple sets of USB configurations

With the support of multiple sets of USB configuration information on the USB device side, when the USB device is inserted into the system for enumeration, the WIN8 system will issue multiple MODs messages to the USB device, but the WIN7/XP system only issues the MODs message once. In this way, it is determined whether the previously accessed operating system is a WIN8 system.

2 MODs-based USB device side program implementation

The USB device side must implement support for multiple sets of USB configurations and support for MODs request messages. Messages must be implemented according to specific definitions, and the definition of related messages in the USB 2.0 specification must be followed.

2.1 MODs defined message description

The symbolic meaning of MODs is Microsoft OS Descriptors, which are used to describe USB description messages for devices and their properties defined by Microsoft. The operating system or an application identifies whether the device supports a feature, such as identifying the type of operating system, by querying whether the USB device supports MODs messages.

1) OS String Descriptor message composition

Design and Implementation of a USB Device That Can Automatically Identify WIN8 System

2) OS Feature Descriptor message composition

Design and Implementation of a USB Device That Can Automatically Identify WIN8 System

2.2 USB device enumeration process supporting MODs messages

When the USB device is plugged into the WINDOWS system:

In the first step, the host first sends a request for acquiring the device information to the device, and the device immediately returns a response message to the host after receiving the request message;

In the second step, the host sends a request for obtaining configuration information of the device to the device again, and the device immediately returns a response message to the host after receiving the request message.

In the third step, the host sends a message request message to the device to determine whether the device supports the MODs function. After receiving the message, the device immediately sends a response message to the host, and the message includes the OS String Descri ptor message. It supports MODs function;

In the fourth step, after confirming that the device supports MODs, the host continues to send a request message (index is bMS_VendorCode field) for obtaining the specific features supported by the device. After receiving the request, the device immediately returns an OS Feature Descriptor message to the host, and sends a message. The features it supports. The flow chart is shown in Figure 3.

Design and Implementation of a USB Device That Can Automatically Identify WIN8 System

3 The overall process of program implementation

After the USB device is plugged into the PC:

In the first step, when the USB device is first inserted into the WINDOWS system host, the operating system immediately sends an OS String Descriptor request message to the device to obtain a description of the USB device and record whether the USB device replies with a valid OS String. The Descriptor requests a response to the host.

In the second step, if the operating system obtains an OS String Descriptor request response, it will immediately issue another request message (OS Feature Descriptor) for obtaining the USB device characterization.

In the third step, since the USB device has multiple sets of USB configuration information, the host will re-enumerate the USB device again. After the second enumeration starts, the host will issue the OS String Descrip to the USB device again for the WIN8 system computer. The tor request, and WIN7/XP will not send the message again. At this point, after the above three steps, it can be determined whether the currently accessed host operating system is a WIN8 system. The specific process is shown in Figure 4.

Design and Implementation of a USB Device That Can Automatically Identify WIN8 System

4 Analysis of experimental results

The experimental results prove that the USB devices with automatic recognition of the operating system function are respectively inserted into the WIN7/XP system and the WIN8 system PC, which can be automatically enumerated into different USB devices.

5 Conclusion

If multiple sets of USB configuration information are pre-implemented on the USB device side, and two sets of standard network card device drivers are implemented according to MBIM protocol and RNDIS respectively, the following objectives can be achieved. When the device is inserted into the WIN8 system, the USB device can automatically recognize the current access. The system is WIN8, which is enumerated as a network card device conforming to the MBIM protocol; when the device is connected to the WIN7/XP system, the USB device can automatically recognize that the current access system is WIN7/XP, thereby enumerating the network card device conforming to the RNDIs protocol. In the end, the goal of truly free drive network card equipment is achieved, which needs to be further realized.

10 Mm Nano Tip

10 Mm Nano Tip,Smart Board Touch Screen Pen,Electronic White Board Pen,Infrared Touch Screen Pen

Shenzhen Ruidian Technology CO., Ltd , https://www.szwisonen.com

This entry was posted in on