WO2014176956A1 - Method for adapting usb device to operating system, and usb device - Google Patents

Method for adapting usb device to operating system, and usb device Download PDF

Info

Publication number
WO2014176956A1
WO2014176956A1 PCT/CN2014/074759 CN2014074759W WO2014176956A1 WO 2014176956 A1 WO2014176956 A1 WO 2014176956A1 CN 2014074759 W CN2014074759 W CN 2014074759W WO 2014176956 A1 WO2014176956 A1 WO 2014176956A1
Authority
WO
WIPO (PCT)
Prior art keywords
request
host
operating system
usb device
configuration
Prior art date
Application number
PCT/CN2014/074759
Other languages
French (fr)
Chinese (zh)
Inventor
任静
马伟伟
马少峰
田军
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2014176956A1 publication Critical patent/WO2014176956A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • G06F13/385Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices

Definitions

  • the invention relates to the field of data communication, in particular to a method for adapting an operating system of a USB device and a USB device. Background technique
  • USB devices can perform certain special functions for an operating system. For example, some features in the USB device are specifically for the WINDOWS operating system. , can only complete the corresponding operations in the WINDOWS operating system, these features are not possible in the LINUX operating system. Therefore, how the USB device can automatically recognize the currently operating operating system type and adapt to the current operating system becomes a problem to be solved.
  • the method for adapting the USB device to the operating system is as follows:
  • the user upgrades the software of the USB device to adapt the USB device to the operating system of the host.
  • This method requires manual guidance and intervention to adapt the USB device to different operating systems.
  • Different communication protocols the method is complicated to operate, and brings inconvenience to the user. Summary of the invention
  • the main purpose of the present invention is to provide a method for adapting an operating system of a USB device and a USB device, which can quickly and automatically identify the operating system type of the host running and adapt the operating system type of the host.
  • the embodiment of the invention provides a method for adapting an operating system of a USB device, and the method comprises the following steps: After establishing a connection with the host, the USB device detects and receives at least two requests that are sent by the host in sequence, and determines an operating system type that is run by the host according to the sequence and content of the received request;
  • the USB device locks the working mode of the USB device corresponding to the determined operating system type according to a predetermined mapping relationship between the operating system type and the working mode of the USB device, and operates according to the locked working mode.
  • the operating system type includes a WINDOWS system
  • the USB device detects and receives at least two requests sent by the host in sequence, and determines the order according to the sequence and content of the received request.
  • the step of operating the type of the operating system of the host includes: receiving and parsing the first request sent by the host, and if the first request is a request for acquiring a device descriptor, continuing to receive and parse the second request sent by the host, If the second request is a setup configuration request, it is determined that the operating system type of the host is a WINDOWS system.
  • the operating system type further includes a MAC system
  • the method further includes:
  • the first request is to obtain a configuration descriptor request, continue to receive and parse the third request sent by the host, and if the third request is a configuration configuration request, determine that the operating system type of the host is MAC system.
  • the operating system type further includes a LINUX system
  • the method further includes:
  • the third request is to obtain a string descriptor request, continue to receive and parse the fourth request sent by the host, and if the fourth request is a configuration request, determine that the operating system type of the host is LINUX system.
  • the method further includes:
  • the third request is a device descriptor request, continue to receive and parse the host And sending the fifth request, if the fifth request is a setting configuration request, determining that the operating system type of the host is WINDOWS system.
  • the method further includes:
  • the embodiment of the present invention further provides a USB device, the USB device includes: a request receiving module, a determining module connected to the request receiving module, and a locking module connected to the determining module; wherein:
  • the request receiving module is configured to: after the USB device establishes a connection with the host, detect and receive at least two requests that are sent by the host in sequence;
  • the determining module is configured to determine, according to an order and a content of the request received by the request receiving module, an operating system type run by the host;
  • the locking module is configured to lock a working mode of the USB device corresponding to the determined operating system type according to a predetermined mapping relationship between the operating system type and the working mode of the USB device, and make the USB device operate according to the locked mode. run.
  • the operating system type includes a WINDOWS system
  • the request receiving module sequentially receives the first request and the second request sent by the host
  • the determining module includes a determining unit, and a first determination connected to the determining unit Unit
  • the determining unit is configured to parse and determine whether the first request is a device identifier request and parse and determine whether the second request is a configuration configuration request;
  • the first determining unit is configured to determine, when the determining result of the determining unit is that the first request is a acquiring device descriptor request and the second request is a setting configuration request, determining that the operating system type of the host is a WINDOWS system .
  • the operating system type further includes a MAC system
  • the request receiving module is further configured to receive a third request sent by the host after receiving the first request, where the determining module further includes a connection with the determining unit.
  • the determining unit is further configured to parse and determine whether the first request is an acquisition configuration descriptor request and parse and determine whether the third request is a configuration configuration request;
  • the second determining unit is configured to determine, when the determining result of the determining unit is that the first request is a acquiring configuration descriptor, and the third request is a setting configuration request, determining that the operating system type of the host is a MAC system.
  • the operating system type further includes a LINUX system
  • the request receiving module is further configured to receive a fourth request sent by the host after receiving the third request
  • the determining module further comprising a connection with the determining unit a third determining unit
  • the determining unit is further configured to parse and determine whether the first request is to obtain a configuration descriptor request, parse and determine whether the third request is to obtain a string description request, and parse and determine whether the fourth request is a setting Configuration request;
  • the third determining unit is configured to, when the determining result of the determining unit is that the first request is a configuration configuration descriptor request, the third request is a acquiring string description request, and the fourth request is a setting configuration request, It is determined that the operating system type of the host is LINUX system.
  • the USB device receives at least two requests that are sent by the host in sequence, and determines an operating system type that is run by the host according to the sequence and content of the received request, and then switches the working mode of the USB device.
  • the operating system running on the host is adapted to the working mode corresponding to the determined operating system type.
  • FIG. 1 is a schematic flowchart of a method for adapting an operating system of a USB device according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a detailed process of step S10 in FIG.
  • FIG. 3 is a schematic structural diagram of a USB device according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a determining module of a USB device according to an embodiment of the present invention. detailed description
  • FIG. 1 is a schematic flowchart of a method for adapting an operating system of a USB device according to an embodiment of the present invention, where the method includes:
  • the USB device After establishing a connection with the host, the USB device detects and receives at least two requests issued by the host in sequence, and determines an operating system type that the host runs according to the order and content of the received request.
  • the USB device establishes a connection with the host through a USB interface, which can be a personal computer PC, or other device that supports a USB host controller, such as a palmtop computer.
  • a USB interface can be a personal computer PC, or other device that supports a USB host controller, such as a palmtop computer.
  • the host sends a corresponding request to the USB device, and the USB device detects and receives at least two requests sent by the host in sequence.
  • the host and the host using different operating systems have different contents and order of the requests sent to the USB device. Therefore, the USB device can determine the operating system running by the host according to the order and content of the received request.
  • the USB device locks the working mode of the USB device corresponding to the determined operating system type according to a predetermined mapping relationship between the operating system type and the working mode of the USB device, and operates according to the locked working mode.
  • the working mode of the USB device is different for different operating systems running on the host.
  • the mapping relationship between the operating system type and the working mode of the USB device can be determined in advance, as shown in Table 1: Operating mode type USB device working mode
  • step S20 after identifying the operating system running by the host, the USB device switches the working mode of the USB device to an operating mode that is adapted to the operating system running by the host.
  • USB devices can be divided into drive-free USB devices and non-drive-free USB devices.
  • the USB device is a non-free USB device and the operating system type of the host is WINDOWS
  • the USB device is switched to mode one, the content of the CD of the USB device is loaded with the ISO file under Windows, the driver is installed, and The application switches to the working mode with the NDIS (Network Driver Interface Specification) and then runs normally.
  • NDIS Network Driver Interface Specification
  • the USB device When the USB device is a non-free USB device and the operating system type of the host is a MAC system, the USB device is switched to the mode 3, and the USB device directly switches to the working mode with the ECM and the optical disk coexisting, loading Install the drivers and applications for the ISO files on the Mac, load the drivers for function ports such as VOUSB or SIMREADER, and then run normally.
  • the USB device When the USB device is a non-free USB device and the operating system type of the host is a MAC system, the USB device is switched to the mode 3, and the USB device directly switches to the working mode with the ECM and the optical disk coexisting, loading Install the drivers and applications for the ISO files on the Mac, load the drivers for function ports such as VOUSB or SIMREADER, and then run normally.
  • the USB device When the USB device is a non-disabled USB device, and the operating system type of the host is LINUX, the USB device is switched to mode 5, and the USB device directly switches to the working mode with ECM and the coexistence of the optical disc, loading Install the driver and application files in the ISO file under LINUX, load the driver for the function port such as VOUSB or SIMREADER, and then run normally.
  • the USB device When the USB device is a non-disabled USB device, and the operating system type of the host is LINUX, the USB device is switched to mode 5, and the USB device directly switches to the working mode with ECM and the coexistence of the optical disc, loading Install the driver and application files in the ISO file under LINUX, load the driver for the function port such as VOUSB or SIMREADER, and then run normally.
  • the function port such as VOUSB or SIMREADER
  • USB device When the USB device is a USB-free device, and the operating system type of the host is In the WINDOWS system, the USB device is switched to mode two.
  • the USB device loads the public ISO file to install the WEBUI shortcut, then switches to the working mode with RNDIS, and then runs normally.
  • the USB device When the USB device is a USB-free device and the operating system type of the host is a MAC system, the USB device is switched to mode four, and the USB device directly switches to the working mode with ECM, and the optical disks coexist, and then Load the public ISO file to install the WEBUI shortcut and then run it normally.
  • USB device When the USB device is a USB-free device and the operating system type of the host is LINUX, the USB device is switched to mode 6.
  • the USB device directly switches to the working mode with ECM, and the CD coexists. Load the public ISO file to install the WEBUI shortcut and then run it normally.
  • the USB device when the USB device is a non-disabled USB device, the USB device only needs to load the corresponding ISO file of the operating system running the current host to install, and does not need to be fully loaded, which can save the loading of the ISO file. time.
  • the USB device receives at least two requests sent by the host in sequence, and determines the operating system type of the host according to the sequence and content of the received request, and then switches the working mode of the USB device to and determines.
  • the operating mode corresponding to the operating system type, adapting the operating system running on the host.
  • the operating system type of the host running and the operating system of the host can be quickly and automatically recognized, without manual intervention to identify the operating system of the host, and the user experience is improved.
  • FIG. 2 is a detailed flow diagram of step S10 in FIG. 1.
  • the operating system type includes a WINDOWS system, a MAC system, a LINUX system, and the like, and the WINDOWS system includes WINDOWS XP, WINDOWS XP SP2, WIN 7, WINDOWS VISTA, and the like.
  • the step S10 includes:
  • step S101 Receive and parse the first request sent by the host, and determine whether the first request is obtained.
  • the device descriptor request or the configuration descriptor request is fetched. If the first request is a device descriptor request, step S102 is performed. If the first request is a configuration descriptor request, step S104 is performed.
  • the device descriptor is a device descriptor of the USB device, and the USB device has a device descriptor built in.
  • the USB device When receiving the device descriptor request sent by the host, the USB device responds accordingly, and sends the corresponding response to the USB device. Host.
  • the configuration descriptor is a configuration descriptor of the USB device, and the USB device has a configuration descriptor built in, and the USB device responds when receiving the request for acquiring the configuration descriptor sent by the host, and sends the corresponding response to the USB device. Host.
  • step S103 Receive and parse the second request sent by the host, and determine whether the second request is a configuration configuration request. If yes, execute step S103. If no, return to step S101.
  • the configuration request sent by the host to the USB device is related to the configuration of the USB device, such as assigning an address.
  • the USB device receives the configuration request request sent by the host, set it accordingly.
  • Step S105 is performed. If the third request is a request for acquiring a character string descriptor, step S106 is performed. If the third request is a device descriptor request, step S108 is performed.
  • the string descriptor is a string descriptor of the USB device, and the USB device has a string descriptor built in, and the USB device responds when receiving the request for acquiring the string descriptor sent by the host, and the corresponding The corresponding response is sent to the host.
  • step S107 Receive and parse the fourth request sent by the host, and determine that the fourth request is a configuration configuration request or a device descriptor request. If the fourth request is a configuration configuration request, perform step S107, if the fourth request To obtain the device descriptor request, step S110 is performed.
  • step S110 Receive and parse the sixth request sent by the host, and determine whether the sixth request is a configuration request, and if yes, perform step S11.
  • steps S101 to S111 when the order and content of the request issued by the host are the following three conditions: (1) acquiring a device descriptor request setting configuration request, and (2) acquiring a configuration descriptor request acquiring device
  • the descriptor request sets the configuration request, and (3) obtains the configuration descriptor request-acquires the string descriptor-acquires the device descriptor request-sets the configuration request, and can determine that the operating system running by the host is the WINDOWS system;
  • the order and content are: Get configuration descriptor request - Set configuration request, determine the operating system running on the host as the MAC system;
  • FIG. 3 is a schematic structural diagram of a USB device according to an embodiment of the present invention.
  • the USB device includes a request receiving module 10, a determining module 20 connected to the request receiving module 10, and a locking module 30 connected to the determining module 20; among them:
  • the request receiving module 10 is configured to: after the USB device establishes a connection with the host, detect and receive at least two requests that are sent by the host in sequence;
  • the determining module 20 is configured to determine, according to the order and content of the request received by the receiving module, an operating system type run by the host;
  • the locking module 30 is configured to lock a working mode of the USB device corresponding to the determined operating system type according to a predetermined mapping relationship between the operating system type and the working mode of the USB device, and enable the USB device to operate according to the locked working mode. .
  • the USB device establishes a connection with the host through a USB interface, which can be a personal computer PC, or other device that supports a USB host controller, such as a palmtop computer.
  • a USB interface which can be a personal computer PC, or other device that supports a USB host controller, such as a palmtop computer.
  • the host sends a corresponding request to the USB device, and the request receiving module 10 of the USB device detects and receives at least two requests issued by the host in sequence.
  • the host and the host using different operating systems have different contents and order of the requests sent to the USB device. Therefore, the determining module 20 of the USB device can determine the operating system running by the host according to the order and content of the received request.
  • the working mode of the USB device is different for different operating systems running on the host.
  • the mapping relationship between the operating system type and the working mode of the USB device can be determined in advance, as shown in Table 1 above. After the determining module 20 determines the operating system running by the host, the locking module switches the working mode of the USB device to an operating mode that is adapted to the operating system running by the host.
  • USB devices can be divided into drive-free USB devices and non-drive-free USB devices.
  • the locking module 30 switches the USB device to mode one, and the content of the CD device of the USB device loads the ISO file under Windows. Install the driver and application and switch to the working mode with NDIS (Network Driver Interface Specification), and then run normally.
  • NDIS Network Driver Interface Specification
  • the locking module 30 switches the USB device to mode three, and the USB device directly Switch to the working mode with ECM and CD coexistence, load the ISO file under Mac and install the driver and application, load the driver for the function port such as VOUSB or SIMREADER, and then run normally.
  • the locking module 30 switches the USB device to mode five, and the USB device directly switches to the CCM with the ECM and the optical disk coexisting.
  • Working mode load the ISO file under Linux to install the driver and application, load the driver for the function port such as VOUSB or SIMREADER, and then run normally.
  • the locking module 30 switches the USB device to mode 2, and the USB device loads the common ISO file to install the WEBUI shortcut. , then switch to working mode with NDIS and then run normally.
  • the locking module 30 switches the USB device to mode four, and the USB device directly switches to the working mode with the ECM, and The CDs coexist, then load the public ISO file to install the WEBUI shortcut, and then run normally.
  • the locking module 30 switches the USB device to mode 6, and the USB device directly switches to the working mode with the ECM, and The CDs coexist, then load the public ISO file to install the WEBUI shortcut, and then run normally.
  • the USB device when the USB device is a non-disabled USB device, the USB device only needs to load the corresponding ISO file of the operating system running the current host to install, and does not need to be fully loaded, which can save the loading of the ISO file. time.
  • the determining module 20 includes a determination unit 21, a first determination unit 22, a second determination unit 23, a third determination unit 24, a fourth determination unit 25, and a fifth determination unit 26, which are respectively connected to the determination unit 21.
  • the request receiving module 10 sequentially receives the first request and the second request sent by the host.
  • the determining unit 21 is configured to parse and determine whether the first request is a request for acquiring a device descriptor and parsing and determining whether the second request is a setting configuration request.
  • the first determining unit 22 is configured to determine, when the determining result of the determining unit 21 is that the first request is a acquiring device descriptor request and the second request is a setting configuration request, determining that the operating system type of the host is WINDOWS system.
  • the device descriptor is a device descriptor of the USB device, and the USB device has a device descriptor built in.
  • the USB device When receiving the device descriptor request sent by the host, the USB device responds accordingly, and sends the corresponding response to the USB device. Host.
  • the configuration descriptor is a configuration descriptor of the USB device, and the USB device has a configuration descriptor built in, and the USB device responds when receiving the request for acquiring the configuration descriptor sent by the host, and sends the corresponding response to the USB device. Host.
  • the configuration request sent by the host to the USB device is related to the configuration of the USB device, such as assigning an address.
  • the USB device receives the configuration request request sent by the host, set it accordingly.
  • the request receiving module 10 is further configured to receive a third request sent by the host after receiving the first request.
  • the determining unit 21 is further configured to parse and determine whether the first request is to obtain a configuration descriptor request and parse and determine whether the third request is a setting configuration request.
  • the second determining unit 23 is configured to determine, when the determination result of the determining unit 21 is that the first request is a configuration configuration descriptor and the third request is a setting configuration request, determine an operation of the host operation.
  • the system type is MAC system.
  • the string descriptor is a string descriptor of the USB device, and the USB device has a string descriptor built in, and the USB device responds when receiving the request for acquiring the string descriptor sent by the host, and the corresponding The corresponding response is sent to the host.
  • the request receiving module 10 is further configured to receive a fourth request sent by the host after receiving the third request.
  • the determining unit 21 is further configured to parse and determine whether the first request is a request for obtaining a configuration descriptor, parse and determine whether the third request is a request for obtaining a character string description and parsing and determining whether the fourth request is a setting configuration request.
  • the third determining unit 24 is configured to determine, when the determining result of the determining unit 21 is that the first request is a get configuration descriptor request, the third request is a get string description request, and the fourth request is a setting configuration request,
  • the operating system type that the host runs is LINUX.
  • the request receiving module 10 is further configured to receive a fifth request sent by the host after receiving the third request; the determining unit 21 is further configured to parse and determine whether the first request is to obtain a configuration descriptor request, parse and determine the first request Whether the three requests are for obtaining a device descriptor request and parsing and determining whether the fifth request is a configuration configuration request.
  • the fourth determining unit 25 is configured to determine, when the determining result of the determining unit 21 is that the first request is a acquiring configuration descriptor request, the third request is a acquiring device descriptor request, and the fifth request is a setting configuration request,
  • the operating system type that the host runs is WINDOWS.
  • the request receiving module 10 is further configured to receive a sixth request sent by the host after receiving the fourth request.
  • the determining unit 21 is further configured to parse and determine whether the first request is a request for acquiring a configuration descriptor, parse and determine whether the third request is a request for acquiring a string descriptor, parsing and determining whether the fourth request is a device descriptor. Requesting and parsing and determining whether the sixth request is a setup configuration request.
  • the fifth determining unit 26 is configured to determine, in the determining unit 21, that the first request is a get configuration descriptor request, the third request is a get string descriptor request, the fourth request is a device descriptor request, and the When the sixth request is to set a configuration request, it is determined that the operating system type of the host is WINDOWS system.
  • Each of the above units may be implemented by a central processing unit (CPU), a digital signal processor (DSP) or a Field-Programmable Gate Array (FPGA) in an electronic device.
  • CPU central processing unit
  • DSP digital signal processor
  • FPGA Field-Programmable Gate Array
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of a hardware embodiment, a software embodiment, or an embodiment of a combination of software and hardware. Moreover, the invention can be embodied in the form of a computer program product embodied on one or more computer usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded into a computer or other programmable data processing device Having a series of operational steps performed on a computer or other programmable device to produce computer-implemented processing, such that instructions executed on a computer or other programmable device are provided for implementing a process or processes in a flowchart and/or Or block diagram the steps of a function specified in a box or multiple boxes.

