Communication method and system between bus equipment and computer equipment

By enumerating the USB-HID interface inside the bus device and building allocation relationships, multiple virtual devices can be simulated for independent communication, solving the problem of bandwidth limitation of the USB2.0 interface and achieving efficient data transmission of the bus device.

CN120492390APending Publication Date: 2025-08-15SHANGHAI TOSUN TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410896044.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The maximum protocol bandwidth of the USB2.0 interface is 8Mbyte/s, which limits the performance of data communication of bus devices in application scenarios where high bandwidth is required but limited cost is not further improved.

Method used

Enumerate multiple USB-HID interfaces within the bus device, and build an allocation relationship between the interface and the physical interface, simulate multiple virtual devices for independent communication, and use idle bandwidth resources to improve the bandwidth capability of the bus device.

Benefits of technology

By simulating multiple virtual USB-HID devices and making full use of idle bandwidth, the bandwidth limitation of the operating system on HID-type bus devices is solved and the communication bandwidth of the bus devices is increased.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120492390A_ABST
    Figure CN120492390A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of communication between bus equipment and computer equipment, and particularly relates to a communication method and system between the bus equipment and the computer equipment. The communication method between the bus equipment and the computer equipment comprises the following steps: enumerating a plurality of USB-HID interfaces in the bus equipment according to the types and the number of external physical interfaces of the bus equipment; constructing a distribution relationship between each USB-HID interface and each physical interface; and after the computer equipment is connected with the bus equipment, identifying each USB-HID interface, and transmitting and receiving data of the corresponding physical interface at each USB-HID interface according to the distribution relationship.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of communication between bus devices and computer devices, and in particular relates to a communication method and system between bus devices and computer devices. Background Art

[0002] Data exchange between bus devices and computer devices typically uses physical links such as USB, Ethernet, and serial ports. USB interfaces have built-in power supply and data communication capabilities, making them widely used in various interactive devices, including cameras, keyboards and mice, and various bus devices. Because the USB communication process is strictly restricted by the operating system, bus device development requires development / adaptation based on the device type. Common device driver types and characteristics are shown in the following table:

[0003] speed No need for driver Multi-process Stable transmission Abnormal retransmission Custom Driver quick no support yes yes winusb quick yes no no yes hid slow yes support yes yes CDC slow yes no no yes UVC simulation quick yes no no no

[0004] For bus devices that require multi-process access and the computer device's operating system can be driver-free, choosing the HID class devices in the table above for bus device development is the only option. At the same time, HID class devices have stable data transmission time and support mechanisms such as automatic retransmission of lost packets. Their operating characteristics are very consistent with the operating characteristics required by bus devices.

[0005] However, due to limitations of the USB protocol, the maximum protocol bandwidth of HID devices in USB2.0 is 8Mbyte / s. For some bus device applications that require high bandwidth but can only use USB2.0 due to cost considerations, once the maximum protocol bandwidth is reached, it cannot be further increased under the premise of limited bandwidth resources, which brings performance bottlenecks to communication.

[0006] Therefore, in order to solve the problem that the USB protocol cannot be used in higher bandwidth data communication scenarios due to the protocol bandwidth limitation of the data channel in the USB2.0 interface, it is urgent to design a communication method and system between a bus device and a computer device. Summary of the Invention

[0007] The object of the present invention is to provide a communication method and system between a bus device and a computer device.

[0008] In order to solve the above technical problems, the present invention provides a communication method between a bus device and a computer device, comprising:

[0009] Enumerate multiple USB-HID interfaces within the bus device according to the type and number of the external physical interfaces of the bus device;

[0010] Establish the allocation relationship between each USB-HID interface and each physical interface;

[0011] When the computer device is connected to the bus device, each USB-HID interface is identified, and communication data of the corresponding physical interface is sent and received at each USB-HID interface according to the allocation relationship.

[0012] Furthermore, the communication method between the bus device and the computer device further includes:

[0013] Numbering each USB-HID interface, the numbering including: a header and a tail; and

[0014] The USB-HID interfaces corresponding to the same bus device have the same number at the beginning and are sorted in order by the number of USB-HID interfaces.

[0015] In another aspect, the present invention further provides a communication system between a bus device and a computer device, comprising:

[0016] a computer device and at least one bus device;

