Method for driver-free communication between USB (Universal Serial Bus) equipment and windows system
By identifying a custom USB device as a WCID device and utilizing WinUSB universal drivers, the diversity and compatibility issues of USB device drivers are solved, and driverless communication between USB devices and Windows systems is realized, simplifying the deployment and use process. Reduced maintenance costs.
Patent Information
- Application Number
- CN202411153324.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-06
AI Technical Summary
In the prior art, USB devices require different drivers, resulting in driver conflicts and incompatibility issues, and as the operating system updates require driver updates, it increases the difficulty of user settings and deployment.
By identifying a custom USB device as a WCID device, uploading the WCID value, registering the GUID of the communication interface, and using WinUSB universal driver to realize driverless communication between the USB device and the Windows system.
Simplifies deployment and use of USB devices, improves compatibility and ease of use, and reduces driver maintenance and update costs.
Smart Images

Figure CN119088462A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of USB device drivers, and in particular is a method for driver-free communication between a USB device and a Windows system. Background Art
[0002] USB (Universal Serial Bus) is a commonly used external device connection standard that provides a reliable, high-speed and universal data transfer interface. USB devices usually require drivers to communicate and interact with computers. Traditionally, in order to communicate with USB devices, specific device drivers need to be installed so that the operating system can correctly identify and control the device.
[0003] The prior art realizes communication between USB devices and the Windows operating system by writing and installing corresponding device drivers for USB devices; however, the prior art solution usually requires different drivers for different USB devices, which requires installing and managing multiple drivers when using different devices, resulting in driver conflicts and incompatibility issues; at the same time, as the Windows operating system is updated, the driver of the USB device needs to be updated to ensure compatibility with the new version of the operating system; in addition, installing a specific USB device driver usually requires administrator privileges, which increases the difficulty for users to set up and deploy USB devices.
[0004] The present invention provides a method for driver-free communication between a USB device and a Windows system to solve the above technical problems. Summary of the invention
[0005] The present invention aims to solve at least one of the technical problems existing in the prior art; to this end, the present invention proposes a method for driver-free communication between a USB device and a Windows system, which is used to solve the technical problem that the solution of the prior art usually requires different drivers for different USB devices, which requires the installation and management of multiple drivers when using different devices, resulting in driver conflicts and incompatibility problems; at the same time, as the Windows operating system is updated, the driver of the USB device needs to be updated to ensure compatibility with the new version of the operating system; in addition, the installation of a specific USB device driver usually requires administrator privileges, which increases the difficulty for users to set up and deploy USB devices.
[0006] To achieve the above object, a first aspect of the present invention provides a method for driver-free communication between a USB device and a Windows system, comprising:
[0007] Step 1: Identify the custom USB device as a WCID device; WCID (Windows Compatible ID) refers to the compatible ID, and the WCID device has a WCID value;
[0008] Step 2: Upload the WCID value corresponding to the WCID device to the Windows operating system;
[0009] Step 3: Register the GUID of the communication interface in the registry of the Windows operating system; wherein the GUID (Globally Unique Identifier) is a globally unique identifier in the Windows operating system, and the communication interface is an interface used for communication between the custom USB device and the Windows operating system;
[0010] Step 4: Connect the custom USB device to a computer running Windows operating system, and Windows operating system will automatically install WinUSB universal driver for the custom USB device;
[0011] Step 5: The Windows operating system communicates with the custom USB device through a USB API; wherein the USB API is provided by the Windows operating system, and the USB API includes a device opening function, a data reading function, and a data writing function.
[0012] Preferably, the version of the Windows operating system is Windows 8 or later.
[0013] Preferably, identifying the custom USB device as a WCID device includes:
[0014] A first descriptor is written in the custom USB device, and the content of the first descriptor is set according to the WCID specification. After the setting is completed, the custom USB device is identified as a WCID device; wherein the first descriptor includes a descriptor length, a descriptor type, several string signatures, a vendor code, and reserved bytes.
[0015] The present invention identifies a custom USB device as a WCID device by adding a description code corresponding to a WCID device in a device descriptor of the custom USB device. The WinUSB universal driver provided by the Windows operating system can match the WCID device, thereby realizing communication between the custom USB device and the Windows operating system without installing a driver, which is beneficial to improving the usability and compatibility of the custom USB device.
[0016] Preferably, uploading the WCID value corresponding to the WCID device to the Windows operating system includes:
[0017] Write a second descriptor in the custom USB device, set the WCID value corresponding to the WCID device in the second descriptor to WINUSB, and report the second descriptor to the Windows operating system; wherein the second descriptor includes descriptor length, descriptor version, descriptor index of WCID, number of bytes, reserved data, interface information, interface number, reserved bytes and sub-compatible ID.
[0018] Preferably, registering the GUID of the communication interface into a registry of the Windows operating system includes:
[0019] Write a third descriptor in the custom USB device, set the GUID of the communication interface in the third descriptor to the GUID corresponding to the communication interface between the custom USB device and the Windows operating system, report the third descriptor to the Windows operating system, and the Windows operating system writes the GUID into the registry; wherein the third descriptor includes the attribute descriptor of the WCID, the attribute descriptor of the registry, the attribute descriptor length, the descriptor type, the attribute name length, the GUID of the communication interface, the attribute name data, the attribute data length, and the Unicode format data of the GUID of the communication interface.
[0020] Compared with the prior art, the present invention has the following beneficial effects:
[0021] The present invention identifies a customized USB device as a WCID device, sets the WCID value of the WCID device to WINUSB, and uses the WinUSB universal driver to achieve driver-free communication between the USB device and the Windows operating system. Compared with the existing USB communication solution, the present invention does not need to install a specific device driver, simplifies the deployment and use of the USB device, and is conducive to improving the compatibility and usability of the USB device. In addition, since only the WinUSB universal driver provided by the Windows operating system needs to be maintained and updated, it is not necessary to maintain and update the specific driver in each USB device, which is conducive to reducing the cost of maintaining and updating the driver of the USB device. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1This is a flow chart of the method for driver-free communication between a USB device and a Windows operating system in the present invention. DETAILED DESCRIPTION
[0024] The technical scheme of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] See also Figure 1 The first aspect of the present invention provides a method for driver-free communication between a USB device and a Windows system, comprising:
[0026] Step 1: Identify the custom USB device as a WCID device; WCID (Windows Compatible ID) refers to the compatible ID, and the WCID device has a WCID value;
[0027] Step 2: Upload the WCID value corresponding to the WCID device to the Windows operating system;
[0028] Step 3: Register the GUID of the communication interface in the registry of the Windows operating system; wherein the GUID (Globally Unique Identifier) is a globally unique identifier in the Windows operating system, and the communication interface is an interface used for communication between the custom USB device and the Windows operating system;
[0029] Step 4: Connect the custom USB device to a computer running Windows operating system, and Windows operating system will automatically install WinUSB universal driver for the custom USB device;
[0030] Step 5: The Windows operating system communicates with the custom USB device through a USB API; wherein the USB API is provided by the Windows operating system, and the USB API includes a device opening function, a data reading function, and a data writing function.
[0031] In this embodiment, the version of the Windows operating system is Windows 8 or later.
[0032] In this embodiment, identifying the custom USB device as a WCID device includes:
[0033] A first descriptor is written in the custom USB device, and the content of the first descriptor is set according to the WCID specification. After the setting is completed, the custom USB device is identified as a WCID device; wherein the first descriptor includes a descriptor length, a descriptor type, several string signatures, a vendor code, and reserved bytes.
[0034] Exemplarily, the content of the first descriptor is set to:
[0035] {
[0036] 0x12, / *bLength* /
[0037] USB_STRING_DESCRIPTOR_TYPE, / *bDescriptorType* /
[0038] 'M',0x00, / *wcChar0* /
[0039] 'S',0x00, / *wcChar1* /
[0040] 'F',0x00, / *wcChar2* /
[0041] 'T',0x00, / *wcChar3* /
[0042] '1',0x00, / *wcChar4* /
[0043] '0',0x00, / *wcChar5* /
[0044] '0',0x00, / *wcChar6* /
[0045] 0x17, / *bVendorCode* /
[0046] 0x00, / *bReserved* /
[0047] };
[0048] Among them, bLength is the descriptor length, bDescriptorType is the descriptor type, wcChar0, wcChar1, ..., wcChar6 are the string signature, bVendorCode is the vendor code, and bReserved is the reserved byte.
[0049] The present invention identifies a custom USB device as a WCID device by adding a description code corresponding to a WCID device in a device descriptor of the custom USB device. The WinUSB universal driver provided by the Windows operating system can match the WCID device, thereby realizing communication between the custom USB device and the Windows operating system without installing a driver, which is beneficial to improving the usability and compatibility of the custom USB device.
[0050] In this embodiment, uploading the WCID value corresponding to the WCID device to the Windows operating system includes:
[0051] Write a second descriptor in the custom USB device, set the WCID value corresponding to the WCID device in the second descriptor to WINUSB, and report the second descriptor to the Windows operating system; wherein the second descriptor includes descriptor length, descriptor version, descriptor index of WCID, number of bytes, reserved data, interface information, interface number, reserved bytes and sub-compatible ID.
[0052] Exemplarily, the content of the second descriptor is set to:
[0053] {
[0054] 0x28,0x00,0x00,0x00, / *dwLength* /
[0055] 0x00,0x01, / *bcdVersion* /
[0056] 0x04,0x00, / *wIndex* /
[0057] 0x01, / *bCount* /
[0058] 0,0,0,0,0,0,0, / *Reserved* /
[0059] / *WCID Function* /
[0060] 0x00, / *bFirstInterfaceNumber* /
[0061] 0x01, / *bReserved* /
[0062] / *WCID* /
[0063] 'W','I','N','U','S','B',0x00,0x00,
[0064] / *sub WCID* /
[0065] 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
[0066] 0,0,0,0,0,0, / *Reserved* /
[0067] };
[0068] Among them, dwLength is the descriptor length, bcdVersion is the descriptor version, wIndex is the descriptor index of WCID, bCount is the number of bytes, Reserved is the reserved data, WCID Function is the interface information, bFirstInterfaceNumber is the interface number, bReserved is the reserved byte, and sub WCID is the sub-compatible ID.
[0069] In this embodiment, registering the GUID of the communication interface into the registry of the Windows operating system includes:
[0070] Write a third descriptor in the custom USB device, set the GUID of the communication interface in the third descriptor to the GUID corresponding to the communication interface between the custom USB device and the Windows operating system, report the third descriptor to the Windows operating system, and the Windows operating system writes the GUID into the registry; wherein the third descriptor includes the attribute descriptor of the WCID, the attribute descriptor of the registry, the attribute descriptor length, the descriptor type, the attribute name length, the GUID of the communication interface, the attribute name data, the attribute data length, and the Unicode format data of the GUID of the communication interface.
[0071] Exemplarily, the content of the third descriptor is set to:
[0072] {
[0073] / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
[0074] / / / WCID property descriptor
[0075] / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
[0076] 0x8e,0x00,0x00,0x00, / *dwLength* /
[0077] 0x00,0x01, / *bcdVersion* /
[0078] 0x05,0x00, / *wIndex* /
[0079] 0x01,0x00, / *wCount* /
[0080] / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
[0081] / / / registry propter descriptor
[0082] / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
[0083] 0x84,0x00,0x00,0x00, / *dwSize* /
[0084] 0x01,0x00,0x00,0x00, / *dwPropertyDataType* /
[0085] 0x28,0x00, / *wPropertyNameLength* /
[0086] / *DeviceInterfaceGUID* /
[0087] 'D',0x00,'e',0x00,'v',0x00,'i',0x00, / *wcName_20* /
[0088] 'c',0x00,'e',0x00,'I',0x00,'n',0x00, / *wcName_20* /
[0089] 't',0x00,'e',0x00,'r',0x00,'f',0x00, / *wcName_20* /
[0090] 'a',0x00,'c',0x00,'e',0x00,'G',0x00, / *wcName_20* /
[0091] 'U',0x00,'I',0x00,'D',0x00,0x00,0x00, / *wcName_20* /
[0092] 0x4e,0x00,0x00,0x00, / *dwPropertyDataLength* /
[0093] / *{1D4B2365-4749-48EA-B38A-7C6FDDDD7E26}* /
[0094] '{',0x00,'1',0x00,'D',0x00,'4',0x00, / *wcData_39* /
[0095] 'B',0x00,'2',0x00,'3',0x00,'6',0x00, / *wcData_39* /
[0096] '5',0x00,'-',0x00,'4',0x00,'7',0x00, / *wcData_39* /
[0097] '4',0x00,'9',0x00,'-',0x00,'4',0x00, / *wcData_39* /
[0098] '8',0x00,'E',0x00,'A',0x00,'-',0x00, / *wcData_39* /
[0099] 'B',0x00,'3',0x00,'8',0x00,'A',0x00, / *wcData_39* /
[0100] '-',0x00,'7',0x00,'C',0x00,'6',0x00, / *wcData_39* /
[0101] 'F',0x00,'D',0x00,'D',0x00,'D',0x00, / *wcData_39* /
[0102] 'D',0x00,'7',0x00,'E',0x00,'2',0x00, / *wcData_39* /
[0103] '6',0x00,'}',0x00,0x00,0x00, / *wcData_39* /
[0104] };
[0105] Among them, WCID property descriptor is the property descriptor of WCID, registry propterdescriptor is the property descriptor of the registry, dwSize is the length of the property descriptor, dwPropertyDataType is the descriptor type, wPropertyNameLength is the property name length, DeviceInterfaceGUID is the GUID of the communication interface, wcName_20 is the property name data, dwPropertyDataLength is the property data length, and wcData_39 is the Unicode format data of the GUIDGUID of the communication interface.
[0106] Part of the data in the above formula is calculated by removing the dimension and taking its numerical value. The formula is a formula closest to the actual situation obtained by software simulation of a large amount of collected data; the preset parameters and preset thresholds in the formula are set by technical personnel in this field according to actual conditions or obtained through simulation of a large amount of data.
[0107] Working principle of the present invention:
[0108] The present invention identifies a custom USB device as a WCID device; uploads a WCID value corresponding to the WCID device to a Windows operating system; registers a GUID of a communication interface into a registry of the Windows operating system; connects the custom USB device to a computer running the Windows operating system, and the Windows operating system automatically installs a WinUSB universal driver for the custom USB device; and the Windows operating system communicates with the custom USB device through a USB API.
[0109] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.
Claims
1. A method for driver-free communication between a USB device and a Windows system, characterized in that: Step 1: Identify the custom USB device as a WCID device; WCID refers to compatible ID, and the WCID device has a WCID value; Step 2: Upload the WCID value corresponding to the WCID device to the Windows operating system; Step 3: Register the GUID of the communication interface in the registry of the Windows operating system; wherein the GUID is a globally unique identifier in the Windows operating system, and the communication interface is an interface used for communication between the custom USB device and the Windows operating system; Step 4: Connect the custom USB device to a computer running Windows operating system, and Windows operating system will automatically install WinUSB universal driver for the custom USB device; Step 5: The Windows operating system communicates with the custom USB device through a USB API; wherein the USB API is provided by the Windows operating system, and the USB API includes a device opening function, a data reading function, and a data writing function.
2. The method for driver-free communication between a USB device and a Windows system according to claim 1, characterized in that: The version of Windows operating system is Windows 8 and later.
3. The method for driver-free communication between a USB device and a Windows system according to claim 1, characterized in that: The step of identifying the custom USB device as a WCID device includes: A first descriptor is written in the custom USB device, and the content of the first descriptor is set according to the WCID specification. After the setting is completed, the custom USB device is identified as a WCID device; wherein the first descriptor includes a descriptor length, a descriptor type, several string signatures, a vendor code, and reserved bytes.
4. The method for driver-free communication between a USB device and a Windows system according to claim 1, characterized in that: The uploading of the WCID value corresponding to the WCID device to the Windows operating system includes: Write a second descriptor in the custom USB device, set the WCID value corresponding to the WCID device in the second descriptor to WINUSB, and report the second descriptor to the Windows operating system; wherein the second descriptor includes descriptor length, descriptor version, descriptor index of WCID, number of bytes, reserved data, interface information, interface number, reserved bytes and sub-compatible ID.
5. The method for driver-free communication between a USB device and a Windows system according to claim 1, characterized in that: The step of registering the GUID of the communication interface into a registry of the Windows operating system includes: Write a third descriptor in the custom USB device, set the GUID of the communication interface in the third descriptor to the GUID corresponding to the communication interface between the custom USB device and the Windows operating system, report the third descriptor to the Windows operating system, and the Windows operating system writes the GUID into the registry; wherein the third descriptor includes the attribute descriptor of the WCID, the attribute descriptor of the registry, the attribute descriptor length, the descriptor type, the attribute name length, the GUID of the communication interface, the attribute name data, the attribute data length, and the Unicode format data of the GUID of the communication interface.
Citation Information
Patent Citations
Equipment driving method, equipment driving device and communication system
CN101520756A
A method and system for identifying USB devices
CN102262600A