Abstract

The embodiments of the present invention disclose a method for adapting a USB device to an operating system, and a USB device. The method comprises the following steps: after establishing a connection with a host, a USB device detecting and receiving at least two requests which are issued by the host in sequence, and according to the order and content of the received requests, determining the type of an operating system running on the host; and according to a mapping relationship between the pre-determined type of the operating system and a working mode of the USB device, the USB device locking the working mode of the USB device corresponding to the determined type of the operating system, and running according to the locked working mode.

Description

一种 USB设备适配操作系统的方法及 USB设备 技术领域  Method for adapting operating system of USB device and USB device
本发明涉及到数据通讯领域, 特别涉及到一种 USB设备适配操作系统 的方法及 USB设备。 背景技术  The invention relates to the field of data communication, in particular to a method for adapting an operating system of a USB device and a USB device. Background technique
随着 USB产品的不断开发,越来越多的 USB设备被广泛应用在各种操 作系统之上。 但是, 不同的操作系统对同一个 USB设备的需求可能会有所 不同,一个 USB设备针对某一个操作系统可以完成某些特殊的功能,例如, USB 设备中某些特性是特别针对 WINDOWS 操作系统的, 只能在 WINDOWS操作系统中完成对应的操作,这些特性在 LINUX操作系统中是 无法进行的。 因此, USB设备如何能自动识别出当前接入的操作系统类型 并适配当前操作系统便成为一个待解决的问题。  With the continuous development of USB products, more and more USB devices are widely used in various operating systems. However, different operating systems may have different requirements for the same USB device. A USB device can perform certain special functions for an operating system. For example, some features in the USB device are specifically for the WINDOWS operating system. , can only complete the corresponding operations in the WINDOWS operating system, these features are not possible in the LINUX operating system. Therefore, how the USB device can automatically recognize the currently operating operating system type and adapt to the current operating system becomes a problem to be solved.
目前, USB设备适配操作系统的方法有: 用户升级 USB设备的相关软 件, 以使得该 USB设备适应主机的操作系统, 这种方式需要人工引导以及 干预才能使得 USB设备在不同的操作系统上适应不同的通讯协议, 该方法 操作复杂, 给用户带来不便。 发明内容  Currently, the method for adapting the USB device to the operating system is as follows: The user upgrades the software of the USB device to adapt the USB device to the operating system of the host. This method requires manual guidance and intervention to adapt the USB device to different operating systems. Different communication protocols, the method is complicated to operate, and brings inconvenience to the user. Summary of the invention
本发明的主要目的为提供一种 USB 设备适配操作系统的方法及 USB 设备, 可快速自动识别主机运行的操作系统类型及适配该主机运行的操作 系统类型。  The main purpose of the present invention is to provide a method for adapting an operating system of a USB device and a USB device, which can quickly and automatically identify the operating system type of the host running and adapt the operating system type of the host.
本发明实施例提供一种 USB设备适配操作系统的方法, 该方法包括以 下步骤: USB设备在与主机建立连接后, 侦测并接收所述主机依次下发的至少 两个请求, 并根据接收的请求的顺序及内容确定所述主机运行的操作系统 类型; The embodiment of the invention provides a method for adapting an operating system of a USB device, and the method comprises the following steps: After establishing a connection with the host, the USB device detects and receives at least two requests that are sent by the host in sequence, and determines an operating system type that is run by the host according to the sequence and content of the received request;
所述 USB设备根据预先确定的操作系统类型与 USB设备的工作模式的 映射关系, 锁定与确定的操作系统类型对应的 USB设备的工作模式, 并根 据锁定的工作模式运行。  The USB device locks the working mode of the USB device corresponding to the determined operating system type according to a predetermined mapping relationship between the operating system type and the working mode of the USB device, and operates according to the locked working mode.
优选地,所述操作系统类型包括 WINDOWS系统,所述 USB设备在与 主机建立连接后, 侦测并接收所述主机依次下发的至少两个请求, 并根据 接收的请求的顺序及内容确定所述主机运行的操作系统类型的步骤包括: 接收并解析所述主机发送的第一请求, 若所述第一请求为获取设备描 述符请求, 则继续接收并解析所述主机发送的第二请求, 若所述第二请求 为设置配置请求,则确定所述主机运行的操作系统类型为 WINDOWS系统。  Preferably, the operating system type includes a WINDOWS system, and after establishing a connection with the host, the USB device detects and receives at least two requests sent by the host in sequence, and determines the order according to the sequence and content of the received request. The step of operating the type of the operating system of the host includes: receiving and parsing the first request sent by the host, and if the first request is a request for acquiring a device descriptor, continuing to receive and parse the second request sent by the host, If the second request is a setup configuration request, it is determined that the operating system type of the host is a WINDOWS system.
优选地, 所述操作系统类型还包括 MAC系统, 所述接收并解析所述主 机发送的第一请求的步骤之后, 该方法还包括:  Preferably, the operating system type further includes a MAC system, after the step of receiving and parsing the first request sent by the host, the method further includes:
若所述第一请求为获取配置描述符请求, 则继续接收并解析所述主机 发送的第三请求, 若所述第三请求为设置配置请求, 则确定所述主机运行 的操作系统类型为 MAC系统。  If the first request is to obtain a configuration descriptor request, continue to receive and parse the third request sent by the host, and if the third request is a configuration configuration request, determine that the operating system type of the host is MAC system.
优选地, 所述操作系统类型还包括 LINUX系统, 所述接收并解析所述 主机发送的第三请求的步骤之后, 该方法还包括:  Preferably, the operating system type further includes a LINUX system, after the step of receiving and parsing the third request sent by the host, the method further includes:
若所述第三请求为获取字符串描述符请求, 则继续接收并解析所述主 机发送的第四请求, 若所述第四请求为设置配置请求, 则确定所述主机运 行的操作系统类型为 LINUX系统。  If the third request is to obtain a string descriptor request, continue to receive and parse the fourth request sent by the host, and if the fourth request is a configuration request, determine that the operating system type of the host is LINUX system.
优选地, 所述接收并解析所述主机发送的第三请求的步骤之后, 该方 法还包括:  Preferably, after the step of receiving and parsing the third request sent by the host, the method further includes:
若所述第三请求为获取设备描述符请求, 则继续接收并解析所述主机 发送的第五请求, 若所述第五请求为设置配置请求, 则确定所述主机运行 的操作系统类型为 WINDOWS系统。 If the third request is a device descriptor request, continue to receive and parse the host And sending the fifth request, if the fifth request is a setting configuration request, determining that the operating system type of the host is WINDOWS system.
优选地, 所述续接收所述主机发送的第四请求的步骤之后, 该方法还 包括:  Preferably, after the step of receiving the fourth request sent by the host, the method further includes:
若所述第四请求为获取设备描述符号请求, 则继续接收并解析所述主 机发送的第六请求, 若所述第六请求为设置配置请求, 则确定所述主机运 行的操作系统类型为 WINDOWS系统。 本发明实施例还提供一种 USB设备,所述 USB设备包括:请求接收模 块, 与所述请求接收模块连接的确定模块, 与所述确定模块连接的锁定模 块; 其中:  If the fourth request is to obtain a device description symbol request, continue to receive and parse the sixth request sent by the host, and if the sixth request is a configuration configuration request, determine that the operating system type of the host is WINDOWS system. The embodiment of the present invention further provides a USB device, the USB device includes: a request receiving module, a determining module connected to the request receiving module, and a locking module connected to the determining module; wherein:
所述请求接收模块, 配置为该 USB设备在与主机建立连接后, 侦测并 接收所述主机依次下发的至少两个请求;  The request receiving module is configured to: after the USB device establishes a connection with the host, detect and receive at least two requests that are sent by the host in sequence;
所述确定模块, 配置为根据所述请求接收模块接收的请求的顺序及内 容确定所述主机运行的操作系统类型;  The determining module is configured to determine, according to an order and a content of the request received by the request receiving module, an operating system type run by the host;
所述锁定模块, 配置为根据预先确定的操作系统类型与 USB设备的工 作模式的映射关系, 锁定与确定的操作系统类型对应的 USB设备的工作模 式, 并使得所述 USB设备根据锁定的工作模式运行。  The locking module is configured to lock a working mode of the USB device corresponding to the determined operating system type according to a predetermined mapping relationship between the operating system type and the working mode of the USB device, and make the USB device operate according to the locked mode. run.
优选地, 的操作系统类型包括 WINDOWS系统, 所述请求接收模块依 次接收所述主机发送的第一请求和第二请求, 所述确定模块包括判断单元, 及与所述判断单元连接的第一确定单元;  Preferably, the operating system type includes a WINDOWS system, the request receiving module sequentially receives the first request and the second request sent by the host, the determining module includes a determining unit, and a first determination connected to the determining unit Unit
所述判断单元配置为解析并判断所述第一请求是否为获取设备描述符 请求及解析并判断所述第二请求是否为设置配置请求;  The determining unit is configured to parse and determine whether the first request is a device identifier request and parse and determine whether the second request is a configuration configuration request;
所述第一确定单元配置为在所述判断单元的判断结果为所述第一请求 为获取设备描述符请求及第二请求为设置配置请求时, 确定所述主机运行 的操作系统类型为 WINDOWS系统。 优选地, 所述操作系统类型还包括 MAC系统, 所述请求接收模块还配 置为在接收第一请求之后接收所述主机发送的第三请求, 所述确定模块还 包括与所述判断单元连接的第二确定单元; The first determining unit is configured to determine, when the determining result of the determining unit is that the first request is a acquiring device descriptor request and the second request is a setting configuration request, determining that the operating system type of the host is a WINDOWS system . Preferably, the operating system type further includes a MAC system, and the request receiving module is further configured to receive a third request sent by the host after receiving the first request, where the determining module further includes a connection with the determining unit. Second determining unit;
所述判断单元还配置为解析并判断所述第一请求是否为获取配置描述 符请求及解析并判断所述第三请求是否为设置配置请求;  The determining unit is further configured to parse and determine whether the first request is an acquisition configuration descriptor request and parse and determine whether the third request is a configuration configuration request;
所述第二确定单元配置为在所述判断单元的判断结果为所述第一请求 为获取配置描述符及第三请求为设置配置请求时, 确定所述主机运行的操 作系统类型为 MAC系统。  The second determining unit is configured to determine, when the determining result of the determining unit is that the first request is a acquiring configuration descriptor, and the third request is a setting configuration request, determining that the operating system type of the host is a MAC system.
优选地, 所述操作系统类型还包括 LINUX系统, 所述请求接收模块还 配置为在接收第三请求之后接收所述主机发送的第四请求, 所述确定模块 还包括与所述判断单元连接的第三确定单元;  Preferably, the operating system type further includes a LINUX system, the request receiving module is further configured to receive a fourth request sent by the host after receiving the third request, the determining module further comprising a connection with the determining unit a third determining unit;
所述判断单元还配置为解析并判断所述第一请求是否为获取配置描述 符请求、 解析并判断所述第三请求是否为获取字符串描述请求及解析并判 断所述第四请求是否为设置配置请求;  The determining unit is further configured to parse and determine whether the first request is to obtain a configuration descriptor request, parse and determine whether the third request is to obtain a string description request, and parse and determine whether the fourth request is a setting Configuration request;
所述第三确定单元配置为在所述判断单元的判断结果为第一请求为获 取配置描述符请求、 所述第三请求为获取字符串描述请求及所述第四请求 为设置配置请求时, 确定所述主机运行的操作系统类型为 LINUX系统。 釆用本发明实施例, USB设备接收所述主机依次下发的至少两个请求, 并根据接收的请求的顺序及内容确定所述主机运行的操作系统类型, 然后 将该 USB设备的工作模式切换到与确定的操作系统类型对应的工作模式, 对该主机运行的操作系统进行适配。 釆用本发明实施例, 可快速自动识别 主机运行的操作系统类型及适配该主机的操作系统, 而不需人工干预识别 主机的操作系统, 提高用户体验。 附图说明 The third determining unit is configured to, when the determining result of the determining unit is that the first request is a configuration configuration descriptor request, the third request is a acquiring string description request, and the fourth request is a setting configuration request, It is determined that the operating system type of the host is LINUX system. In the embodiment of the present invention, the USB device receives at least two requests that are sent by the host in sequence, and determines an operating system type that is run by the host according to the sequence and content of the received request, and then switches the working mode of the USB device. The operating system running on the host is adapted to the working mode corresponding to the determined operating system type. By using the embodiment of the invention, the operating system type of the host running and the operating system of the host can be quickly and automatically identified, without manual intervention to identify the operating system of the host, and the user experience is improved. DRAWINGS
图 1为本发明实施例的 USB设备适配操作系统的方法的流程示意图; 图 2为图 1中步骤 S10的详细流程示意图;  1 is a schematic flowchart of a method for adapting an operating system of a USB device according to an embodiment of the present invention; FIG. 2 is a schematic flowchart of a detailed process of step S10 in FIG.
图 3为本发明实施例的 USB设备的结构示意图;  3 is a schematic structural diagram of a USB device according to an embodiment of the present invention;
图 4为本发明实施例的 USB设备的确定模块的详细结构示意图。 具体实施方式  FIG. 4 is a schematic structural diagram of a determining module of a USB device according to an embodiment of the present invention. detailed description
应当理解, 此处所描述的具体实施例仅仅用以解释本发明, 并不用于 限定本发明。  It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
参照图 1, 图 1为本发明实施例的 USB设备适配操作系统的方法的流 程示意图, 该方法包括:  Referring to FIG. 1, FIG. 1 is a schematic flowchart of a method for adapting an operating system of a USB device according to an embodiment of the present invention, where the method includes:
S10、 USB设备在与主机建立连接后, 侦测并接收该主机依次下发的至 少两个请求, 并根据接收的请求的顺序及内容确定该主机运行的操作系统 类型。  S10. After establishing a connection with the host, the USB device detects and receives at least two requests issued by the host in sequence, and determines an operating system type that the host runs according to the order and content of the received request.
USB设备通过 USB接口与主机建立连接,该主机可以为个人电脑 PC, 或其他支持 USB主控制器的设备,例如掌上电脑等。该 USB设备与主机建 立连接后,主机向该 USB设备下发相应的请求,该 USB设备侦测并接收该 主机依次下发的至少两个请求。 使用不同操作系统的主机, 其向 USB设备 发送的请求的内容和顺序是不同的, 因此, USB设备可根据接收的请求的 顺序及内容确定该主机运行的操作系统。  The USB device establishes a connection with the host through a USB interface, which can be a personal computer PC, or other device that supports a USB host controller, such as a palmtop computer. After the USB device is connected to the host, the host sends a corresponding request to the USB device, and the USB device detects and receives at least two requests sent by the host in sequence. The host and the host using different operating systems have different contents and order of the requests sent to the USB device. Therefore, the USB device can determine the operating system running by the host according to the order and content of the received request.
S20、 该 USB设备根据预先确定的操作系统类型与 USB设备的工作模 式的映射关系, 锁定与确定的操作系统类型对应的 USB设备的工作模式, 并根据锁定的工作模式运行。  S20. The USB device locks the working mode of the USB device corresponding to the determined operating system type according to a predetermined mapping relationship between the operating system type and the working mode of the USB device, and operates according to the locked working mode.
对应主机运行的不同操作系统, USB设备的工作模式也不相同, 操作 系统类型与 USB设备的工作模式的映射关系可预先确定, 如表 1所示: 操作系统类型 USB设备的工作模式 The working mode of the USB device is different for different operating systems running on the host. The mapping relationship between the operating system type and the working mode of the USB device can be determined in advance, as shown in Table 1: Operating mode type USB device working mode
非免驱 USB设备 免驱 USB设备 Non-free drive USB device Free drive USB device
WIN υDOWS系统 模式一 模式二 WIN υDOWS system mode one mode two
模式三 模式四  Mode three mode four
LINUX系统 模式五 模式六 表 1  LINUX system mode five mode six table 1
在步骤 S20 中, 该 USB设备在识别出主机运行的操作系统后, 将该 USB设备的工作模式切换到与该主机运行的操作系统适配的工作模式。  In step S20, after identifying the operating system running by the host, the USB device switches the working mode of the USB device to an operating mode that is adapted to the operating system running by the host.
USB设备可以分为免驱 USB设备和非免驱 USB设备。 当该 USB设备 为非免驱 USB设备,且主机运行的操作系统类型为 WINDOWS系统时,则 将该 USB设备切换到模式一, 该 USB设备的光盘内容加载 Windows下的 ISO 文件, 安装驱动程序和应用程序并切换到带 NDIS ( Network Driver Interface Specification, 网络驱动程序接口规范的简称)的工作模式, 然后 正常运行。  USB devices can be divided into drive-free USB devices and non-drive-free USB devices. When the USB device is a non-free USB device and the operating system type of the host is WINDOWS, the USB device is switched to mode one, the content of the CD of the USB device is loaded with the ISO file under Windows, the driver is installed, and The application switches to the working mode with the NDIS (Network Driver Interface Specification) and then runs normally.
当该 USB设备为非免驱 USB设备,且主机运行的操作系统类型为 MAC 系统时,则将该 USB设备切换到模式三,该 USB设备直接切换到带有 ECM 且光盘共存的工作模式,加载 Mac下的 ISO文件安装驱动程序和应用程序, 为 VOUSB或者 SIMREADER等功能端口加载驱动后, 然后正常运行。  When the USB device is a non-free USB device and the operating system type of the host is a MAC system, the USB device is switched to the mode 3, and the USB device directly switches to the working mode with the ECM and the optical disk coexisting, loading Install the drivers and applications for the ISO files on the Mac, load the drivers for function ports such as VOUSB or SIMREADER, and then run normally.
当该 USB 设备为非免驱 USB 设备, 且主机运行的操作系统类型为 LINUX系统时, 则将该 USB设备切换到模式五, 该 USB设备直接切换到 带有 ECM且光盘共存的工作模式, 加载 LINUX下的 ISO文件安装驱动程 序和应用程序, 为 VOUSB或者 SIMREADER等功能端口加载驱动后, 然 后正常运行。  When the USB device is a non-disabled USB device, and the operating system type of the host is LINUX, the USB device is switched to mode 5, and the USB device directly switches to the working mode with ECM and the coexistence of the optical disc, loading Install the driver and application files in the ISO file under LINUX, load the driver for the function port such as VOUSB or SIMREADER, and then run normally.
当该 USB 设备为免驱 USB 设备, 且主机运行的操作系统类型为 WINDOWS系统时, 则将该 USB设备切换到模式二, 该 USB设备加载公 用的 ISO文件来安装 WEBUI的快捷方式, 然后切换到带有 RNDIS的工作 模式, 然后正常运行。 When the USB device is a USB-free device, and the operating system type of the host is In the WINDOWS system, the USB device is switched to mode two. The USB device loads the public ISO file to install the WEBUI shortcut, then switches to the working mode with RNDIS, and then runs normally.
当该 USB设备为免驱 USB设备, 且主机运行的操作系统类型为 MAC 系统时,则将该 USB设备切换到模式四,该 USB设备直接切换到带有 ECM 的工作模式,并且光盘共存,再加载公用的 ISO文件来安装 WEBUI的快捷 方式, 然后正常运行。  When the USB device is a USB-free device and the operating system type of the host is a MAC system, the USB device is switched to mode four, and the USB device directly switches to the working mode with ECM, and the optical disks coexist, and then Load the public ISO file to install the WEBUI shortcut and then run it normally.
当该 USB设备为免驱 USB设备,且主机运行的操作系统类型为 LINUX 系统时,则将该 USB设备切换到模式六,该 USB设备直接切换到带有 ECM 的工作模式,并且光盘共存,再加载公用的 ISO文件来安装 WEBUI的快捷 方式, 然后正常运行。  When the USB device is a USB-free device and the operating system type of the host is LINUX, the USB device is switched to mode 6. The USB device directly switches to the working mode with ECM, and the CD coexists. Load the public ISO file to install the WEBUI shortcut and then run it normally.
从上述工作模式可以看出, 当 USB设备为非免驱 USB设备时, USB 设备只需要加载当前主机运行的操作系统相应的 ISO文件进行安装即可, 不需要全部加载, 可以节省 ISO文件的加载时间。  As can be seen from the above working mode, when the USB device is a non-disabled USB device, the USB device only needs to load the corresponding ISO file of the operating system running the current host to install, and does not need to be fully loaded, which can save the loading of the ISO file. time.
釆用本实施例, USB设备接收该主机依次下发的至少两个请求, 并根 据接收的请求的顺序及内容确定该主机运行的操作系统类型, 然后将该 USB设备的工作模式切换到与确定的操作系统类型对应的工作模式, 对该 主机运行的操作系统进行适配。 釆用本发明实施例, 可快速自动识别主机 运行的操作系统类型及适配该主机的操作系统, 而不需人工干预识别主机 的操作系统, 提高用户体验。 参照图 2, 图 2为图 1中步骤 S10的详细流程示意图, 该操作系统类型 包括 WINDOWS系统、 MAC系统、 LINUX系统等, 该 WINDOWS系统包 括 WINDOWS XP、 WINDOWS XP SP2, WIN 7、 WINDOWS VISTA等。  In this embodiment, the USB device receives at least two requests sent by the host in sequence, and determines the operating system type of the host according to the sequence and content of the received request, and then switches the working mode of the USB device to and determines. The operating mode corresponding to the operating system type, adapting the operating system running on the host. With the embodiment of the present invention, the operating system type of the host running and the operating system of the host can be quickly and automatically recognized, without manual intervention to identify the operating system of the host, and the user experience is improved. Referring to FIG. 2, FIG. 2 is a detailed flow diagram of step S10 in FIG. 1. The operating system type includes a WINDOWS system, a MAC system, a LINUX system, and the like, and the WINDOWS system includes WINDOWS XP, WINDOWS XP SP2, WIN 7, WINDOWS VISTA, and the like.
该步骤 S10包括:  The step S10 includes:
S101、 接收并解析主机发送的第一请求, 并判断该第一请求是否是获 取设备描述符请求或获取配置描述符请求, 若该第一请求是获取设备描述 符请求, 则执行步骤 S102, 若该第一请求是获取配置描述符请求, 则执行 步骤 S104。 S101. Receive and parse the first request sent by the host, and determine whether the first request is obtained. The device descriptor request or the configuration descriptor request is fetched. If the first request is a device descriptor request, step S102 is performed. If the first request is a configuration descriptor request, step S104 is performed.
该设备描述符即为该 USB设备的设备描述符,该 USB设备内置了设备 描述符, 该 USB设备在接收到主机发送的获取设备描述符请求时, 作出相 应响应, 并将该相应响应发送给主机。  The device descriptor is a device descriptor of the USB device, and the USB device has a device descriptor built in. When receiving the device descriptor request sent by the host, the USB device responds accordingly, and sends the corresponding response to the USB device. Host.
该配置描述符即为该 USB设备的配置描述符,该 USB设备内置了配置 描述符, 该 USB设备在接收到主机发送的获取配置描述符请求时, 作出相 应响应, 并将该相应响应发送给主机。  The configuration descriptor is a configuration descriptor of the USB device, and the USB device has a configuration descriptor built in, and the USB device responds when receiving the request for acquiring the configuration descriptor sent by the host, and sends the corresponding response to the USB device. Host.
5102、 接收并解析该主机下发的第二请求, 并判断该第二请求是否为 设置配置请求, 若是, 则执行步骤 S103, 若否, 则返回步骤 S101。  5102. Receive and parse the second request sent by the host, and determine whether the second request is a configuration configuration request. If yes, execute step S103. If no, return to step S101.
该主机向该 USB设备下发的设置配置请求,即为该主机对该 USB设备 进行相关配置, 如分配地址。 该 USB设备接收到该主机发送的设置配置请 求时, 进行相应设置。  The configuration request sent by the host to the USB device is related to the configuration of the USB device, such as assigning an address. When the USB device receives the configuration request request sent by the host, set it accordingly.
5103、 确定该主机运行的操作系统类型为 WINDOWS系统, 然后结束 操作系统识别过程。  5103. Determine that the operating system type of the host is WINDOWS, and then end the operating system identification process.
5104、 接收并解析该主机下发的第三请求, 并判断该第三请求是否为 设置配置请求、 获取字符串描述符请求或获取设备描述符请求, 若该第三 请求是设置配置请求, 则执行步骤 S105, 若该第三请求是获取字符串描述 符请求, 则执行步骤 S106, 若该第三请求是设备描述符请求, 则执行步骤 S108。  5104. Receive and parse a third request sent by the host, and determine whether the third request is a configuration configuration request, a string descriptor request, or a device descriptor request. If the third request is a configuration request, Step S105 is performed. If the third request is a request for acquiring a character string descriptor, step S106 is performed. If the third request is a device descriptor request, step S108 is performed.
该字符串描述符即为该 USB设备的字符串描述符,该 USB设备内置了 字符串描述符,该 USB设备在接收到主机发送的获取字符串描述符请求时, 作出相应响应, 并将该相应响应发送给主机。  The string descriptor is a string descriptor of the USB device, and the USB device has a string descriptor built in, and the USB device responds when receiving the request for acquiring the string descriptor sent by the host, and the corresponding The corresponding response is sent to the host.
5105、确定该主机运行的操作系统类型为 MAC系统, 然后结束操作系 统识别过程。 5105. Determine that the operating system type of the host is a MAC system, and then end the operating system. The identification process.
5106、 接收并解析该主机发送的第四请求, 并判断该第四请求为设置 配置请求或获取设备描述符请求, 若该第四请求为设置配置请求, 则执行 步骤 S107, 若该第四请求为获取设备描述符请求, 则执行步骤 S110。  5106. Receive and parse the fourth request sent by the host, and determine that the fourth request is a configuration configuration request or a device descriptor request. If the fourth request is a configuration configuration request, perform step S107, if the fourth request To obtain the device descriptor request, step S110 is performed.
5107、 确定该主机运行的操作系统类型为 LINUX系统, 然后结束操作 系统识别过程。  5107. Determine that the operating system type of the host is LINUX, and then end the operating system identification process.
5108、 接收并解析该主机发送的第五请求, 并判断该第五请求是否为 设置配置请求, 若是, 则执行步骤 S109。  S108: Receive and parse the fifth request sent by the host, and determine whether the fifth request is a configuration configuration request, and if yes, execute step S109.
5109、 确定该主机运行的操作系统类型为 WINDOWS系统, 然后结束 操作系统识别过程。  5109. Determine that the operating system type of the host is WINDOWS, and then end the operating system identification process.
5110、 接收并解析该主机发送的第六请求, 并判断该第六请求是否为 设置配置请求, 若是, 则执行步骤 Slll。  S110: Receive and parse the sixth request sent by the host, and determine whether the sixth request is a configuration request, and if yes, perform step S11.
5111、 确定该主机运行的操作系统类型为 WINDOWS系统。  5111. Determine that the operating system type of the host is WINDOWS.
通过上述步骤 S101至步骤 S111可以看出, 当主机下发的请求的顺序 及内容为以下三种情况时: (1 )获取设备描述符请求 设置配置请求, (2 ) 获取配置描述符请求 获取设备描述符请求 设置配置请求, (3 )获取配置 描述符请求 -获取字符串描述符-获取设备描述符请求 -设置配置请求, 可 以确定该主机运行的操作系统为 WINDOWS系统; 当主机下发的请求的顺 序及内容为: 获取配置描述符请求 -设置配置请求,可确定该主机运行的操 作系统为 MAC系统; 当主机下发的请求的顺序及内容为: 获取配置描述符 请求 获取字符串描述符-设置配置请求, 可确定该主机运行的操作系统为 LINUX系统。 参照图 3, 图 3为本发明实施例的 USB设备的结构示意图, 该 USB设 备包括请求接收模块 10, 与该请求接收模块 10连接的确定模块 20, 与该 确定模块 20连接的锁定模块 30; 其中: 该请求接收模块 10, 配置为在该 USB设备在与主机建立连接后, 侦测 并接收该主机依次下发的至少两个请求; It can be seen from the above steps S101 to S111 that when the order and content of the request issued by the host are the following three conditions: (1) acquiring a device descriptor request setting configuration request, and (2) acquiring a configuration descriptor request acquiring device The descriptor request sets the configuration request, and (3) obtains the configuration descriptor request-acquires the string descriptor-acquires the device descriptor request-sets the configuration request, and can determine that the operating system running by the host is the WINDOWS system; The order and content are: Get configuration descriptor request - Set configuration request, determine the operating system running on the host as the MAC system; When the order and content of the request issued by the host is: Get the configuration descriptor request to obtain the string descriptor - Set the configuration request to determine that the operating system running on the host is a LINUX system. Referring to FIG. 3, FIG. 3 is a schematic structural diagram of a USB device according to an embodiment of the present invention. The USB device includes a request receiving module 10, a determining module 20 connected to the request receiving module 10, and a locking module 30 connected to the determining module 20; among them: The request receiving module 10 is configured to: after the USB device establishes a connection with the host, detect and receive at least two requests that are sent by the host in sequence;
该确定模块 20, 配置为根据该请求接收模块接收的请求的顺序及内容 确定该主机运行的操作系统类型;  The determining module 20 is configured to determine, according to the order and content of the request received by the receiving module, an operating system type run by the host;
该锁定模块 30,配置为根据预先确定的操作系统类型与 USB设备的工 作模式的映射关系, 锁定与确定的操作系统类型对应的 USB设备的工作模 式, 并使得该 USB设备根据锁定的工作模式运行。  The locking module 30 is configured to lock a working mode of the USB device corresponding to the determined operating system type according to a predetermined mapping relationship between the operating system type and the working mode of the USB device, and enable the USB device to operate according to the locked working mode. .
USB设备通过 USB接口与主机建立连接,该主机可以为个人电脑 PC, 或其他支持 USB主控制器的设备,例如掌上电脑等。该 USB设备与主机建 立连接后,主机向该 USB设备下发相应的请求,该 USB设备的请求接收模 块 10侦测并接收该主机依次下发的至少两个请求。 使用不同操作系统的主 机, 其向 USB设备发送的请求的内容和顺序是不同的, 因此, USB设备的 确定模块 20可根据接收的请求的顺序及内容确定该主机运行的操作系统。  The USB device establishes a connection with the host through a USB interface, which can be a personal computer PC, or other device that supports a USB host controller, such as a palmtop computer. After the USB device is connected to the host, the host sends a corresponding request to the USB device, and the request receiving module 10 of the USB device detects and receives at least two requests issued by the host in sequence. The host and the host using different operating systems have different contents and order of the requests sent to the USB device. Therefore, the determining module 20 of the USB device can determine the operating system running by the host according to the order and content of the received request.
对应主机运行的不同操作系统, USB设备的工作模式也不相同, 操作 系统类型与 USB设备的工作模式的映射关系可预先确定,如上述表一所示。 通过确定模块 20确定出主机运行的操作系统后, 该锁定模块将该 USB设 备的工作模式切换到与该主机运行的操作系统适配的工作模式。  The working mode of the USB device is different for different operating systems running on the host. The mapping relationship between the operating system type and the working mode of the USB device can be determined in advance, as shown in Table 1 above. After the determining module 20 determines the operating system running by the host, the locking module switches the working mode of the USB device to an operating mode that is adapted to the operating system running by the host.
USB设备可以分为免驱 USB设备和非免驱 USB设备。 当该 USB设备 为非免驱 USB设备,且主机运行的操作系统类型为 WINDOWS系统时,则 该锁定模块 30将该 USB设备切换到模式一, 该 USB设备的光盘内容加载 Windows 下的 ISO 文件, 安装驱动程序和应用程序并切换到带 NDIS ( Network Driver Interface Specification, 网络驱动程序接口规范的简称) 的工作模式, 然后正常运行。  USB devices can be divided into drive-free USB devices and non-drive-free USB devices. When the USB device is a non-free USB device and the operating system type of the host is WINDOWS, the locking module 30 switches the USB device to mode one, and the content of the CD device of the USB device loads the ISO file under Windows. Install the driver and application and switch to the working mode with NDIS (Network Driver Interface Specification), and then run normally.
当该 USB设备为非免驱 USB设备,且主机运行的操作系统类型为 MAC 系统时, 则该锁定模块 30将该 USB设备切换到模式三, 该 USB设备直接 切换到带有 ECM且光盘共存的工作模式, 加载 Mac下的 ISO文件安装驱 动程序和应用程序,为 VOUSB或者 SIMREADER等功能端口加载驱动后, 然后正常运行。 When the USB device is a non-free USB device and the operating system type of the host is a MAC system, the locking module 30 switches the USB device to mode three, and the USB device directly Switch to the working mode with ECM and CD coexistence, load the ISO file under Mac and install the driver and application, load the driver for the function port such as VOUSB or SIMREADER, and then run normally.
当该 USB 设备为非免驱 USB 设备, 且主机运行的操作系统类型为 LINUX系统时, 则该锁定模块 30将该 USB设备切换到模式五, 该 USB设 备直接切换到带有 ECM且光盘共存的工作模式, 加载 LINUX下的 ISO文 件安装驱动程序和应用程序, 为 VOUSB或者 SIMREADER等功能端口加 载驱动后, 然后正常运行。  When the USB device is a non-disabled USB device, and the operating system type of the host is LINUX, the locking module 30 switches the USB device to mode five, and the USB device directly switches to the CCM with the ECM and the optical disk coexisting. Working mode, load the ISO file under Linux to install the driver and application, load the driver for the function port such as VOUSB or SIMREADER, and then run normally.
当该 USB 设备为免驱 USB 设备, 且主机运行的操作系统类型为 WINDOWS系统时,则该锁定模块 30将该 USB设备切换到模式二,该 USB 设备加载公用的 ISO 文件来安装 WEBUI 的快捷方式, 然后切换到带有 NDIS的工作模式, 然后正常运行。  When the USB device is a USB-free device and the operating system type of the host is WINDOWS, the locking module 30 switches the USB device to mode 2, and the USB device loads the common ISO file to install the WEBUI shortcut. , then switch to working mode with NDIS and then run normally.
当该 USB设备为免驱 USB设备, 且主机运行的操作系统类型为 MAC 系统时, 则该锁定模块 30将该 USB设备切换到模式四, 该 USB设备直接 切换到带有 ECM的工作模式, 并且光盘共存,再加载公用的 ISO文件来安 装 WEBUI的快捷方式, 然后正常运行。  When the USB device is a USB-free device and the operating system type of the host is a MAC system, the locking module 30 switches the USB device to mode four, and the USB device directly switches to the working mode with the ECM, and The CDs coexist, then load the public ISO file to install the WEBUI shortcut, and then run normally.
当该 USB设备为免驱 USB设备,且主机运行的操作系统类型为 LINUX 系统时, 则该锁定模块 30将该 USB设备切换到模式六, 该 USB设备直接 切换到带有 ECM的工作模式, 并且光盘共存,再加载公用的 ISO文件来安 装 WEBUI的快捷方式, 然后正常运行。  When the USB device is a USB-free device and the operating system type of the host is a LINUX system, the locking module 30 switches the USB device to mode 6, and the USB device directly switches to the working mode with the ECM, and The CDs coexist, then load the public ISO file to install the WEBUI shortcut, and then run normally.
从上述工作模式可以看出, 当 USB设备为非免驱 USB设备时, USB 设备只需要加载当前主机运行的操作系统相应的 ISO文件进行安装即可, 不需要全部加载, 可以节省 ISO文件的加载时间。  As can be seen from the above working mode, when the USB device is a non-disabled USB device, the USB device only needs to load the corresponding ISO file of the operating system running the current host to install, and does not need to be fully loaded, which can save the loading of the ISO file. time.
进一步的, 该确定模块 20的详细结构示意图如图 4所示, 该操作系统 类型包括 WINDOWS系统、 MAC系统、 LINUX系统等, 该 WINDOWS系 统包括 WINDOWS XP、 WINDOWS XP SP2、 WIN 7、 WINDOWS VISTA 等。 该确定模块 20包括判断单元 21, 与所述判断单元 21分别连接的第一 确定单元 22、 第二确定单元 23、 第三确定单元 24、 第四确定单元 25和第 五确定单元 26。 Further, a detailed structural diagram of the determining module 20 is shown in FIG. 4, and the operating system type includes a WINDOWS system, a MAC system, a LINUX system, and the like, and the WINDOWS system The system includes WINDOWS XP, WINDOWS XP SP2, WIN 7, WINDOWS VISTA, etc. The determination module 20 includes a determination unit 21, a first determination unit 22, a second determination unit 23, a third determination unit 24, a fourth determination unit 25, and a fifth determination unit 26, which are respectively connected to the determination unit 21.
该请求接收模块 10依次接收该主机发送的第一请求和第二请求。 该判断单元 21配置为解析并判断该第一请求是否为获取设备描述符请 求及解析并判断该第二请求是否为设置配置请求。  The request receiving module 10 sequentially receives the first request and the second request sent by the host. The determining unit 21 is configured to parse and determine whether the first request is a request for acquiring a device descriptor and parsing and determining whether the second request is a setting configuration request.
该第一确定单元 22配置为在该判断单元 21 的判断结果为该第一请求 为获取设备描述符请求及第二请求为设置配置请求时, 确定该主机运行的 操作系统类型为 WINDOWS系统。  The first determining unit 22 is configured to determine, when the determining result of the determining unit 21 is that the first request is a acquiring device descriptor request and the second request is a setting configuration request, determining that the operating system type of the host is WINDOWS system.
该设备描述符即为该 USB设备的设备描述符,该 USB设备内置了设备 描述符, 该 USB设备在接收到主机发送的获取设备描述符请求时, 作出相 应响应, 并将该相应响应发送给主机。  The device descriptor is a device descriptor of the USB device, and the USB device has a device descriptor built in. When receiving the device descriptor request sent by the host, the USB device responds accordingly, and sends the corresponding response to the USB device. Host.
该配置描述符即为该 USB设备的配置描述符,该 USB设备内置了配置 描述符, 该 USB设备在接收到主机发送的获取配置描述符请求时, 作出相 应响应, 并将该相应响应发送给主机。  The configuration descriptor is a configuration descriptor of the USB device, and the USB device has a configuration descriptor built in, and the USB device responds when receiving the request for acquiring the configuration descriptor sent by the host, and sends the corresponding response to the USB device. Host.
该主机向该 USB设备下发的设置配置请求,即为该主机对该 USB设备 进行相关配置, 如分配地址。 该 USB设备接收到该主机发送的设置配置请 求时, 进行相应设置。  The configuration request sent by the host to the USB device is related to the configuration of the USB device, such as assigning an address. When the USB device receives the configuration request request sent by the host, set it accordingly.
该请求接收模块 10还配置为在接收第一请求之后接收该主机发送的第 三请求。  The request receiving module 10 is further configured to receive a third request sent by the host after receiving the first request.
该判断单元 21还配置为解析并判断该第一请求是否为获取配置描述符 请求及解析并判断该第三请求是否为设置配置请求。  The determining unit 21 is further configured to parse and determine whether the first request is to obtain a configuration descriptor request and parse and determine whether the third request is a setting configuration request.
该第二确定单元 23配置为在该判断单元 21 的判断结果为该第一请求 为获取配置描述符及第三请求为设置配置请求时, 确定该主机运行的操作 系统类型为 MAC系统。 The second determining unit 23 is configured to determine, when the determination result of the determining unit 21 is that the first request is a configuration configuration descriptor and the third request is a setting configuration request, determine an operation of the host operation. The system type is MAC system.
该字符串描述符即为该 USB设备的字符串描述符,该 USB设备内置了 字符串描述符,该 USB设备在接收到主机发送的获取字符串描述符请求时, 作出相应响应, 并将该相应响应发送给主机。  The string descriptor is a string descriptor of the USB device, and the USB device has a string descriptor built in, and the USB device responds when receiving the request for acquiring the string descriptor sent by the host, and the corresponding The corresponding response is sent to the host.
该请求接收模块 10还配置为在接收第三请求之后接收该主机发送的第 四请求。  The request receiving module 10 is further configured to receive a fourth request sent by the host after receiving the third request.
该判断单元 21还配置为解析并判断该第一请求是否为获取配置描述符 请求、 解析并判断该第三请求是否为获取字符串描述请求及解析并判断该 第四请求是否为设置配置请求。  The determining unit 21 is further configured to parse and determine whether the first request is a request for obtaining a configuration descriptor, parse and determine whether the third request is a request for obtaining a character string description and parsing and determining whether the fourth request is a setting configuration request.
该第三确定单元 24配置为在该判断单元 21 的判断结果为第一请求为 获取配置描述符请求、 该第三请求为获取字符串描述请求及该第四请求为 设置配置请求时, 确定该主机运行的操作系统类型为 LINUX系统。  The third determining unit 24 is configured to determine, when the determining result of the determining unit 21 is that the first request is a get configuration descriptor request, the third request is a get string description request, and the fourth request is a setting configuration request, The operating system type that the host runs is LINUX.
该请求接收模块 10还配置为在接收第三请求之后接收该主机发送的第 五请求; 该判断单元 21还配置为解析并判断该第一请求是否为获取配置描 述符请求、 解析并判断该第三请求是否为获取设备描述符请求及解析并判 断该第五请求是否为设置配置请求。  The request receiving module 10 is further configured to receive a fifth request sent by the host after receiving the third request; the determining unit 21 is further configured to parse and determine whether the first request is to obtain a configuration descriptor request, parse and determine the first request Whether the three requests are for obtaining a device descriptor request and parsing and determining whether the fifth request is a configuration configuration request.
该第四确定单元 25配置为在该判断单元 21 的判断结果为第一请求为 获取配置描述符请求、 该第三请求为获取设备描述符请求及该第五请求为 设置配置请求时, 确定该主机运行的操作系统类型为 WINDOWS系统。  The fourth determining unit 25 is configured to determine, when the determining result of the determining unit 21 is that the first request is a acquiring configuration descriptor request, the third request is a acquiring device descriptor request, and the fifth request is a setting configuration request, The operating system type that the host runs is WINDOWS.
该请求接收模块 10还配置为在接收第四请求之后接收该主机发送的第 六请求。  The request receiving module 10 is further configured to receive a sixth request sent by the host after receiving the fourth request.
该判断单元 21还配置为解析并判断该第一请求是否为获取配置描述符 请求、 解析并判断该第三请求是否为获取字符串描述符请求、 解析并判断 该第四请求是否为设备描述符请求及解析并判断该第六请求是否为设置配 置请求。 该第五确定单元 26配置为在该判断单元 21 的判断结果为第一请求为 获取配置描述符请求、 该第三请求为获取字符串描述符请求、 该第四请求 为设备描述符请求及该第六请求为设置配置请求时, 确定该主机运行的操 作系统类型为 WINDOWS系统。 The determining unit 21 is further configured to parse and determine whether the first request is a request for acquiring a configuration descriptor, parse and determine whether the third request is a request for acquiring a string descriptor, parsing and determining whether the fourth request is a device descriptor. Requesting and parsing and determining whether the sixth request is a setup configuration request. The fifth determining unit 26 is configured to determine, in the determining unit 21, that the first request is a get configuration descriptor request, the third request is a get string descriptor request, the fourth request is a device descriptor request, and the When the sixth request is to set a configuration request, it is determined that the operating system type of the host is WINDOWS system.
上述各单元可以由电子设备中的中央处理器( Central Processing Unit, CPU ), 数字信号处理器 (Digital Signal Processor, DSP )或可编程逻辑阵 列 (Field - Programmable Gate Array, FPGA ) 实现。  Each of the above units may be implemented by a central processing unit (CPU), a digital signal processor (DSP) or a Field-Programmable Gate Array (FPGA) in an electronic device.
本领域内的技术人员应明白, 本发明的实施例可提供为方法、 系统、 或计算机程序产品。 因此, 本发明可釆用硬件实施例、 软件实施例、 或结 合软件和硬件方面的实施例的形式。 而且, 本发明可釆用在一个或多个其 中包含有计算机可用程序代码的计算机可用存储介质 (包括但不限于磁盘 存储器和光学存储器等 )上实施的计算机程序产品的形式。  Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of a hardware embodiment, a software embodiment, or an embodiment of a combination of software and hardware. Moreover, the invention can be embodied in the form of a computer program product embodied on one or more computer usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、 设备(系统)、 和计算机程序 产品的流程图和 /或方框图来描述的。 应理解可由计算机程序指令实现流程 图和 /或方框图中的每一流程和 /或方框、以及流程图和 /或方框图中的流程和 /或方框的结合。 可提供这些计算机程序指令到通用计算机、 专用计算机、 嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器, 使得 在流程图一个流程或多个流程和 /或方框图一个方框或多个方框中指定的功 能的装置。  The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart and/or block diagrams, and combinations of flow and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general purpose computer, a special purpose computer, an embedded processor or other programmable data processing device processor to produce a machine such that a flow or a block diagram of a flow or a block diagram or A device that has multiple functions specified in the box.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理 设备以特定方式工作的计算机可读存储器中, 使得存储在该计算机可读存 储器中的指令产生包括指令装置的制造品, 该指令装置实现在流程图一个 流程或多个流程和 /或方框图一个方框或多个方框中指定的功能。  The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备 上, 使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机 实现的处理, 从而在计算机或其他可编程设备上执行的指令提供用于实现 在流程图一个流程或多个流程和 /或方框图一个方框或多个方框中指定的功 能的步骤。 These computer program instructions can also be loaded into a computer or other programmable data processing device Having a series of operational steps performed on a computer or other programmable device to produce computer-implemented processing, such that instructions executed on a computer or other programmable device are provided for implementing a process or processes in a flowchart and/or Or block diagram the steps of a function specified in a box or multiple boxes.
以上所述仅为本发明的优选实施例, 并非因此限制本发明的专利范围, 凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换, 或直 接或间接运用在其他相关的技术领域, 均同理包括在本发明的专利保护范 围。  The above description is only the preferred embodiment of the present invention, and is not intended to limit the scope of the invention, and the equivalent structure or equivalent flow transformation made by the specification and the drawings of the present invention may be directly or indirectly applied to other related The technical field is equally included in the scope of patent protection of the present invention.

