A data transmission method and device, electronic equipment and storage medium
By configuring dedicated and shared bandwidth between the USB host and slave devices to transmit different types of service streams, the problems of low USB transmission efficiency and insufficient real-time performance in existing technologies are solved, achieving efficient and orderly data transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-04-10
AI Technical Summary
Existing USB transmission technology cannot meet the real-time control requirements of multiple external devices. Furthermore, the transmission method abstracted into composite devices is inefficient, while the transmission method abstracted into fixed devices increases software overhead, affecting processing efficiency and time.
By configuring dedicated bandwidth and shared bandwidth between the USB host and slave devices, different types of service streams can be transmitted respectively. Dedicated bandwidth is matched with high-priority devices, and shared bandwidth is used for low-priority devices. High-priority devices have dedicated bandwidth, while low-priority devices share bandwidth, and the bandwidth is dynamically adjusted based on historical transmission records.
It enables real-time data transmission between the host and multiple external devices, reduces communication difficulty and resource consumption, ensures orderly data transmission, and avoids the defects of software protocol-defined data packets.
Smart Images

Figure CN121239652B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data transmission, and in particular to a data transmission method and device, electronic equipment and storage medium. BACKGROUND
[0002] With the wide application of Stream technology in the field of USB (Universal Serial Bus) transmission, the Host (i.e. the host computer) can transmit different service streams to the Device (i.e. the slave) according to different control units to achieve the control purpose of multiple devices.
[0003] In the prior art, the USB host abstracts multiple external devices as a composite device, switches the composite device interface according to different operation targets, and the USB slave receives corresponding data after switching the target device to control different external devices; or the USB host abstracts the external device as a fixed device class and establishes a software protocol before data transmission, inserts fields such as data type and data length before sending data stream, and guides the USB slave to control the corresponding external device according to the analysis result.
[0004] However, the transmission mode of abstracting as a composite device can only control one external device at the same time, which cannot meet the real-time control requirements of multiple external devices, and the transmission mode of abstracting as a fixed device class not only greatly increases the software overhead, but also affects the processing efficiency and processing time of the entire USB system. SUMMARY
[0005] The present application provides a data transmission method, device, electronic equipment and storage medium to solve the problem of low data transmission efficiency between the USB host and the USB slave.
[0006] According to an aspect of the present application, a data transmission method is provided, applied to a host, comprising:
[0007] In response to obtaining the to-be-transmitted data, a first service stream in the to-be-transmitted data with a receiving object as a first type device is configured in a corresponding dedicated bandwidth; wherein the dedicated bandwidth is matched with the first type device one by one;
[0008] A second service stream in the to-be-transmitted data with a receiving object as a second type device is configured in a shared bandwidth; wherein the priority of the first type device is higher than that of the second type device;
[0009] The to-be-transmitted data is sent to the slave through the dedicated bandwidth and the shared bandwidth, so that the first service stream is sent to the corresponding first type device and the second service stream is sent to the corresponding second type device through the slave.
[0010] The first service flow of the first type device in the to-be-transmitted data is configured in the corresponding dedicated bandwidth, including: configuring the first service flow and the device identifier of the first type device in the corresponding dedicated bandwidth.
[0011] The second type device includes a transient device and a time-consuming device, and the priority of the transient device is higher than that of the time-consuming device.
[0012] Before obtaining the to-be-transmitted data, further comprising: configuring a first input endpoint, a second input endpoint, a first output endpoint and a second output endpoint through an abstract class; wherein the first output endpoint is used for the master to send first configuration information to the slave; the second output endpoint is used for the master to send transmission data to the slave; the first input endpoint is used for the slave to send second configuration information to the master; and the second input endpoint is used for the slave to send transmission data to the master.
[0013] After configuring the first input endpoint, the second input endpoint, the first output endpoint and the second output endpoint through the abstract class, further comprising: configuring the dedicated bandwidth and the shared bandwidth according to the user configuration information, and sending the configuration result as the first configuration information to the slave, or configuring the dedicated bandwidth and the shared bandwidth according to the second configuration information sent by the slave; wherein the first configuration information and the second configuration information include the identifier and the required bandwidth of each first type device, and the identifier of each second type device.
[0014] After configuring the first input endpoint, the second input endpoint, the first output endpoint and the second output endpoint through the abstract class, further comprising: if it is determined according to the historical transmission record that the number occupancy rate of the first dedicated bandwidth is less than a preset occupancy threshold, performing bandwidth downsizing processing on the first dedicated bandwidth; if it is determined according to the historical transmission record that the data delay frequency of the second dedicated bandwidth is greater than a preset frequency threshold, performing bandwidth upsizing processing on the second dedicated bandwidth; sending the bandwidth update result to the slave through the second configuration information; wherein the bandwidth update result includes the bandwidth downsizing result and / or the bandwidth upsizing result.
[0015] According to another aspect of the present application, a data transmission device is provided, which is applied to a master and comprises:
[0016] The dedicated bandwidth configuration module is configured to, in response to obtaining to-be-transmitted data, configure a first service flow of a first type device in the to-be-transmitted data in a corresponding dedicated bandwidth; wherein the dedicated bandwidth is matched with the first type device one by one.
[0017] The shared bandwidth configuration module is configured to configure a second service flow, whose receiving object in the to-be-transmitted data is a second type device, in a shared bandwidth; wherein the first type device has a higher priority than the second type device;
[0018] The data transmission execution module is configured to send the to-be-transmitted data to the slave through the dedicated bandwidth and the shared bandwidth, so as to send the first service flow to the corresponding first type device and send the second service flow to the corresponding second type device through the slave.
[0019] According to another aspect of the present application, an electronic device is provided, which comprises:
[0020] at least one processor; and
[0021] a memory connected to the at least one processor in communication; wherein
[0022] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the data transmission method according to any of the embodiments of the present application.
[0023] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to implement the data transmission method according to any of the embodiments of the present application when executed by the processor.
[0024] According to another aspect of the present application, a computer program product is provided, which comprises a computer program for implementing the data transmission method according to any of the embodiments of the present application when executed by a processor.
[0025] The technical solution of the embodiments of the present application configures the first service flow, whose receiving object in the to-be-transmitted data is a first type device, in a corresponding dedicated bandwidth, configures the second service flow, whose receiving object is a second type device, in a shared bandwidth, and finally sends the first service flow to the corresponding first type device and sends the second service flow to the corresponding second type device through the dedicated bandwidth and the shared bandwidth. Thus, not only is the real-time data transmission between the host and the plurality of external devices realized, but also the defect of defining various data packets through software protocols to control different external devices is avoided, the communication difficulty between the host and the slave is reduced, the resource consumption amount in the data transmission process is reduced, and in addition, when the service flow exceeds the bandwidth, the data of the specified type device can still be ensured to be transmitted in order.
[0026] It is to be understood that the embodiments described herein are merely exemplary of the application and that a person skilled in the art can devise other embodiments without departing from the scope of the present application. It is also to be understood that not all of the features and / or benefits described and / or illustrated herein need be present in every embodiment of the application. The scope of the application is, therefore, indicated by the appended claims, rather than by the foregoing description. For the purpose of completeness, additional aspects of the application will be described in more detail in the following. BRIEF DESCRIPTION OF DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort based on these drawings.
[0028] Figure 1 is a flow chart of a data transmission method according to an embodiment of the present application;
[0029] Figure 2 is a flow chart of another data transmission method according to an embodiment of the present application;
[0030] Figure 3 is a flow chart of yet another data transmission method according to an embodiment of the present application;
[0031] Figure 4 is a structural schematic diagram of a data transmission device according to an embodiment of the present application;
[0032] Figure 5 is a structural schematic diagram of an electronic device implementing the data transmission method according to an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to make the technical personnel in the art better understand the present application, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort should be within the scope of protection of the present application.
[0034] It is to be understood that the terms "first", "second", and the like, used in the description and the claims of the application and the above drawings, are used to distinguish between similar objects, and are not necessarily used to describe a particular sequential or chronological order. It is to be understood that the use of data herein is interchangeable, where appropriate, so that embodiments of the application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprise" and "have", and any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product, or apparatus that comprises a list of steps or units is not necessarily limited to those steps or units that are clearly listed, but can include other steps or units not clearly listed or inherent to such processes, methods, products, or apparatuses.
[0035] Embodiment one
[0036] Figure 1 A flow chart of a data transmission method provided for the embodiment one of the application, the embodiment can be applicable to the case that different types of service flows are configured according to dedicated bandwidth and shared bandwidth respectively, the method can be executed by the data transmission device in any embodiment of the application, the data transmission device can be realized in the form of hardware and / or software, and the data transmission device can be configured in a USB host (i.e. Host end), as shown in the figure, the method comprises: Figure 1
[0037] S101, in response to obtaining the to-be-transmitted data, configuring the first service flow with a receiving object being a first type device in the to-be-transmitted data in a corresponding dedicated bandwidth; wherein the dedicated bandwidth is matched with the first type device one by one.
[0038] The USB host and the USB slave are connected through a USB interface, and the USB interface is pre-divided into dedicated bandwidth and shared bandwidth; wherein the dedicated bandwidth is the bandwidth specially used by a certain first type device, and no matter whether it is a second type device or other first type device, none of them has the use right of the bandwidth; the dedicated bandwidth is matched with the first type device one by one, that is, each dedicated bandwidth only provides data transmission service for one first type device, and each first type device can only transmit data through one dedicated bandwidth.
[0039] According to the USB Stream protocol, the host allocates one kind of service flow for each first type device and second type device, at the same time, the host calculates the specific bandwidth value occupied by the dedicated bandwidth corresponding to the current first type device according to its transmission rate; for example, 256KB of dedicated bandwidth is allocated for the sound device in the first type device; 512KB of dedicated bandwidth is allocated for the microphone device in the second type device; the bandwidth value occupied by the dedicated bandwidth is always reserved for the first type device to use at any time, so as to ensure the real-time performance of the first type device in data transmission.
[0040] The first type device can be pre-configured according to the specific application scenario of the USB host and the USB slave, for example, in the smart security scenario, the camera, the video recorder and the alarm and the like can be defined as the first type device; in the smart furniture scenario, the fresh air system, the smart induction lamp and the smart television and the like can be defined as the first type device; in the smart office scenario, the printer, the scanner and the fax machine and the like can be defined as the first type device.
[0041] In particular, in order to ensure that the service flow matches the external device, the bandwidth in the USB interface can be pre-divided, for example, the first 256KB matches the first type device A, the second 256KB matches the first type device B, and the third 256KB matches the first type device C; when the first type device A and the first type device C exist in the current transmission data, the corresponding service flow is configured in the first 256KB and the third 256KB respectively, and the data in the second 256KB is kept empty, for example, the value of each digit in the second 256KB is 0; in this way, the USB slave can confirm which first type device the service flow in the current transmission data includes according to the distribution position of the service flow.
[0042] Accordingly, when the USB host obtains the to-be-transmitted data through the host computer or other devices, the service flow in the to-be-transmitted data is parsed and obtained, the service flow may include one or more service flows of the first type device, that is, the first service flow, each first service flow is matched with the corresponding dedicated bandwidth, and the first service flow is sent to the USB slave through the dedicated bandwidth; and the dedicated channel without the first service flow is kept empty.
[0043] Optionally, in the embodiment of the application, the first service flow of the first type device in the to-be-transmitted data is configured in the corresponding dedicated bandwidth, including: the first service flow and the device identifier of the first type device are configured in the corresponding dedicated bandwidth. Specifically, after the first service flow is obtained, the device identifier of the corresponding first type device can be added to each first service flow, so that the first service flow sent by the USB host is actually a combination mode of “device identifier+first service flow”.
[0044] The USB slave can determine which external device the current service flow belongs to according to the device identifier after obtaining the transmission data, and can also determine the corresponding bandwidth value of the external device according to the device identifier, and then send the data of the specified number of bits after the device identifier to the external device. Therefore, the USB host does not need to configure null data when configuring transmission data, and does not need to configure according to the bandwidth position, can sequentially connect each first service flow, and distinguish through the device identifier, which not only ensures the ordered transmission of the first service flow, but also reduces the configuration complexity of the transmission data and improves the data transmission efficiency.
[0045] S102, the second service flow with the second type device as the receiving object in the to-be-transmitted data is configured in the shared bandwidth; wherein the priority of the first type device is higher than that of the second type device.
[0046] The second type device is an external device with low real-time requirement for data transmission, and the priority thereof is lower than that of the first type device. Unlike the first type device, the service flow of the second type device does not have a dedicated bandwidth, but all service flows of the second type device share the shared bandwidth, and the second service flow with current transmission demand is configured in the shared bandwidth. Therefore, even if a new second type device is added to cause data bandwidth overflow in the shared bandwidth, the dedicated bandwidth of the first type device is not affected.
[0047] In particular, since multiple second service flows share the shared bandwidth, each second service flow does not have a fixed data position, and therefore the USB host needs to add a corresponding device identifier to each second service flow, so that the USB slave can directly obtain the corresponding second service flow according to the parsed device identifier. Similarly, after obtaining the transmission data, the USB slave can determine which second type device the current second service flow belongs to according to the device identifier, and can also determine the corresponding bandwidth value of the device according to the device identifier, and then send the data of the specified number of bits after the device identifier to the external device.
[0048] If the number of second service flows to be sent at the current time is too large, and the shared bandwidth cannot meet the transmission demand of all second service flows, the above-mentioned part of the second service flows can be configured in the shared bandwidth, and then the remaining second service flows can be sent after a transmission period, so as to realize the delayed transmission of part of the transmission data in the case that multiple second service flows exceed the transmission bandwidth of the USB interface, and ensure the ordered transmission of the second service flow.
[0049] Optionally, in the embodiments of the present application, the second type of devices includes instant devices and time-consuming devices, and the priority of the instant devices is higher than that of the time-consuming devices. Specifically, the instant devices refer to external devices with short communication time and no need for the USB interface to continuously transmit data, such as smart lamp devices, smart refrigerator devices, and printers, etc.; the time-consuming devices refer to external devices with long communication time and need for the USB interface to continuously transmit data, and in general, the USB interface needs to continuously transmit data as long as the host computer of the USB host is not closed, such as cameras, speakers, and microphones, etc.; the instant devices and the time-consuming devices can be pre-planned and each external device is configured with a corresponding device category.
[0050] In addition, the USB host can also classify the second type of devices according to the data transmission amount or the data transmission frequency of each second type of device in the past period of time, if the data transmission amount is greater than a preset data threshold or the data transmission frequency is greater than a preset frequency threshold, it is determined that the current second type of device is a time-consuming device; if the data transmission amount is less than or equal to the preset data threshold or the data transmission frequency is less than or equal to the preset frequency threshold, it is determined that the current second type of device is an instant device.
[0051] If the current second service flow is a service flow of a time-consuming device, if the current shared bandwidth cannot bear the transmission of the second service flow, the second service flow is configured in the shared bandwidth after the communication of the second type of device in communication is completed; if the current shared bandwidth can bear the transmission of the second service flow, the second service flow is directly configured in the shared bandwidth.
[0052] If the current second service flow is a service flow of an instant device, if the current shared bandwidth cannot bear the transmission of the second service flow, it is judged whether there is a time-consuming device in communication.
[0053] S103, the to-be-transmitted data is sent to the slave through the dedicated bandwidth and the shared bandwidth, so as to send the first service flow to the corresponding first type of device through the slave and send the second service flow to the corresponding second type of device through the slave.
[0054] The USB host sends the data to be transmitted to the USB slave through the USB interface, and the USB slave determines the correspondence between the first service flow and the first type of device according to the distribution position of the first service flow in the dedicated bandwidth or the device identifier in the first service flow, and then sends the first service flow to the corresponding external device; the USB slave determines the correspondence between the second service flow and the second type of device according to the device identifier of the second service flow in the shared bandwidth, and then sends the second service flow to the corresponding external device, thereby completing the data transmission between the USB host and the USB slave.
[0055] The technical scheme of the embodiment of the application configures the first service flow with the first type of device as the receiving object in the data to be transmitted in the corresponding dedicated bandwidth, configures the second service flow with the second type of device as the receiving object in the shared bandwidth, and finally sends the first service flow to the corresponding first type of device through the dedicated bandwidth and the shared bandwidth, and sends the second service flow to the corresponding second type of device. Therefore, not only is the real-time data transmission between the host and the plurality of external devices realized, but also the defect of defining various data packets through software protocols to control different external devices is avoided, the communication difficulty between the host and the slave is reduced, the resource consumption amount in the data transmission process is reduced, and in addition, when the service flow exceeds the bandwidth, the data of the specified type of device can still be ensured to be transmitted in order.
[0056] Embodiment two
[0057] Figure 2 A flowchart of a data transmission method provided for the second embodiment of the application, the relationship between the present embodiment and the above-mentioned embodiments is that a plurality of communication endpoints are configured through abstract classes, as shown in the following figure: Figure 2 The method comprises the following steps:
[0058] S201, configuring a first input endpoint, a second input endpoint, a first output endpoint and a second output endpoint through an abstract class; wherein the first output endpoint is used for the host to send first configuration information to the slave; the second output endpoint is used for the host to send transmission data to the slave; the first input endpoint is used for the slave to send second configuration information to the host; and the second input endpoint is used for the slave to send transmission data to the host.
[0059] The abstract class cannot be directly instantiated, but can be inherited by other classes and the abstract methods thereof are implemented; the output endpoint, namely the bluk on endpoint, is used for the USB host to send data information to the USB slave; the input endpoint, namely the bluk in endpoint, is used for the USB slave to send data information to the USB host; wherein the first output endpoint is used for the USB host to send configuration information (namely first configuration information) to the USB slave, for example, when the data flow direction is from the USB host to the USB slave, the USB host sends the bandwidth parameters of the dedicated bandwidth and the shared bandwidth to the USB slave in advance; the second output endpoint is used for the USB host to send transmission data to the USB slave, namely to send the first service flow and the second service flow in the above technical solution.
[0060] The first input endpoint is used for the USB slave to send configuration information (namely second configuration information) to the USB host, for example, when the data flow direction is from the USB slave to the USB host, the USB slave sends the bandwidth parameters of the dedicated bandwidth and the shared bandwidth to the USB host in advance; the second input endpoint is used for the USB slave to send transmission data to the USB host, namely to send the first service flow and the second service flow.
[0061] Optionally, in the embodiment of the application, after the first input endpoint, the second input endpoint, the first output endpoint and the second output endpoint are configured by the abstract class, the method further comprises: configuring the dedicated bandwidth and the shared bandwidth according to the user configuration information, and sending the configuration result as the first configuration information to the slave, or configuring the dedicated bandwidth and the shared bandwidth according to the second configuration information sent by the slave; wherein the first configuration information and the second configuration information comprise the identification and the required bandwidth of each first type device, and the identification of each second type device.
[0062] Specifically, no matter whether the data flow direction is from the USB host to the USB slave or from the USB slave to the USB host, the configuration of the dedicated bandwidth and the shared bandwidth can be completed by the service personnel, and the USB host completes the configuration of the dedicated bandwidth and the shared bandwidth after obtaining the user configuration information; the first configuration information specifically comprises the identification and the required bandwidth of each first type device, and the identification of each second type device, or the distribution position of the dedicated bandwidth of the first type device, and is further sent to the USB slave to inform the USB slave of the specific bandwidth allocation result.
[0063] Meanwhile, since the USB slave is in communication connection with each external device, the USB slave can also send second configuration information according to the specific types of each external device connected, the second configuration information specifically including the identification and required bandwidth of each first-type device, and the identification of each second-type device, or the distribution position of the dedicated bandwidth of the first-type device, and then sending the same to the USB host to inform the USB host of the specific bandwidth allocation result, so that the configuration information transmission in different directions can be realized through the first input endpoint and the first output endpoint, and the bidirectional transmission of the bandwidth parameters of the dedicated bandwidth and the shared bandwidth is ensured.
[0064] Optionally, in the embodiment of the application, after the first input endpoint, the second input endpoint, the first output endpoint and the second output endpoint are configured through the abstract class, the method further comprises: if it is determined according to the historical transmission record that the digit occupancy rate of the first dedicated bandwidth is less than a preset occupancy threshold, performing bandwidth downsizing processing on the first dedicated bandwidth; if it is determined according to the historical transmission record that the data delay frequency of the second dedicated bandwidth is greater than a preset frequency threshold, performing bandwidth upsizing processing on the second dedicated bandwidth; and sending a bandwidth update result to the slave through the second configuration information, wherein the bandwidth update result comprises a bandwidth downsizing result and / or a bandwidth upsizing result.
[0065] Specifically, the dedicated bandwidth allocated by the USB host for each first-type device can have calculation errors, or each first-type device can change the service type due to service adjustment, so that the corresponding dedicated bandwidth can also change, and the required bandwidth can increase or decrease. Therefore, if it is determined according to the historical transmission record that the digit occupancy rate of the first dedicated bandwidth is less than a preset occupancy threshold, it indicates that the first dedicated bandwidth is too large, and there are unused data digits, and accordingly, the first dedicated bandwidth is subjected to bandwidth downsizing processing.
[0066] If it is determined according to the historical transmission record that the data delay frequency of the second dedicated bandwidth is greater than a preset frequency threshold, it indicates that the second dedicated bandwidth is too small, and often cannot meet the data transmission demand, and there is a data transmission delay problem, and accordingly, the second dedicated bandwidth is subjected to upsizing processing. Accordingly, the dedicated bandwidth is updated based on the historical transmission record, which not only avoids the phenomenon of transmission resource waste caused by the dedicated bandwidth being too large, but also ensures that the dedicated bandwidth meets the real-time demand of data transmission and prevents the occurrence of data transmission delay.
[0067] S202, sending a bandwidth configuration result to the slave through the first output endpoint.
[0068] S203, in response to obtaining the to-be-transmitted data, configuring a first service flow in the to-be-transmitted data, whose receiving object is a first-type device, in a corresponding dedicated bandwidth; wherein the dedicated bandwidth and the first-type device are matched one by one.
[0069] S204, configuring the second service flow with a receiving object being a second type device in the to-be-transmitted data in the shared bandwidth; wherein the priority of the first type device is higher than that of the second type device.
[0070] S205, sending the to-be-transmitted data to the slave based on the second output endpoint through the dedicated bandwidth and the shared bandwidth, so as to send the first service flow to the corresponding first type device and the second service flow to the corresponding second type device through the slave.
[0071] The technical scheme of the embodiment of the present application, after the USB host configures the first input endpoint, the second input endpoint, the first output endpoint and the second output endpoint through the abstract class, completes the bandwidth information configuration through the first input endpoint or the first output endpoint, not only ensures the bidirectional transmission of the bandwidth parameters of the dedicated bandwidth and the shared bandwidth, but also avoids the phenomenon of waste of transmission resources caused by the overlarge dedicated bandwidth, and ensures that the dedicated bandwidth meets the real-time requirement of data transmission and prevents the phenomenon of data transmission delay.
[0072] Embodiment three
[0073] Figure 3 A flow chart of a data transmission method provided by the third embodiment of the present application, the embodiment can be configured in a USB slave (namely, a Device end), and is used for receiving different type service flows according to the dedicated bandwidth and the shared bandwidth, as shown in the following figure: Figure 3 The method comprises the following steps:
[0074] S301, acquiring the first service flow through the dedicated bandwidth, and sending the first service flow to the corresponding first type device.
[0075] S302, acquiring the second service flow through the shared bandwidth, and sending the second service flow to the corresponding second type device.
[0076] As described in the above technical scheme, the USB slave determines the corresponding relationship between the first service flow and the first type device through the distribution position of the first service flow in the dedicated bandwidth or the device identifier in the first service flow, and then sends the first service flow to the corresponding external device; at the same time, the USB slave determines the corresponding relationship between the second service flow and the second type device through the device identifier in the second service flow in the shared bandwidth, and then sends the second service flow to the corresponding external device, thereby completing the data transmission between the USB host and the USB slave.
[0077] The technical scheme of the embodiment of the present application is that the USB slave obtains the first service flow through the special bandwidth, and sends the first service flow to the corresponding first type device, and obtains the second service flow through the shared bandwidth, and sends the second service flow to the corresponding second type device. Therefore, not only the real-time data transmission between the host and the plurality of external devices is realized, but also the defect of controlling different external devices by defining various data packets through the software protocol is avoided, the communication difficulty between the host and the slave is reduced, the resource consumption amount in the data transmission process is reduced, and in addition, when the service flow bandwidth exceeds, the data of the specified type device can still be ensured to be transmitted in order.
[0078] Embodiment four
[0079] Figure 4 is a structural block diagram of a data transmission device provided by the embodiment four of the present application, and specifically comprises:
[0080] The special bandwidth configuration module 401 is configured to, in response to obtaining the to-be-transmitted data, configure the first service flow with the first type device as the receiving object in the to-be-transmitted data to the corresponding special bandwidth; wherein the special bandwidth is matched with the first type device one by one.
[0081] The shared bandwidth configuration module 402 is configured to configure the second service flow with the second type device as the receiving object in the to-be-transmitted data to the shared bandwidth; wherein the priority of the first type device is higher than that of the second type device.
[0082] The data transmission execution module 403 is configured to send the to-be-transmitted data to the slave through the special bandwidth and the shared bandwidth, so as to send the first service flow to the corresponding first type device and send the second service flow to the corresponding second type device through the slave.
[0083] The technical scheme of the embodiment of the present application is that after obtaining the to-be-transmitted data, the first service flow with the first type device as the receiving object in the to-be-transmitted data is configured to the corresponding special bandwidth, the second service flow with the second type device as the receiving object is configured to the shared bandwidth, and finally the first service flow is sent to the corresponding first type device and the second service flow is sent to the corresponding second type device through the special bandwidth and the shared bandwidth. Therefore, not only the real-time data transmission between the host and the plurality of external devices is realized, but also the defect of controlling different external devices by defining various data packets through the software protocol is avoided, the communication difficulty between the host and the slave is reduced, the resource consumption amount in the data transmission process is reduced, and in addition, when the service flow bandwidth exceeds, the data of the specified type device can still be ensured to be transmitted in order.
[0084] Optionally, the special bandwidth configuration module 401 is specifically configured to configure the first service flow and the device identifier of the first type device to the corresponding special bandwidth.
[0085] Optionally, the second type device includes a transient device and a time-consuming device, and the priority of the transient device is higher than that of the time-consuming device.
[0086] Optionally, the data transmission device is further configured to configure the first input endpoint, the second input endpoint, the first output endpoint and the second output endpoint through an abstract class; the first output endpoint is used for the master to send the first configuration information to the slave; the second output endpoint is used for the master to send the transmission data to the slave; the first input endpoint is used for the slave to send the second configuration information to the master; and the second input endpoint is used for the slave to send the transmission data to the master.
[0087] Optionally, the data transmission device is further configured to configure the special bandwidth and the shared bandwidth according to the user configuration information, and send the configuration result as the first configuration information to the slave; the first configuration information includes the identifier and the required bandwidth of each first type device, and the identifier of each second type device; or configure the special bandwidth and the shared bandwidth according to the second configuration information sent by the slave; the second configuration information includes the identifier and the required bandwidth of each first type device, and the identifier of each second type device.
[0088] Optionally, the data transmission device is further configured to perform bandwidth downsizing processing on the first special bandwidth if it is determined according to the historical transmission record that the digit occupancy rate of the first special bandwidth is less than a preset occupancy threshold; perform bandwidth upsizing processing on the second special bandwidth if it is determined according to the historical transmission record that the data delay frequency of the second special bandwidth is greater than a preset frequency threshold; and send the bandwidth update result to the slave through the second configuration information; the bandwidth update result includes the bandwidth downsizing result and / or the bandwidth upsizing result.
[0089] The above device can execute the data transmission method provided by the first or second embodiment of the application, and has the corresponding function modules and beneficial effects of the execution method. Technical details not described in detail in the present embodiment can be referred to the data transmission method provided by any embodiment of the application.
[0090] Embodiment five
[0091] Figure 5A structural diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, electronic devices, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.
[0092] As shown in Figure 5 The electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected to the at least one processor 11 in communication, where the memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded into the random access memory (RAM) 13 from the storage unit 18. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0093] A plurality of components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, speakers, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunications networks.
[0094] The processor 11 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the data transmission method.
[0095] In some embodiments, the data transmission method can be implemented as a computer program tangibly embodied in a computer readable storage medium, e.g., a memory device. In some embodiments, parts or all of the computer program can be loaded and / or installed onto the heterogeneous hardware accelerator via a ROM and / or communication unit. When the computer program is loaded into RAM and executed by the processor, one or more steps of the data transmission method described above can be performed. Alternatively, in other embodiments, the processor can be configured to perform the data transmission method by way of other means, e.g., by way of firmware.
[0096] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0097] Computer programs used to implement the present application methods can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed by the processor of the machine, implements the functions / acts specified in the flowcharts and / or block diagrams. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as part of a standalone software package, or entirely on a remote machine or electronic device.
[0098] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0099] To provide for interaction with a user, the systems and techniques described here can be implemented on a heterogeneous hardware accelerator having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the heterogeneous hardware accelerator. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0100] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a client computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), blockchain network, and the Internet.
[0101] A computing system can include a client and an electronic device. The client and the electronic device are typically in different locations, and are often interacted with over a communications network. The relationship of the client and the electronic device is created by computer programs running on the respective computers and having a client-electronic device relationship with each other. The electronic device can be a cloud electronic device, also known as a cloud computing electronic device or a cloud host, which is a host product in a cloud computing service system, and solves the defects of large management difficulty and weak business scalability in traditional physical hosts and VPS services.
[0102] It should be understood that the various forms of flow shown above can be used to reorder, add or delete steps. For example, each step described in the present application can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions of the present application can be achieved, which is not limited herein.
[0103] The above detailed description does not constitute a limitation on the scope of protection of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A data transmission method, characterized in that, Applied to the host, including: In response to acquiring data to be transmitted, the first service flow in the data to be transmitted, whose receiving object is a first type of device, is configured in the corresponding dedicated bandwidth, so that the slave device can determine the first type of device corresponding to the first service flow according to the distribution location of the first service flow; wherein, the dedicated bandwidth is matched one-to-one with the first type of device; The second service flow in the data to be transmitted, whose receiving object is a second type of device, is configured in the shared bandwidth; wherein, the first type of device has a higher priority than the second type of device; The data to be transmitted is sent to the slave device via the dedicated bandwidth and the shared bandwidth, so that the slave device can send the first service flow to the corresponding first type device and the second service flow to the corresponding second type device.
2. The method according to claim 1, characterized in that, The step of configuring the first service flow in the data to be transmitted, whose receiving object is a first type of device, to the corresponding dedicated bandwidth includes: Configure the first service flow and the device identifier of the first type of device in the corresponding dedicated bandwidth.
3. The method according to claim 1, characterized in that, The second type of device includes instantaneous devices and time-consuming devices, with the instantaneous devices having a higher priority than the time-consuming devices.
4. The method according to claim 1, characterized in that, Before acquiring the data to be transmitted, the process also includes: An abstract class is used to configure a first input endpoint, a second input endpoint, a first output endpoint, and a second output endpoint. The first output endpoint is used by the host to send first configuration information to the slave device; the second output endpoint is used by the host to send transmission data to the slave device; the first input endpoint is used by the slave device to send second configuration information to the host; and the second input endpoint is used by the slave device to send transmission data to the host.
5. The method according to claim 4, characterized in that, After configuring the first input endpoint, second input endpoint, first output endpoint, and second output endpoint through the abstract class, it also includes: Configure dedicated bandwidth and shared bandwidth according to user configuration information, and send the configuration result as first configuration information to the slave device, or configure dedicated bandwidth and shared bandwidth according to second configuration information sent by the slave device; wherein, the first configuration information and the second configuration information include the identifier and required bandwidth of each first type of device, and the identifier of each second type of device.
6. The method according to claim 4, characterized in that, After configuring the first input endpoint, second input endpoint, first output endpoint, and second output endpoint through the abstract class, it also includes: If the digit occupancy rate of the first dedicated bandwidth is determined to be less than a preset occupancy threshold based on historical transmission records, the bandwidth of the first dedicated bandwidth will be reduced. If the data delay frequency of the second dedicated bandwidth is determined to be greater than a preset frequency threshold based on historical transmission records, the bandwidth of the second dedicated bandwidth will be increased. The bandwidth update results are sent to the slave device using the second configuration information; wherein the bandwidth update results include bandwidth reduction results and / or bandwidth expansion results.
7. A data transmission device, characterized in that, Applied to the host, including: A dedicated bandwidth configuration module is used to, in response to acquiring data to be transmitted, configure the first service flow in the data to be transmitted, whose receiving object is a first type of device, to the corresponding dedicated bandwidth, so that the slave device can determine the first type of device corresponding to the first service flow according to the distribution location of the first service flow; wherein, the dedicated bandwidth is matched one-to-one with the first type of device; The shared bandwidth configuration module is used to configure the second service flow in the data to be transmitted, whose receiving object is a second type of device, to the shared bandwidth; wherein, the first type of device has a higher priority than the second type of device. The data transmission execution module is used to send the data to be transmitted to the slave device through the dedicated bandwidth and the shared bandwidth, so that the slave device can send the first service flow to the corresponding first type device and send the second service flow to the corresponding second type device.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data transmission method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that are used to cause a processor to execute the data transmission method according to any one of claims 1-6.
10. A computer program product comprising a computer program that, when executed by a processor, implements the data transmission method of any one of claims 1-6.
Citation Information
Patent Citations
Bandwidth allocation method and device, computer equipment, storage medium and program product
CN119835167A