[0017] The computer device is connected to each of the bus devices via corresponding USB data lines and then performs the aforementioned communication method to communicate, thereby realizing the transmission and reception of bus data.

[0018] In a third aspect, the present invention further provides a bus device, comprising:

[0019] The MCU module is configured to execute the sending and receiving of bus data;

[0020] The communication module is configured to be electrically connected to the MCU module and connected to the computer device via a USB data cable to communicate with the computer device that executes the communication method as described above.

[0021] In a fourth aspect, the present invention further provides a computer device for communicating with a bus device, comprising:

[0022] Processor, readable storage medium, communication bus and communication interface; wherein

[0023] The processor, the readable storage medium and the communication interface communicate with each other via the communication bus;

[0024] The communication interface is connected to the bus device via a USB data cable;

[0025] The readable storage medium is used to store a program for executing the communication method as described above, and the program enables the processor to execute operations corresponding to the communication method between the computer device and the bus device.

[0026] In a fifth aspect, the present invention further provides a computer-readable storage medium, which is configured to store a program for executing the communication method as described above.

[0027] In a sixth aspect, the present invention further provides a computer program product, comprising a computer program / instruction, which implements the communication method as described above when executed by a processor of a computer.

[0028] The beneficial effect of the present invention is that the communication method of the present invention notifies the computer device of the description information of the HID class bus device itself during the enumeration stage through the USB device descriptor. In the notified description information, it is indicated that there are multiple USB-HID device interfaces inside the bus device, thereby simulating the bus device into multiple virtual devices, each of which supports independent communication, thereby fully utilizing idle bandwidth and improving bandwidth effect, thereby solving the problem of bandwidth limitation of the computer device's operating system on the HID class bus device.

[0029] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description and the drawings.

[0030] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0032] Figure 1 A diagram showing the steps of a communication method between a bus device and a computer device according to some embodiments;

[0033] Figure 2 A principle block diagram of a communication system between a bus device and a computer device according to some embodiments is shown;

[0034] Figure 3 A principle block diagram of a bus device involved in some embodiments is shown;

[0035] Figure 4 A functional block diagram of a computer device according to some embodiments is shown. DETAILED DESCRIPTION

[0036] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0037] In the related art, HID bus devices are the only choice for bus devices that require multi-process access and consider that the computer device's operating system can be driver-free. However, due to the limitations of the USB protocol, the maximum protocol bandwidth of HID devices in USB 2.0 is 8Mbyte / s. For some bus device applications that require high bandwidth but can only use USB 2.0 due to cost considerations, under the premise of limited bandwidth resources, such as the communication method of the USB 2.0 interface, once the maximum protocol bandwidth is reached, the bandwidth cannot be further increased, thus resulting in a communication performance bottleneck.

[0038] To solve the above technical problems, at least one embodiment provides a communication method between a bus device and a computer device, comprising: enumerating multiple USB-HID interfaces within the bus device based on the type and number of the bus device's external physical interfaces; establishing an allocation relationship between each USB-HID interface and each physical interface; when the computer device is connected to the bus device, identifying each USB-HID interface, and sending and receiving communication data of the corresponding physical interface on each USB-HID interface based on the allocation relationship.

[0039] The communication method between a bus device and a computer device in this embodiment determines the bandwidth requirement of the bus device based on the type and number of the bus device's external physical interfaces, and determines the number of USB-HID interfaces that need to be enumerated within the bus device based on the bandwidth requirement, thereby simulating the bus device into multiple virtual USB-HID devices. Each virtual USB-HID device supports independent communication. When multiple virtual USB-HID devices communicate concurrently, idle bandwidth resources can be exploited, thereby achieving the effect of increasing bandwidth, thereby resolving the problem of bandwidth limitation of the computer device's operating system on HID-type bus devices with high bandwidth requirements.

[0040] Specifically, the bus device in this embodiment refers to an HID bus device that has its own HID driver.

[0041] Various non-limiting implementations of the embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.

[0042] like Figure 1 As shown, at least one embodiment provides a communication method between a bus device and a computer device, including:

[0043] Step S101, enumerating multiple USB-HID interfaces within the bus device according to the type and number of the external physical interfaces of the bus device;

[0044] Step S102, establishing an allocation relationship between each USB-HID interface and each physical interface;