Claims

权利要求书 claims
1、 一种 USB设备适配操作系统的方法, 其中, 该方法包括: 1. A method for adapting a USB device to an operating system, wherein the method includes:
USB设备在与主机建立连接后, 侦测并接收所述主机依次下发的至少 两个请求, 并根据接收的请求的顺序及内容确定所述主机运行的操作系统 类型; After the USB device establishes a connection with the host, it detects and receives at least two requests sent by the host in sequence, and determines the type of operating system running by the host based on the order and content of the received requests;
所述 USB设备根据预先确定的操作系统类型与 USB设备的工作模式的 映射关系, 锁定与确定的操作系统类型对应的 USB设备的工作模式, 并根 据锁定的工作模式运行。 The USB device locks the working mode of the USB device corresponding to the determined operating system type according to the predetermined mapping relationship between the operating system type and the working mode of the USB device, and runs according to the locked working mode.
2、 根据权利要求 1 所述的方法, 其中, 所述操作系统类型包括 WINDOWS系统, 所述 USB设备在与主机建立连接后, 侦测并接收所述主 机依次下发的至少两个请求, 并根据接收的请求的顺序及内容确定所述主 机运行的操作系统类型的步骤包括: 2. The method according to claim 1, wherein the operating system type includes a WINDOWS system, and after the USB device establishes a connection with the host, it detects and receives at least two requests sent by the host in sequence, and The steps of determining the type of operating system running on the host based on the sequence and content of the received requests include:
接收并解析所述主机发送的第一请求, 若所述第一请求为获取设备描 述符请求, 则继续接收并解析所述主机发送的第二请求, 若所述第二请求 为设置配置请求,则确定所述主机运行的操作系统类型为 WINDOWS系统。 Receive and parse the first request sent by the host. If the first request is a request to obtain a device descriptor, continue to receive and parse the second request sent by the host. If the second request is a setting configuration request, Then it is determined that the type of operating system running by the host is a WINDOWS system.
3、根据权利要求 2所述的方法,其中, 所述操作系统类型还包括 MAC 系统, 所述接收并解析所述主机发送的第一请求的步骤之后, 该方法还包 括: 3. The method according to claim 2, wherein the operating system type further includes a MAC system, and after the step of receiving and parsing the first request sent by the host, the method further includes:
若所述第一请求为获取配置描述符请求, 则继续接收并解析所述主机 发送的第三请求, 若所述第三请求为设置配置请求, 则确定所述主机运行 的操作系统类型为 MAC系统。 If the first request is a request to obtain a configuration descriptor, continue to receive and parse the third request sent by the host; if the third request is a set configuration request, determine that the type of operating system running by the host is MAC system.
4、根据权利要求 3所述的方法,其中,所述操作系统类型还包括 LINUX 系统,所述接收并解析所述主机发送的第三请求的步骤之后,该方法还包括: 若所述第三请求为获取字符串描述符请求, 则继续接收并解析所述主 机发送的第四请求, 若所述第四请求为设置配置请求, 则确定所述主机运 行的操作系统类型为 LINUX系统。 4. The method according to claim 3, wherein the operating system type further includes a LINUX system, and after the step of receiving and parsing the third request sent by the host, the method further includes: if the third request If the request is a string descriptor acquisition request, then continue to receive and parse the fourth request sent by the host. If the fourth request is a setting configuration request, then determine that the host operation The operating system type of the row is LINUX system.
5、 根据权利要求 3所述的方法, 其中, 所述接收并解析所述主机发送 的第三请求的步骤之后, 该方法还包括: 5. The method according to claim 3, wherein after the step of receiving and parsing the third request sent by the host, the method further includes:
若所述第三请求为获取设备描述符请求, 则继续接收并解析所述主机 发送的第五请求, 若所述第五请求为设置配置请求, 则确定所述主机运行 的操作系统类型为 WINDOWS系统。 If the third request is a request to obtain a device descriptor, continue to receive and parse the fifth request sent by the host; if the fifth request is a setting configuration request, determine that the type of operating system running by the host is WINDOWS system.
6、 根据权利要求 4所述的方法, 其中, 所述接收所述主机发送的第四 请求的步骤之后, 该方法还包括: 6. The method according to claim 4, wherein after the step of receiving the fourth request sent by the host, the method further includes:
若所述第四请求为获取设备描述符号请求, 则继续接收并解析所述主 机发送的第六请求, 若所述第六请求为设置配置请求, 则确定所述主机运 行的操作系统类型为 WINDOWS系统。 If the fourth request is a request to obtain a device descriptor, continue to receive and parse the sixth request sent by the host. If the sixth request is a set configuration request, determine that the type of operating system running by the host is WINDOWS. system.
7、 一种 USB设备, 其中, 所述 USB设备包括: 请求接收模块, 与所 述请求接收模块连接的确定模块, 与所述确定模块连接的锁定模块; 其中: 所述请求接收模块, 配置为在该 USB设备在与主机建立连接后, 侦测 并接收所述主机依次下发的至少两个请求; 7. A USB device, wherein the USB device includes: a request receiving module, a determining module connected to the request receiving module, and a locking module connected to the determining module; wherein: the request receiving module is configured as After the USB device establishes a connection with the host, detect and receive at least two requests sent by the host in sequence;
所述确定模块, 配置为根据所述请求接收模块接收的请求的顺序及内 容确定所述主机运行的操作系统类型; The determining module is configured to determine the type of operating system running on the host according to the order and content of the requests received by the request receiving module;
所述锁定模块, 配置为根据预先确定的操作系统类型与 USB设备的工 作模式的映射关系, 锁定与确定的操作系统类型对应的 USB设备的工作模 式, 并使得所述 USB设备根据锁定的工作模式运行。 The locking module is configured to lock the working mode of the USB device corresponding to the determined operating system type according to the predetermined mapping relationship between the operating system type and the working mode of the USB device, and enable the USB device to operate according to the locked working mode. run.
8、 根据权利要求 7所述的 USB设备, 其中, 所述操作系统类型包括 WINDOWS系统, 8. The USB device according to claim 7, wherein the operating system type includes a WINDOWS system,
所述请求接收模块依次接收所述主机发送的第一请求和第二请求, 所 述确定模块包括判断单元, 及与所述判断单元连接的第一确定单元; The request receiving module receives the first request and the second request sent by the host in sequence, and the determining module includes a judging unit and a first determining unit connected to the judging unit;
所述判断单元配置为解析并判断所述第一请求是否为获取设备描述符 请求及解析并判断所述第二请求是否为设置配置请求; The determination unit is configured to parse and determine whether the first request is to obtain a device descriptor Request and parse and determine whether the second request is a setting configuration request;
所述第一确定单元配置为在所述判断单元的判断结果为所述第一请求 为获取设备描述符请求及第二请求为设置配置请求时, 确定所述主机运行 的操作系统类型为 WINDOWS系统。 The first determination unit is configured to determine that the type of operating system running on the host is a WINDOWS system when the determination result of the determination unit is that the first request is a request to obtain a device descriptor and the second request is a request to set a configuration. .
9、 根据权利要求 8所述的 USB设备, 其中, 所述操作系统类型还包 括 MAC系统,所述请求接收模块还配置为在接收第一请求之后接收所述主 机发送的第三请求, 所述确定模块还包括与所述判断单元连接的第二确定 单元; 9. The USB device according to claim 8, wherein the operating system type further includes a MAC system, and the request receiving module is further configured to receive a third request sent by the host after receiving the first request, The determination module also includes a second determination unit connected to the determination unit;
所述判断单元还配置为解析并判断所述第一请求是否为获取配置描述 符请求及解析并判断所述第三请求是否为设置配置请求; The determination unit is also configured to parse and determine whether the first request is a request to obtain a configuration descriptor and to parse and determine whether the third request is a set configuration request;
所述第二确定单元配置为在所述判断单元的判断结果为所述第一请求 为获取配置描述符及第三请求为设置配置请求时, 确定所述主机运行的操 作系统类型为 MAC系统。 The second determination unit is configured to determine that the type of operating system running on the host is a MAC system when the determination result of the determination unit is that the first request is to obtain a configuration descriptor and the third request is to set a configuration request.
10、 根据权利要求 9所述的 USB设备, 其中, 所述操作系统类型还包 括 LINUX系统, 所述请求接收模块还配置为在接收第三请求之后接收所述 主机发送的第四请求, 所述确定模块还包括与所述判断单元连接的第三确 定单元; 10. The USB device according to claim 9, wherein the operating system type further includes a LINUX system, the request receiving module is further configured to receive a fourth request sent by the host after receiving the third request, The determination module also includes a third determination unit connected with the determination unit;
所述判断单元还配置为解析并判断所述第一请求是否为获取配置描述 符请求、 解析并判断所述第三请求是否为获取字符串描述请求及解析并判 断所述第四请求是否为设置配置请求; The determination unit is further configured to parse and determine whether the first request is a request to obtain a configuration descriptor, parse and determine whether the third request is a request to obtain a string description, and parse and determine whether the fourth request is a setting request. configuration request;
所述第三确定单元配置为在所述判断单元的判断结果为第一请求为获 取配置描述符请求、 所述第三请求为获取字符串描述请求及所述第四请求 为设置配置请求时, 确定所述主机运行的操作系统类型为 LINUX系统。 The third determination unit is configured to: when the judgment result of the judgment unit is that the first request is a request to obtain a configuration descriptor, the third request is a request to obtain a string description, and the fourth request is a request to set a configuration, It is determined that the type of operating system running on the host is a LINUX system.
11、 一种计算机存储介质, 其中存储有计算机可执行指令, 所述计算 机可执行指令用于执行所述权利要求 1至 6任一项所述的方法。 11. A computer storage medium in which computer-executable instructions are stored, and the computer-executable instructions are used to execute the method described in any one of claims 1 to 6.
PCT/CN2014/074759 2013-09-29 2014-04-03 Method for adapting usb device to operating system, and usb device WO2014176956A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310461390.8 2013-09-29
CN201310461390.8A CN104516842A (en) 2013-09-29 2013-09-29 Method for universal serial bus (USB) equipment quick adaptation operating system and USB equipment

Publications (1)

Publication Number Publication Date
WO2014176956A1 true WO2014176956A1 (en) 2014-11-06

Family

ID=51843100

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/074759 WO2014176956A1 (en) 2013-09-29 2014-04-03 Method for adapting usb device to operating system, and usb device

Country Status (2)

Country Link
CN (1) CN104516842A (en)
WO (1) WO2014176956A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105653304A (en) * 2014-11-14 2016-06-08 南京酷派软件技术有限公司 Method for switching operation mode, device for switching operation mode, and terminal

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446120B (en) * 2016-06-22 2020-05-15 飞天诚信科技股份有限公司 USB device and method for identifying MacOS system by USB device
CN106383796B (en) * 2016-10-18 2019-06-14 广州视睿电子科技有限公司 A kind of recognition methods and system of host operating system type
CN108733519B (en) * 2017-04-14 2022-08-16 中兴通讯股份有限公司 Configuration method of USB (universal serial bus) equipment and host

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102063320A (en) * 2011-01-06 2011-05-18 华为终端有限公司 Work mode switching methods, USB (Universal Serial Bus) equipment and host machine equipment
WO2013003227A1 (en) * 2011-06-27 2013-01-03 American Power Conversion Corporation System and methods for driverless operation of usb device
CN102890662A (en) * 2012-10-19 2013-01-23 无锡海森诺科技有限公司 Method for identifying host operating system by executing enumeration twice on USB (Universal Serial Bus) HID (Human Interface Device)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8661164B2 (en) * 2010-08-24 2014-02-25 Mediatek Inc. Method of USB device enumeration including detecting the operating system type of the USB host
CN101957807B (en) * 2010-09-16 2012-08-08 飞天诚信科技股份有限公司 Method for USB device to recognize version type of Windows operating system
CN102253904A (en) * 2011-06-08 2011-11-23 广州视睿电子科技有限公司 Method and device for identifying computer operating system by utilizing USB equipment
CN103123594A (en) * 2012-10-09 2013-05-29 中兴通讯股份有限公司 Running mode switching method of data terminal, device and data terminal

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102063320A (en) * 2011-01-06 2011-05-18 华为终端有限公司 Work mode switching methods, USB (Universal Serial Bus) equipment and host machine equipment
WO2013003227A1 (en) * 2011-06-27 2013-01-03 American Power Conversion Corporation System and methods for driverless operation of usb device
CN102890662A (en) * 2012-10-19 2013-01-23 无锡海森诺科技有限公司 Method for identifying host operating system by executing enumeration twice on USB (Universal Serial Bus) HID (Human Interface Device)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105653304A (en) * 2014-11-14 2016-06-08 南京酷派软件技术有限公司 Method for switching operation mode, device for switching operation mode, and terminal