[0045] Step S103 : After the computer device is connected to the bus device, each USB-HID interface is identified, and communication data of the corresponding physical interface is sent and received at each USB-HID interface according to the allocation relationship.

[0046] In some embodiments, a method for enumerating multiple USB-HID interfaces within a bus device based on the type and number of physical interfaces of the bus device includes: determining the number of USB-HID interfaces to be enumerated based on the type and number of physical interfaces of the bus device; and defining in the configuration content of a USB device descriptor that the bus device includes a corresponding number of USB-HID interfaces.

[0047] Specifically, the external physical interface categories of the bus device include various external bus interfaces, such as Ethernet interface, CAN bus interface, LIN bus interface, etc.

[0048] Specifically, a case study is used to explain in detail how to determine the number of USB-HID interfaces to be enumerated based on the type and number of physical interfaces exposed by the bus device:

[0049] Assume that a bus device has two in-vehicle Ethernet interfaces, two CANFD bus interfaces, four LIN bus interfaces, and multiple IO interfaces. The rate requirements for each external physical interface are:

[0050] (1) The rate requirements for both Automotive Ethernet 0 and Automotive Ethernet 1 are: 100 Mbyte / s;

[0051] (2) The rate requirement for 2 CANFD bus interfaces, 4 LIN bus interfaces and multiple IO interfaces is: <3Mbyte / s.

[0052] The bandwidth of a single USB-HID interface is 8Mbyte / s (USB2.0). The rate requirements of both Automotive Ethernet 0 and Automotive Ethernet 1 exceed the bandwidth rate of a single USB-HID interface. Therefore, a USB-HID interface is assigned to each Automotive Ethernet interface. The rate requirements of two CANFD bus interfaces, four LIN bus interfaces, and multiple IO interfaces are lower than those of a single USB-HID interface. Therefore, one USB-HID interface can be shared. At the same time, data from one external physical interface is not allowed to be sent and received on multiple USB-HID interfaces. Therefore, three USB-HID interfaces need to be enumerated: USB-HID0 interface, USB-HID interface 1, and USB-HID2 interface, and the distribution configuration is as follows:

[0053] (1) Data from the vehicle Ethernet 0 is sent and received via the USB-HID0 interface;

[0054] (2) Data from the vehicle Ethernet 1 is sent and received via the USB-HID1 interface;

[0055] (3) Data from two CANFDs, four LINs, and multiple IO interfaces are sent and received via the USB-HID2 interface.

[0056] Compared with the solution with a single USB-HID interface, the overall bus device rate becomes 24Mbyte / s (USB2.0). This shows that after the bus device in this case enumerates three USB-HID interfaces internally, it utilizes idle bandwidth resources and greatly improves the bandwidth capacity of the bus device.

[0057] Specifically, the USB device descriptor is used to inform the computer device of the description information of the bus device itself during the enumeration phase. The notified description information indicates that there are multiple USB-HID interfaces inside the bus device.

[0058] In some embodiments, the method of establishing the allocation relationship between each USB-HID interface and each physical interface includes: mapping an external physical interface to only one USB-HID interface; and / or mapping multiple external physical ports to the same USB-HID interface.

[0059] Specifically, when the rate requirement of a physical interface exceeds the bandwidth rate of a single USB-HID interface, a USB-HID interface must be allocated to this physical interface separately, that is, one external physical interface is mapped to one USB-HID interface; when the sum of the rate requirements of multiple physical interfaces is less than that of a single USB-HID interface, multiple physical interfaces can be set to share one USB-HID interface, that is, multiple external physical ports are mapped to the same USB-HID interface.

[0060] In some embodiments, the communication method between the bus device and the computer device further includes: numbering each USB-HID interface, wherein the numbering includes: a header and a tail; and the headers of the numbers of the USB-HID interfaces corresponding to the same bus device are the same, and the tails are sorted in sequence according to the number of USB-HID interfaces.

[0061] Specifically, a computer device may be connected to multiple bus devices at the same time. In order to distinguish which bus device a USB-HID interface identified by the computer device corresponds to, multiple USB-HID interfaces of the same bus device are numbered according to the following rules: that is, the numbers of the USB-HID interfaces corresponding to the same bus device have the same first part and are sorted in order according to the number of USB-HID interfaces.

[0062] The following example describes the communication method between bus devices and computer devices in detail:

[0063] Assume that a bus device has two in-vehicle Ethernet interfaces, and the bandwidth requirement of each in-vehicle Ethernet interface is: 100Mbyte / s. In this case, two USB-HID interfaces need to be enumerated in the bus device, corresponding to each in-vehicle Ethernet interface. The two USB-HID interfaces are numbered: A113B749-1 and A113B749-2. The first "A113B749" is the user-defined number of the USB-HID interface of the bus device, and the last "-1" and "-2" are numbered sequentially according to the number of interfaces.

[0064] The configuration description of the USB device descriptor of the bus device is as follows:

[0065] / / Device configuration descriptor

[0066] uint8_t USBD_CUSTOM_HID_CfgDesc[USB_CUSTOM_HID_CONFIG_DESC_SIZ]=

[0067] {

[0068] 0x09, / *bLength:Configuration Descriptor size* /

[0069] USB_CONFIGURATION_DESCRIPTOR_TYPE, / *bDescriptorType:Configuration* /

[0070] USB_CUSTOM_HID_CONFIG_DESC_SIZ,

[0071] / *wTotalLength:Bytes returned* /

[0072] 0x00,

[0073] 0x02, / *bNumInterfaces:1interface: 2 interfaces are defined* /

[0074] 0x01, / *bConfigurationValue:Configuration value* /

[0075] 0x00, / *iConfiguration:Index of string descriptor describing

[0076] the configuration* /

[0077] 0x80, / *bmAttributes:bus powered,0x40:remote wakeup* /

[0078] 0xFA, / *MaxPower 500mA:this current is used for detectingVbus* /

[0079] The content "0x02, / *bNumInterfaces:1interface: 2 interfaces are defined* / " indicates that two USB-HID interfaces are defined inside the bus device.

[0080] When the computer device is connected to the bus device via a USB data cable, the application on the computer device scans all connected USB-HID interfaces and determines that the two USB-HID interfaces belong to the same bus device based on the USB-HID interface numbers. At this time, the application opens each USB-HID interface and performs send and receive operations to achieve data interaction with the bus device. The data packets of each in-vehicle Ethernet are sent and received on data channel 1 and data channel 2 corresponding to the two USB-HID interfaces according to the parity, and do not distinguish whether the data channel is 1 or 2, and all are considered to be legal data.

[0081] like Figure 2 As shown, some embodiments further provide a communication system between a bus device and a computer device, comprising: a computer device and at least one bus device; the computer device is connected to each of the bus devices via a corresponding USB data cable and then executes the communication method described above to communicate, so as to realize the transmission and reception of bus data.

[0082] Please refer to the detailed description of the communication method between the bus device and the computer device, which will not be repeated here.

[0083] like Figure 3 As shown, some embodiments further provide a bus device, including:

[0084] The MCU module is configured to execute the sending and receiving of bus data; the communication module is configured to be electrically connected to the MCU module and connected to the computer device via a USB data cable to communicate with the computer device that executes the communication method as described above.

[0085] Please refer to the detailed description of the communication method between the bus device and the computer device, which will not be repeated here.

[0086] In some embodiments, the communication module is one or more of an Ethernet interface module, a CAN bus interface module, and a LIN bus interface module; the Ethernet interface module includes at least one Ethernet interface, the CAN bus interface module includes at least one CAN bus interface; and the LIN bus interface module includes at least one LIN bus interface.

[0087] like Figure 4 As shown, some embodiments further provide a computer device for communicating with a bus device, comprising:

[0088] Processor, readable storage medium, communication bus and communication interface; wherein

[0089] The processor, the readable storage medium and the communication interface communicate with each other via the communication bus;

[0090] The communication interface is connected to the bus device via a USB data cable;

[0091] The readable storage medium is used to store a program for executing the communication method as described above, and the program enables the processor to execute operations corresponding to the communication method between the computer device and the bus device.

[0092] Figure 4 The illustrated structure does not constitute a limitation on the computer device, and may include fewer or more components than shown, or combine certain components, or arrange the components differently.

[0093] In this embodiment, the communication interface is a USB port, which can be connected to an external bus device for communication.

[0094] In some embodiments, the readable storage medium or computer-readable storage medium includes at least one type of memory, including flash memory, hard disk, multimedia card, card-type memory (such as SD memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, it can be an internal storage unit of a computer device, such as a hard disk of the computer device. In other embodiments, the memory can also be an external storage device of the computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Furthermore, the memory can also include both an internal storage unit of the computer device and an external storage device. The memory can not only be used to store application software and various types of data installed in the computer device, such as computer program code, etc., but can also be used to temporarily store data that has been output or is to be output.

[0095] In some embodiments, the processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip, used to run program codes stored in a memory or process data, such as executing a computer program.

[0096] In some embodiments, the communication bus may also be an input / output bus, which may be a Peripheral Component Interconnect (PCI) bus or an Enhanced Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.

[0097] When the processor executes the program, the above Figure 1 The steps in the embodiment of the communication method between the bus device and the computer device shown are, for example, Figure 1 Steps S101 to S103 are shown.

[0098] Some embodiments further provide a computer-readable storage medium configured to store a program for executing the aforementioned communication method, wherein the program enables a processor to execute operations corresponding to the communication method between the bus device and the computer device.

[0099] Please refer to the detailed description of the communication method between the bus device and the computer device, which will not be repeated here.

[0100] Some embodiments further provide a computer program product, including a computer program / instructions, which, when executed by a computer processor, implement the steps of the aforementioned communication method. For details, please refer to the detailed description of the communication method between a bus device and a computer device, which will not be repeated here.

[0101] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a portion of code, and the module, program segment or a portion of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.

[0102] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0103] If the functions are implemented in the form of software modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or the portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention.

[0104] With the above-described preferred embodiments of the present invention as a guide, and with reference to the above description, relevant personnel are fully capable of making various changes and modifications without departing from the technical scope of this invention. The technical scope of this invention is not limited to the contents of the specification and must be determined according to the scope of the claims.

Claims

1. A communication method between a bus device and a computer device, characterized in that: include: Enumerate multiple USB-HID interfaces within the bus device according to the type and number of the external physical interfaces of the bus device; Establish the allocation relationship between each USB-HID interface and each physical interface; When the computer device is connected to the bus device, each USB-HID interface is identified, and communication data of the corresponding physical interface is sent and received at each USB-HID interface according to the allocation relationship.

2. The communication method according to claim 1, wherein: Methods for enumerating multiple USB-HID interfaces within a bus device based on the type and number of the bus device's external physical interfaces include: Determine the number of USB-HID interfaces to be enumerated based on the type and number of the external physical interfaces of the bus device; and The bus device is defined in the configuration content of the USB device descriptor to include a corresponding number of USB-HID interfaces.

3. The communication method according to claim 2, wherein: The method for establishing the allocation relationship between each USB-HID interface and each physical interface includes: Mapping an external physical interface to only one USB-HID interface; and / or Map multiple external physical ports to the same USB-HID interface.

4. The communication method according to claim 3, wherein: The communication method between the bus device and the computer device further includes: Numbering each USB-HID interface, the numbering including: a header and a tail; and The first part of the USB-HID interface number corresponding to the same bus device is the same, and the tail part is sorted in sequence according to the number of USB-HID interfaces.

5. A communication system between a bus device and a computer device, characterized in that: include: a computer device and at least one bus device; After the computer device is connected to each of the bus devices via corresponding USB data cables, the computer device executes the communication method according to any one of claims 1 to 4 to communicate with each other, thereby realizing the transmission and reception of bus data.

6. A bus device, characterized in that: include: The MCU module is configured to execute the sending and receiving of bus data; The communication module is electrically connected to the MCU module and is connected to the computer device via a USB data cable to communicate with the computer device that executes the communication method according to any one of claims 1 to 4.

7. The bus device according to claim 6, characterized in that The communication module is one or more of an Ethernet interface module, a CAN bus interface module, and a LIN bus interface module.

8. A computer device for communicating with a bus device, characterized in that: include: Processor, readable storage medium, communication bus and communication interface; in The processor, the readable storage medium and the communication interface communicate with each other via the communication bus; The communication interface is connected to the bus device via a USB data cable; The readable storage medium is used to store a program for executing the communication method according to any one of claims 1 to 4, wherein the program enables a processor to execute operations corresponding to the communication method between the computer device and the bus device.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium is configured to store a program for executing the communication method according to any one of claims 1 to 4.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a computer processor, the communication method according to any one of claims 1 to 4 is implemented.