Also Published As

Publication number Publication date
CN104516842A (en) 2015-04-15

Similar Documents

Publication Publication Date Title
US9843594B1 (en) Systems and methods for detecting anomalous messages in automobile networks
EP2447850B1 (en) Method and device for modifying driving and matching information of usb device
US8352799B2 (en) Data corruption prevention during application restart and recovery
TWI453624B (en) Information security protection host
JP2019153297A5 (en)
TWI477970B (en) Mode switch method of electronic device and assocaited electronic device
TWI613548B (en) Computing device-implemented method for remote platform management, non-transitory medium holding computer-exexutable instructions for remote platform management, and remotely managed computing device
WO2014176956A1 (en) Method for adapting usb device to operating system, and usb device
JP5129770B2 (en) Network equipment
CN101398792B (en) Method and device for implementing application of interface functional equipment
EP3238412B1 (en) Determining a reputation through network characteristics
US10158705B2 (en) Migration of hosts
WO2012155573A1 (en) Method and system enabling usb device to automatically recognize operating system
WO2015131446A1 (en) Method and device for secure access control based on on-chip bus protocol
WO2015062217A1 (en) Connection processing method and device for peripheral in virtual desktop system
WO2014127619A1 (en) Method and system for supporting access of different types of sensors
EP3314511B1 (en) Anomaly detection to identify malware
WO2014169619A1 (en) Systems and methods for installing applications
US7734743B2 (en) Method to enable infiniband network bootstrap
WO2020000657A1 (en) Method and apparatus for establishing operation and maintenance monitoring connection, terminal device, and medium
TWI501090B (en) Server system and node detection method
WO2015117460A1 (en) Method for usb device to recognize host system, usb device and storage medium
US8631177B1 (en) Multi-port device with controller for storage media device port
WO2014183358A1 (en) Method for identifying type of operating system, and usb device
US9552324B2 (en) Dynamic data collection communication between adapter functions

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14792106

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14792106

Country of ref document: EP

Kind code of ref document: A1