WO2022048419A1 - 用于usb传输的方法和电子设备 - Google Patents

用于usb传输的方法和电子设备 Download PDF

Info

Publication number
WO2022048419A1
WO2022048419A1 PCT/CN2021/112163 CN2021112163W WO2022048419A1 WO 2022048419 A1 WO2022048419 A1 WO 2022048419A1 CN 2021112163 W CN2021112163 W CN 2021112163W WO 2022048419 A1 WO2022048419 A1 WO 2022048419A1
Authority
WO
WIPO (PCT)
Prior art keywords
endpoints
usb
endpoint
service
usb host
Prior art date
Application number
PCT/CN2021/112163
Other languages
English (en)
French (fr)
Inventor
徐大庆
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022048419A1 publication Critical patent/WO2022048419A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation

Definitions

  • the present application relates to the field of communications, and more particularly to methods and electronic devices for USB transmission in the field of communications.
  • USB Universal serial bus
  • the USB device can virtualize multiple virtual USB interfaces, different combinations of the multiple virtual USB interfaces correspond to different configurations, and the USB host and the USB device can transmit different services based on different configurations.
  • the USB host and the USB device can also transmit one or more services based on a configuration.
  • the USB host and the USB device need to switch different services corresponding to different configurations, the USB host also needs to switch different configurations.
  • the USB host needs to be disconnected from the USB device. Specifically, the USB host needs to clear the USB host Side-saved USB device descriptor, configuration descriptor and virtual USB interface descriptor corresponding to the configuration.
  • the USB host and the USB device are physically completely disconnected, and then the USB device needs to report the device descriptor, configuration descriptor and the virtual USB interface descriptor corresponding to the configuration descriptor to the USB host. . It takes at least three handshakes to establish a virtual USB interface corresponding to the new configuration, which will result in a long transmission delay.
  • Embodiments of the present application provide a method and device for USB transmission, which can reduce transmission delay.
  • a first aspect provides a method for USB transmission, comprising: a USB host determining to transmit a first service with a USB device; N first endpoints; the USB host passes N channels between the N first endpoints and the N second endpoints among the M second endpoints corresponding to one virtual USB interface of the USB device
  • the service data of the first service is transmitted, the physical interface of the USB device corresponds to the one virtual USB interface, the M second endpoints are the number of endpoints supported by the USB device, and the M second endpoints , the M first endpoints are in one-to-one correspondence with M channels, the N first endpoints and the N second endpoints are in one-to-one correspondence with the N channels in the M channels,
  • the M first endpoints are endpoints of the USB host, and the M second endpoints are endpoints of the USB device; wherein M and N are positive integers, and M is greater than or equal to N.
  • the USB device and the USB host can configure M channels corresponding to the M second endpoints supported by the USB device in advance before transmitting the first service.
  • N channels can be selected from the M channels to transmit the first service.
  • the USB host does not need to reload the host driver to generate N channels, thereby saving the transmission delay.
  • a virtual virtual USB interface corresponds to the total endpoints supported by the USB device.
  • a virtual virtual USB interface can correspond to M channels. In this way, when transmitting the service data of any service, it is not necessary to delete the virtual USB interface. interface or adding a virtual USB interface to switch different channels, it is only necessary to determine the channel for transmitting the service in the virtual USB interface, so that the transmission delay can be saved.
  • the M numbers corresponding to the M second endpoints supported by the USB device are in one-to-one correspondence with the M numbers corresponding to the M first endpoints of the USB host.
  • the M numbers corresponding to the M first endpoints of the USB host may be allocated by the USB host, or the USB host may determine the numbers of the M first endpoints according to the numbers of the M second endpoints. For example, the USB host may The numbers of the M second endpoints are used as the numbers of the M first endpoints.
  • the USB host determines, among the M first endpoints, N first endpoints for transmitting the first service, including: the USB host selects the M first endpoints according to the service type of the first service N first endpoints that satisfy the service type of the first service are selected from the points.
  • the method before the USB host determines to transmit the first service, the method further includes:
  • the USB host receives first endpoint information from the USB device, where the first endpoint information is used to indicate endpoint types of the M second endpoints supported by the USB device and the M second endpoints.
  • the endpoint number of the endpoint the USB host determines the endpoint number of the M first endpoints according to the first endpoint information; the USB host determines the endpoint number of the M first endpoints according to the M
  • the endpoint numbers of the second endpoints establish the M channels with the USB device.
  • the USB device can report the endpoint numbers and endpoint types of the M second endpoints supported by the USB device to the USB host in advance, and the USB host and the USB device can configure M channels in advance for the subsequent transmission of the first service. Prepare business data in advance.
  • the USB host determines, among the M first endpoints, N first endpoints for transmitting the first service, including:
  • the USB host determines, in at least one endpoint combination information, first endpoint combination information for transmitting the first service, and different endpoint combination information in the at least one endpoint combination information is used to indicate that the USB device supports the first endpoint combination information.
  • Different endpoint combinations different endpoint combinations include different numbers of endpoints and/or different types of endpoints, and the first endpoint combination information is used to indicate the first endpoint combination;
  • the USB host determines the N first endpoints among the M first endpoints according to the first endpoint combination, where the first endpoint combination is used to indicate that the number of endpoints is N and N The endpoint type of an endpoint.
  • the USB host may determine the first endpoint combination information for transmitting the first service in the at least one endpoint combination information.
  • the USB host may determine, among the M first endpoints, N first endpoints for transmitting service data of the first service according to the first endpoint combination indicated by the first endpoint combination information.
  • the at least one endpoint combination information may be reported by the USB device to the USB host, or may be preset, which is not limited in this application.
  • the USB host may determine the N first endpoints among the M first endpoints according to the first endpoint combination and endpoint numbers and endpoint types of the M second endpoints. That is, the USB host can select N second endpoints that conform to the endpoint type of the first endpoint combination from among the M second endpoints according to the type of endpoints in the first endpoint combination, and then map the selected N second endpoints to corresponding The first endpoints of are determined as N first endpoints.
  • the USB host determines the N first endpoints among the M first endpoints according to the first endpoint combination, including: the USB host sends the USB host to the USB The device sends first indication information, where the first indication information is used to indicate the first endpoint combination;
  • the USB host determines the N first endpoints according to the numbers of the N second endpoints.
  • the USB host can send first indication information indicating the first endpoint combination to the USB device, the USB device determines the endpoint numbers of the N second endpoints according to the first endpoint combination, and the USB host can combine the N endpoint numbers with the N endpoint numbers.
  • the first endpoints corresponding to the N second endpoints indicated by the endpoint numbers of the second endpoints are determined as the N first endpoints.
  • the USB host may send the first indication information to the USB device through the control endpoint.
  • the method before the USB host determines to transmit the first service, the method further includes: the USB host allocates resources to the M first endpoints. In other words, the USB host can allocate resources for M channels in advance.
  • the method further includes: the USB host is: The N first endpoints allocate resources.
  • the USB host determines N first endpoints for transmitting the first service among the M first endpoints, and then allocates resources to the N first endpoints.
  • the method further includes:
  • the USB host determines to transmit the second service
  • the USB host determines, in the at least one endpoint combination information, second endpoint combination information and third endpoint combination information for transmitting the second service, where the second endpoint combination information is used to indicate the second endpoint combination, the third endpoint combination information is used to indicate the third endpoint combination;
  • the USB host determines that the first endpoint combination is the same as the second endpoint combination, the USB host transmits part of the data of the second service through the N channels.
  • the USB host can use the N channels used to transmit the service data of the first service to transmit the second service. In this way, when switching services, the USB host and the USB device can be prevented from re-allocating resources to the N channels. and numbering, which saves overhead.
  • first endpoint combination is the same as the second endpoint combination
  • the number of endpoints indicated by the first endpoint combination and the second endpoint combination are both N and the endpoint types of the N endpoints are also the same.
  • the third endpoint combination is used to indicate that the number of endpoints is P and the endpoint types of the P endpoints, and P is less than or equal to M-N, and the method further includes:
  • the USB host determines that the first endpoint combination is different from the third endpoint combination, the USB host sends second indication information to the USB device, where the second indication information is used to indicate the third endpoint combination endpoint combination;
  • the USB host determines P channels among the M-N channels according to the endpoint numbers of the P second endpoints
  • the USB host transmits the remaining part of service data of the second service with the USB device through the P channels.
  • the USB host can send a third endpoint combination different from the first endpoint combination of the first service to the USB device through the second indication information, and the USB device can determine P in the remaining endpoints according to the third endpoint combination
  • the numbers of the second endpoints the USB host may determine, according to the numbers of the P second endpoints, P channels among the MN channels for transmitting the remaining part of the service data of the second service.
  • the USB host may send the second indication information to the USB device through the control endpoint.
  • the method further includes: the USB host sends a switching command to the USB device, where the switching command is used to indicate that the transmission is currently being performed.
  • the first service is switched to the second service.
  • the USB host can send a switching command to the USB device through the control endpoint.
  • a second aspect provides a method for universal serial bus USB transmission, comprising: a USB device determining, among M second endpoints corresponding to a virtual USB interface, N second endpoints for transmitting a first service with a USB host , the M second endpoints are the endpoint numbers supported by the USB device, and the physical USB interface of the USB device corresponds to the one virtual USB interface;
  • the USB device transmits service data of the first service through N channels between the N second endpoints and the N first endpoints in the M first endpoints of the USB host;
  • the M second endpoints and the M first endpoints are in one-to-one correspondence with the M channels, and the N first endpoints, the N second endpoints and the M channels are in one-to-one correspondence.
  • the N channels are in one-to-one correspondence, M and N are positive integers, M is greater than or equal to N, the M first endpoints are endpoints of the USB host, and the M second endpoints are the USB device endpoint.
  • the method before the USB device determines, among M second endpoints corresponding to one virtual USB interface, N second endpoints for transmitting the first service with the USB host, the method further includes:
  • the USB device sends first endpoint information to the USB host, where the first endpoint information is used to indicate the endpoint types of the M second endpoints and the M second endpoints supported by the USB device the endpoint number of ;
  • the USB device establishes the M channels with the USB host according to the first endpoint information.
  • the USB device determines, among M second endpoints corresponding to one virtual USB interface, N second endpoints that transmit the first service with the USB host, including:
  • the USB device receives first indication information sent by the USB host, where the first indication information is used to indicate a first endpoint combination, and the first endpoint combination is used to indicate that the number of endpoints is N and N endpoints the endpoint type;
  • the USB device determines the N second endpoints among the M second endpoints according to the first endpoint combination indicated by the first indication information.
  • the method further includes: the USB device sends at least one endpoint combination information to the USB host, where different endpoint combination information of the at least one endpoint combination information is used to indicate that the USB device supports
  • the different endpoint combinations include different numbers of endpoints and/or different types of endpoints, and the first endpoint combination information in the at least one endpoint combination information is used to indicate the first endpoint combination.
  • the method before the USB device determines, among M second endpoints corresponding to one virtual USB interface, N second endpoints for transmitting the first service with the USB host, the method further includes:
  • the USB device allocates resources to the M second endpoints.
  • the method further includes:
  • the USB device allocates resources for the N second endpoints.
  • the method further includes:
  • the USB device receives a switching command sent by the USB host, where the switching command is used to instruct the USB device to switch the first service being transmitted to a second service;
  • the switching command of the USB device receives part of the service data of the second service sent by the USB host through the N channels.
  • the method further includes: receiving, by the USB device, second indication information sent by the USB host, where the second indication information is used to indicate a third endpoint combination, the third endpoint combination It is used to indicate that the number of endpoints is P and the endpoint type of P endpoints, and P is less than or equal to MN;
  • the USB device determines the number of the P second endpoints among the M second endpoints according to the third endpoint combination indicated by the second indication information
  • the USB device sends the serial numbers of the P second endpoints to the USB host;
  • the USB host transmits the remaining part of the service data of the second service with the USB device through the P channels corresponding to the P second endpoints.
  • an apparatus in a third aspect, is provided, the apparatus is included in an electronic device, and the apparatus has a function of implementing the behaviors of the electronic device in the above-mentioned aspects and possible implementations of the above-mentioned aspects.
  • the functions can be implemented by hardware, or by executing corresponding software by hardware.
  • the hardware or software includes one or more modules or units corresponding to the above functions. For example, determine a module or unit, transmit a module or unit, and the like.
  • the apparatus may be the above-mentioned USB host or USB device.
  • an apparatus in a fourth aspect, includes a processor, the processor is coupled to a memory, the memory is used for storing computer programs or instructions, and the processor is used for executing the computer programs or instructions stored in the memory, so that the above aspects and the above Methods of possible implementations of various aspects are performed.
  • the processor is configured to execute computer programs or instructions stored in the memory to cause the apparatus to perform the above aspects and methods in possible implementations of the above aspects.
  • the apparatus includes one or more processors.
  • the apparatus may further include a memory coupled to the processor.
  • the device may include one or more memories.
  • the memory may be integrated with the processor, or provided separately.
  • the device may also include a transceiver.
  • the present application provides an electronic device, comprising: one or more processors; a memory; a plurality of application programs; and one or more computer programs. Wherein, one or more computer programs are stored in the memory, the one or more computer programs comprising instructions. When the instructions are executed by the electronic device, the electronic device is caused to perform the method for USB transmission in any possible implementation of any of the above aspects.
  • the electronic device may further include: a touch display screen and/or a camera, wherein the touch display screen includes a touch-sensitive surface and a display;
  • the electronic device may be the above-mentioned USB device or USB host.
  • the present application provides a computer-readable storage medium, comprising computer instructions, which, when the computer instructions are executed on an electronic device, cause the electronic device to perform any of the possible methods for USB transmission in any of the foregoing aspects.
  • the present application provides a computer program product that, when the computer program product runs on an electronic device, enables the electronic device to perform any of the possible methods for USB transmission in any of the above-mentioned aspects.
  • FIG. 1 is an application scenario diagram provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a virtual USB interface and configuration provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of another virtual USB interface and configuration provided by an embodiment of the present application.
  • FIG. 4 is a system architecture diagram provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a method for USB transmission provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of an endpoint provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of M channels provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of combination information of a virtual USB interface and at least one endpoint provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a first endpoint combination provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of a method for switching a service provided by an embodiment of the present application.
  • FIG. 11 is a schematic diagram of an endpoint for transmitting a second service provided by an embodiment of the present application.
  • FIG. 12 is a schematic diagram of a virtual USB interface and an endpoint provided by an embodiment of the present application.
  • FIG. 13 is a schematic diagram of a method for USB transmission provided by an embodiment of the present application.
  • FIG. 14 is a schematic diagram of an electronic device provided by an embodiment of the present application.
  • USB device the USB device is used to communicate with the USB host, and can use the device descriptor to describe the information of the USB device, and the device descriptor can indicate the number of configurations included in the USB device.
  • USB devices include but are not limited to: keyboards, mice, joysticks, printers, scanners, USB mobile hard drives, USB flash drives, USB optical drives, microphones, modems, mobile phones, tablets, USB communication network cards, sports watches, sports bracelets, USB readers Card holder, USB key, USB Bluetooth adapter, USB wireless network card, USB camera, etc.
  • the USB host is used to provide services for USB devices, and the USB host can provide services for one or more USB devices.
  • the USB host includes but is not limited to: a personal computer (personal computer, PC), a mobile phone in a host (host) mode, a car machine, a point of sale (POS) machine, or a television (television, TV) and the like.
  • a USB cable is a physical connection cable used to connect a USB host and a USB device. Of course, plugging the USB into the computer can also be understood as connecting via a USB cable.
  • a USB device may include one or more configurations, a configuration descriptor is used to describe the characteristics of a configuration in the USB device, and a configuration corresponds to one or more virtual USB interfaces, for example, a configuration descriptor includes a configuration descriptor length, configuration descriptor type, interface descriptor, etc.
  • the USB device and the USB host can transmit different services through different configurations.
  • the USB host and the USB device can also transmit different services through one configuration.
  • a USB device can use two different configurations to transmit low-power mode services and high-power mode services, where the low-power mode services can include one or more services, and the high-power mode services can include one or more services .
  • a virtual USB interface (interface), a physical USB interface can virtualize one or more virtual virtual USB interfaces.
  • the virtual USB interface mentioned in the embodiments of the present application refers to a virtual USB interface, and a virtual USB interface is a logical concept.
  • a virtual USB interface can be identified by a virtual USB interface descriptor, and the virtual USB interface descriptor is used to describe one or more endpoints corresponding to the virtual USB interface. The communication between the USB host and the USB device through the virtual USB interface actually communicates through the endpoint corresponding to the virtual USB interface.
  • An endpoint is an actual physical unit in a USB device, and USB data transmission is actually a transmission between an endpoint of a USB host and an endpoint of a USB device.
  • a virtual USB interface can correspond to one or more endpoints. As shown in FIG. 1 , one physical USB interface may correspond to one or more virtual USB interfaces, and one virtual USB interface may correspond to one or more endpoints. When the USB host loads the virtual USB interface host driver, the USB host can assign an endpoint number to the endpoint corresponding to each virtual USB interface on the USB host side.
  • the endpoint number of the endpoint corresponding to each virtual USB interface on the USB device side can be
  • the endpoint number of the endpoint corresponding to the USB host establishes a channel (the dotted line shown in the figure is the channel), and the endpoint number on the USB device and the USB host side is used to uniquely identify a channel, and the USB host and the USB device can transmit services through the established channel. corresponding data.
  • the transmission direction of the endpoint is fixed, and the transmission direction of the endpoint is based on the USB host.
  • the virtual USB interface of the USB device corresponds to endpoint 1 and endpoint 2, and endpoint 1 is used to send data.
  • endpoint 1 is an input (IN) endpoint
  • endpoint 2 is used to receive data
  • the endpoints can be divided into control endpoints, bulk transfer endpoints, interrupt endpoints and synchronization endpoints.
  • the control endpoint is used to transmit control commands
  • the control endpoint is a bidirectional endpoint, that is, the USB host can transmit control commands to the USB device through the control endpoint, and the USB device can also return the control command response to the USB host through the control endpoint.
  • the USB device transmits data with the USB host through the USB cable, including the USB device sending data to the USB host through the USB cable, and the USB host sending data to the USB device through the USB cable.
  • the USB device supports plug and unplug.
  • the USB device can use one physical USB interface to virtualize multiple virtual USB interfaces, and different combinations of the multiple virtual USB interfaces correspond to different configurations.
  • the USB host and the USB device can also transmit one or more services based on a configuration.
  • the USB host and the USB device need to switch different services corresponding to different configurations, the USB host needs to be disconnected from the USB device. Specifically, the USB host needs to clear the USB device descriptors, configuration descriptors and virtual virtual devices corresponding to the configurations saved on the USB host side.
  • USB interface descriptor In this process, the USB host and the USB device are physically completely disconnected, and then the USB device needs to report the device descriptor, the configuration descriptor and the virtual USB interface descriptor corresponding to the configuration descriptor to the USB host for at least three times.
  • the virtual USB interface corresponding to the new configuration can be established only after handshake, which will result in a long transmission delay.
  • USB devices also It is necessary to reallocate endpoint numbers and resources for the endpoints corresponding to these virtual USB interfaces, which will lead to waste of resources and high cost.
  • FIG. 1 only exemplarily shows M endpoints on the USB host side and M endpoints on the USB device side, and the numbers are all 1, 2...M.
  • the USB host side is connected to
  • the endpoint numbers on the USB device side may be the same or different, which are not limited in this application.
  • the configuration 1 of the USB device corresponds to the virtual USB interface A
  • the USB device needs to allocate resources and numbers to the endpoints corresponding to the virtual USB interface A corresponding to the configuration 1.
  • the USB device needs to report the descriptor of configuration 1.
  • the USB host initializes the endpoint corresponding to the virtual USB interface A according to the configuration descriptor of configuration 1, and loads the host driver of the virtual USB interface A to establish the channel corresponding to the endpoint of the virtual USB interface A.
  • the channel of the established endpoint is used to transmit service 1, wherein the USB host can allocate resources for configuration 1 during the process of initializing the endpoint corresponding to virtual USB interface A by the USB host, wherein the resources allocated by the USB host for configuration 1 include virtual USB interface A The number of the corresponding endpoint and the resources occupied by the endpoint.
  • the USB host needs to clear the resources allocated by the USB host for configuration 1 and the configuration descriptor of configuration 1, and the USB device also needs to release the resources allocated for the endpoint corresponding to the virtual USB interface A.
  • the USB device and the USB host need to switch the service 1 to the service 2 corresponding to the configuration 2.
  • the configuration 2 of the USB device corresponds to the virtual USB interface A, the virtual USB interface B, and the virtual USB interface C.
  • Report the descriptor of the USB device then report the configuration descriptor of configuration 2, and also report the interface descriptors of the three virtual USB interfaces corresponding to configuration 2.
  • the USB device also needs to allocate resources and numbers for the endpoints corresponding to the virtual USB interface A, the virtual USB interface B, and the virtual USB interface C corresponding to configuration 2.
  • the USB host initializes the virtual USB interface A according to the configuration descriptor of configuration 2 and the interface descriptor of the virtual USB interface A and loads the host driver of the virtual USB interface A to establish the channel of the endpoint corresponding to the virtual USB interface A; the USB host according to the configuration 2
  • the configuration descriptor of the virtual USB interface B and the interface descriptor of the virtual USB interface B initialize the virtual USB interface B and load the host driver of the virtual USB interface B to establish the channel of the endpoint corresponding to the virtual USB interface B;
  • the interface descriptor of the virtual USB interface C initializes the virtual USB interface C and loads the host driver of the virtual USB interface C, so as to establish a channel of the endpoint corresponding to the virtual USB interface C.
  • the USB host can generate resources corresponding to configuration 2 in the process of initializing virtual USB interface A, virtual USB interface B, and virtual USB interface C.
  • These virtual USB interfaces correspond to the endpoints
  • the resources corresponding to configuration 2 include virtual USB interface A, virtual USB interface
  • the established channel of the endpoint corresponding to the virtual USB interface A, the established channel of the endpoint corresponding to the virtual USB interface B, and the established channel of the endpoint corresponding to the virtual USB interface C are used to transmit the service 2 .
  • the USB host needs to clear the USB device descriptor on the USB host side, the configuration descriptor of configuration 1, and the resources corresponding to configuration 1.
  • the USB host needs to re-allocate resources to the USB device, specifically, it needs to allocate resources for configuration 2 of the USB device. resource, this process leads to a large transmission delay, and configuration 1 and configuration 2 include a common interface A.
  • the USB host still needs to clear the resources and the virtual USB interface A in configuration 1 on the USB host side first.
  • the interface descriptor of the virtual USB interface A for example, the resources of the virtual USB interface A includes the number and resources of the endpoints corresponding to the virtual USB interface A.
  • the USB device then reports the interface descriptor of the virtual USB interface A, and the USB host regenerates the resources of the endpoint corresponding to the virtual USB interface A.
  • the resources of the virtual USB interface A include the number and resources of the endpoint corresponding to the virtual USB interface A, which will lead to The USB host needs to continuously load the host driver of the virtual USB interface A, and the transmission delay is long and the cost is relatively high.
  • the USB device allocates resources and numbers to the endpoint corresponding to the virtual USB interface A in configuration 1. During the switching process, the USB device needs to release the resources allocated to the endpoint corresponding to the virtual USB interface A in configuration 1 and delete the virtual USB interface.
  • the number of the endpoint corresponding to the USB interface A and re-allocate resources and numbers to the endpoint corresponding to the virtual USB interface A in configuration 2. In this way, in the process of switching services, the USB device needs to continuously release resources and allocate resources, delete them. numbering and assigning numbers, which can result in higher costs.
  • the USB device and the USB host can configure the total endpoint number supported by the USB device in advance, different services correspond to different endpoint combination information, and different endpoint combination information includes different endpoint combinations
  • different endpoint combination information includes different endpoint combinations
  • data can be transmitted according to different combinations of endpoints, thereby avoiding the delay caused by the need to reconfigure the numbers of endpoints.
  • the common endpoints can be kept undisconnected, that is, these USB hosts and USB devices do not need to reallocate resources and numbers for these common endpoints. Simplifying design and reducing latency can help reduce overhead and save costs.
  • FIG. 4 is a structural block diagram of a combination of software and hardware according to an embodiment of the present application.
  • the layered architecture divides software and hardware into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through interfaces.
  • the USB host is divided into five layers, from top to bottom on the USB host side, the application layer, the host service management module, the USB host application base library, the kernel layer and the physical layer are respectively.
  • the application layer can include a series of applications.
  • the application can be Huawei mobile assistant (HiSuite), USB virtual serial port debugging tool, dial-up Internet access, and open the gateway through the browser to display the application after the USB device is connected to the USB host.
  • Huawei mobile assistant HiSuite
  • USB virtual serial port debugging tool USB virtual serial port debugging tool
  • dial-up Internet access dial-up Internet access
  • the host service management module includes a message processing module, a resource management module and a protocol encapsulation and parsing module.
  • the message processing module is used for processing control commands sent by the application layer, for example, the control commands include commands for switching services; the resource management module is used for resource scheduling; the protocol encapsulation and parsing module is used to parse and encapsulate data.
  • Some or all of the sub-modules in the host service management module may belong to the application layer or the USB application base library, or some or all of the sub-modules of the host service management sub-module may be independent of the application layer and the USB host application.
  • the basic library is not limited in the embodiments of the present application.
  • the USB host application base library provides an application programming interface (API) and a programming framework for applications at the application layer.
  • API application programming interface
  • the USB host application base library includes some predefined functions.
  • the kernel layer may include USB function drivers and USB host controller drivers.
  • the USB host controller driver is used to drive the USB host controller to identify the USB device, and drive the USB host controller to find the corresponding USB function driver for the USB device.
  • the USB function driver includes the graphics card driver corresponding to the graphics card, the camera driver corresponding to the camera, and the audio corresponding to the sound card. Drive, sensor corresponds to sensor drive and so on.
  • the USB host controller driver is also used to allocate resources for the endpoints corresponding to the virtual USB interface.
  • the USB function driver is used to drive the function of the USB device, specifically, the USB device driver is used to drive the function of the USB device and control the communication with the USB device.
  • the virtual USB interface host driver in FIG. 1 , FIG. 2 , FIG. 3 , and FIG. 7 includes a USB host controller driver and a USB function driver.
  • the physical layer can provide transmission media and interconnection channels for data communication within the USB host or between USB devices, and provide a reliable environment for data transmission.
  • the physical layer can be understood as the transport layer that provides "signal and medium”. As shown in Figure 4, the physical layer includes a USB host controller, a USB bus, and so on.
  • the USB device is divided into five layers, from top to bottom on the USB device side, the application layer, the device service management module, the USB device application base library, the kernel layer and the physical layer are respectively.
  • the application layer of the USB device can include a series of applications. Apps can include gallery, music, video, email, calendar, sticky notes, and more.
  • Device service management module including endpoint configuration module and protocol encapsulation analysis module.
  • the endpoint configuration module is used to manage the resource scheduling of the endpoint;
  • the protocol encapsulation and parsing module is used to parse and encapsulate the data.
  • modules in the device service management module may belong to the application layer or the USB device application base library, or some or all of the modules in the device service management module may be independent of the application layer and the USB device application base library , the embodiments of the present application are not limited.
  • the USB device application base library includes the API for USB devices.
  • the API provides an interaction interface with the kernel layer for applications at the application layer.
  • the API includes an interface for opening, closing, reading, writing, and controlling an application.
  • the kernel layer contains at least USB function driver, USB device controller driver and so on.
  • the USB device controller driver is used to drive the USB device controller, and drive the USB device controller to find the corresponding USB function driver for the USB device.
  • the USB device controller driver is also used to allocate resources for the endpoints corresponding to the virtual USB interface.
  • the USB function driver is used to drive the function of the USB device, specifically, the USB device driver is used to drive the USB device to communicate with the USB host.
  • the physical layer can provide a transmission medium and an interconnection channel for data communication within a USB device or with a USB host, and provide a reliable environment for data transmission.
  • the physical layer can be understood as the transport layer that provides "signal and medium”. As shown in FIG. 4 , the physical layer includes a USB device controller, a USB bus, and the like.
  • the process of transmitting signaling or data from the USB host to the USB device is as follows: the upper layer of the USB host goes to the lower layer, the lower layer of the USB host is transmitted to the lower layer of the USB device, and then the USB The lower layer of the device is passed to the upper layer of the USB device; specifically, signaling or data are sequentially driven from the USB host application layer, host service management module, USB host application base library, kernel layer, and kernel layer in Figure 4.
  • USB bus driver The physical layer sends data or signaling to the USB device; after the physical layer of the USB device receives the data or signaling from the USB host, it sequentially reports to the application layer from the kernel layer, the USB device application base library, and the device service management module.
  • the USB device transmits signaling or data to the USB host as follows: the upper layer of the USB device goes to the lower layer, the lower layer of the USB device is passed to the lower layer of the USB host, and then the lower layer of the USB host is passed to the upper layer of the USB host; Make or data send data or signaling to the USB host sequentially from the application layer, device service management module, USB device application base library, kernel layer, and USB bus driver physical layer of the USB device in Figure 4; After the physical layer receives the data or signaling from the USB device, it sequentially reports to the application layer from the kernel layer, the USB host application base library, and the host service management module. In order to avoid repetition, the following embodiments describe the transmission of data or signaling between the USB device and the USB host. Those skilled in the art should understand that the data or signaling between the USB host and the USB device is different according to the difference shown in FIG. 4 . Layers are transmitted from high to low or from low to high.
  • method 500 includes:
  • the USB device initialization includes: the USB device determines the endpoint types of the total M second endpoints and the endpoint numbers of the M second endpoints supported by the USB device.
  • the first endpoint information can be used to indicate the total supported by the USB device.
  • FIG. 1 is a schematic diagram of different types of endpoints initialized, wherein the USB host and the USB device establish a channel for controlling endpoints during the initialization process, and the endpoints filled in black in Figure 6 indicate that the endpoints are used to transmit control commands, including The output control command and the input control command, wherein the output control command means that the USB host sends a control command to the USB device, and the input control command means that the USB device sends a control command to the USB host.
  • control endpoint does not belong to the endpoint that needs to be initialized during the initialization process of the USB device, and the control endpoint may be the common control endpoint of each transmission service. Therefore, the first endpoint mentioned in the embodiment of the present application The combination of endpoints indicated by the combination information does not include the control endpoint.
  • the USB device initialization includes: the USB device determines at least one endpoint combination information, each endpoint combination information in the at least one endpoint combination information is used to indicate an endpoint combination supported by the USB device, and different endpoint combination information indicates different endpoint combinations.
  • the USB host needs one or more endpoint combinations corresponding to the endpoint combination information to transmit a service.
  • the endpoint combination indicated by each endpoint combination information is the endpoint combination among the M second endpoints supported by the USB device.
  • the endpoint combination indicated by each endpoint combination information is the endpoint among the M second endpoints.
  • the endpoint combination indicated by each endpoint combination information is a combination of at least one of the interrupt input or output function, the bulk transfer input or output function, the synchronization input or output function, and the control function. .
  • endpoint combination information 1 is used to indicate batch data.
  • Data input endpoint (BULK endpoint IN), bulk data output endpoint (BULK endpoint OUT), endpoint combination information 2 is used to indicate interrupt input endpoint and synchronization input endpoint (synchronous endpoint IN).
  • the combination of functions indicated by the endpoint combination information 1 and the endpoint combination information 2 respectively may be determined by the USB device itself.
  • the USB device initialization determines 5 endpoint combination information (the endpoint combination corresponding to 2 endpoint combination information is used to transmit service 1, and the endpoint combination corresponding to 3 endpoint combination information is used to transmit service 2).
  • the USB device may determine at least one endpoint combination information according to a service supported by the USB device. Specifically, different services supported by the USB device may require different combinations of endpoints.
  • the USB device may also determine at least one endpoint combination information according to the configuration.
  • the USB device supports configuration 2 in FIG. 3 , and configuration 2 corresponds to virtual USB interface A, virtual USB interface B, and virtual USB interface C.
  • Interface A corresponds to BULK 1_IN endpoint and BULK 2_OUT endpoint shown in Table 1
  • virtual USB interface B corresponds to BULK 2_IN endpoint, BULK 3_OUT endpoint and interrupt 9_IN endpoint shown in Table 1
  • virtual USB interface C corresponds to BULK 3_IN shown in Table 1 endpoint, interrupt 9_IN endpoint and sync 13_IN; in this way, endpoint combination information 1 includes endpoint combination BULK_IN endpoint and BULK_OUT endpoint, in other words, endpoint combination indicated by endpoint combination information 1 needs to have input and output of bulk data of virtual USB interface A
  • the combination of functions; the endpoint combination included in the endpoint combination information 2 is the BULK_IN endpoint, the BULK_OUT endpoint and the interrupt_IN end
  • endpoint combination indicated by the endpoint combination information 2 needs to have the input, output and output of the bulk data of the virtual USB interface B.
  • Combination of interrupt input function; endpoint combination information 3 includes endpoint combination: BULK_IN endpoint, interrupt_IN endpoint and sync_IN, in other words, endpoint combination indicated by endpoint combination information 3 needs to have the input of bulk data of virtual USB interface C , interrupt input and a combination of sync input functions.
  • At least one endpoint combination information is shown.
  • the above-mentioned endpoint combination information 1 is T1 in Table 2
  • the endpoint combination information 2 is T2 in Table 2
  • the endpoint combination information 3 is T3 in Table 2.
  • the endpoint configuration resource management module in the USB device is used for initialization, and specifically, the endpoint configuration resource management module is used to determine the total number of M second endpoints supported by the USB device. Endpoint numbers, M The endpoint type of the second endpoint and at least one endpoint combination information.
  • the USB host when the USB device is plugged into the USB host, the USB host discovers the USB device and queries the USB device. After the USB host queries the USB device, the USB device reports the first endpoint information to the USB host, and the first endpoint information is used for Indicates the endpoint types of the M second endpoints and the endpoint numbers of the M second endpoints, where M is greater than or equal to 2.
  • the USB device may report the first endpoint information to the USB host through a descriptor, for example, the descriptor may be a configuration descriptor, an interface descriptor, or a self-defined descriptor, which is not limited in this embodiment of the present application.
  • the descriptor may be a configuration descriptor, an interface descriptor, or a self-defined descriptor, which is not limited in this embodiment of the present application.
  • the USB host assigns endpoint numbers to the M first endpoints on the USB host side according to the first endpoint information.
  • the USB host can allocate new endpoint numbers for the M first endpoints on the USB host side, and the USB host can also reuse the numbers of the M second endpoints, and use the numbers of the M second endpoints as the M first endpoints. The number of the endpoint.
  • the USB host determines the endpoint types of the M first endpoints according to the endpoint types of the M second endpoints indicated by the first endpoint information. For example, the USB host determines the endpoints that need corresponding functions on the USB host side according to the functions corresponding to the endpoint types of the M second endpoints indicated by the first endpoint information. For example, if the USB device reports that the endpoint type of an endpoint is BULK endpoint_IN, the USB host determines that the endpoint type corresponding to the BULK endpoint_IN on the USB host side is the BULK endpoint_OUT.
  • the USB host can allocate resources to the M first endpoints on the USB host side.
  • the following discusses how the USB host allocates resources to the M first endpoints in two cases:
  • the USB host loads the USB host controller driver and the USB function driver to assign numbers and resources to the M first endpoints on the USB host side.
  • Mode 2 The USB host loads the USB host controller driver and the USB function driver to assign numbers to the M first endpoints on the USB host side, and the resource management module shown in FIG. 4 on the USB host side assigns numbers according to the numbers of the M first endpoints. Resources are allocated to the M first endpoints.
  • the endpoint configuration resource management module shown in FIG. 4 on the USB device side can also allocate resources on the USB device side to the M second endpoints.
  • the resources of the endpoint mentioned in the embodiments of the present application are the hardware resources of the endpoint, for example, the hardware resources include at least one of memory resources, Flash resources, and CPU resources.
  • the numbers of the endpoints mentioned in the embodiments of this application may also be referred to as software resources.
  • the USB host establishes M channels with the USB device according to the endpoint numbers of the M first endpoints on the USB host side and the endpoint numbers of the M second endpoints on the USB device side.
  • the USB host establishes M connections between the M first endpoints on the USB host side and the M second endpoints on the USB device side, the USB device cooperates with the USB host to establish M connections, and the M connections are also are called M channels.
  • the USB device allocates resources for the M second endpoints on the USB device side, and the USB host allocates resources for the M first endpoints on the USB host side
  • the M channels in S504 also occupy corresponding resources, that is, the endpoint numbers at both ends of each channel in S504 can be determined at this time, and the resources occupied by each channel can also be determined.
  • the USB host does not allocate resources for the M first endpoints, and the USB device does not allocate resources for the M second endpoints, only the numbers at both ends of each channel in S504 can be determined, the USB host and the USB device. Resources can be allocated in real time to channels that need to transmit services according to the transmitted service data.
  • the USB device can allocate resources for some of the M second endpoints corresponding to the M channels, and the remaining second endpoints do not allocate resources; similarly, the USB host can also allocate resources for the M first endpoints corresponding to the M channels. Some of the first endpoints in the endpoints allocate resources, and the remaining part of the first endpoints do not allocate resources, which are not limited in this embodiment of the present application.
  • the USB device can use a USB physical interface to virtualize a virtual USB interface, and the virtual USB interface corresponds to M second endpoints on the USB device side.
  • a virtual USB interface is used on the USB host side.
  • the loading of the USB host controller driver and the USB function driver corresponding to the virtual USB interface can determine the M first endpoints on the USB host side.
  • the USB host can establish M channels according to the M second endpoints on the USB device side and the M first endpoints on the USB host side, and the multiple dotted lines shown in FIG. 7 represent the M channels.
  • USB host when the USB device is plugged into the USB host, the USB host discovers the USB device and queries the USB device. After the USB host queries the USB device, the USB device reports at least one endpoint combination information generated by the initialization of S501 to the USB host.
  • the USB device may allocate resources for endpoint combinations indicated by different endpoint combination information according to the resource management module shown in FIG. 4 .
  • the resource management module shown in FIG. 4 is used to manage resource scheduling in the process of applying, activating, deactivating, suspending or destroying at least one endpoint combination indicated by the endpoint combination information.
  • the USB device may report at least one endpoint combination information to the USB host through a descriptor, for example, the descriptor may be a configuration descriptor, an interface descriptor, or a self-defined descriptor, which is not limited in this embodiment of the present application.
  • the descriptor may be a configuration descriptor, an interface descriptor, or a self-defined descriptor, which is not limited in this embodiment of the present application.
  • a virtual USB interface of a USB device can correspond to at least one endpoint combination information.
  • the USB host loads the USB controller driver and the USB After the function is driven, the USB host corresponds to at least one endpoint combination indicated by the endpoint combination information.
  • a dashed line in FIG. 8 represents a channel composed of a combination of endpoints indicated by the endpoint combination information.
  • a dashed line in FIG. 8 may correspond to a channel composed of one or more endpoints in FIG. 7 . Specifically, a channel shown in FIG.
  • the dotted line corresponds to one or more channels in Figure 7, in other words, a combination of one or more endpoints corresponding to one endpoint combination information, one or more channels corresponding to one endpoint or multiple endpoints and one endpoint combination information correspond.
  • the first dashed line from top to bottom in FIG. 8 may correspond to the first dashed line and the second dashed line from top to bottom shown in FIG. 7 .
  • USB host when the USB device is plugged into the USB host, the USB host discovers the USB device and queries the USB device. After the USB host queries the USB device, the USB device can report the first endpoint to the USB host. information and at least one endpoint combination information, the USB device can simultaneously report the first endpoint information and at least one endpoint combination information to the USB host, or can report the first endpoint information and at least one endpoint combination information in sequence.
  • the USB device and the USB host may perform S501-505 once, and perform S506-S511 multiple times.
  • S501-505 are pre-configured processes
  • S506-S511 are real-time transmission processes
  • multiple services can be transmitted based on one configuration.
  • the USB host determines to transmit service data of the first service with the USB device.
  • the application layer triggers the transmission of the first service, and the application layer sends an instruction to transmit the first service to the message processing module of the host service management module.
  • S506 includes: the USB host determines to send the service data of the first service to the USB device; or includes: the USU host determines that the USB device sends the service data of the first service to the USB host.
  • the USB host determines, in the at least one endpoint combination information received in S505, the first endpoint combination information required to transmit the service data of the first service, the first endpoint combination information is used to indicate the first endpoint combination, and the first endpoint combination information is used to indicate the first endpoint combination.
  • An endpoint combination is used to indicate that the number of endpoints is N and the endpoint type of the N endpoints. Among them, N is a positive integer less than or equal to M.
  • the USB host determines the first endpoint combination information required to transmit the first service in at least one endpoint combination information according to the service type of the first service, and the USB host determines the first endpoint combination according to the first endpoint combination information indicated by the first endpoint combination information.
  • the endpoints required to transmit the service data of the first service are determined.
  • the USB device reports four endpoint combination information of T1, T2, T3, and T4 shown in Table 2.
  • the first service is a copy service, and the service of the USB device needs to be copied to the USB host, then it can be determined that T2 and T3 are required to transmit the first service, and the USB host determines that the transmission of the first service requires BULK_IN, BULK_OUT, interrupt_IN and corresponding to T2.
  • the BULK_IN, interrupt_IN, and synchronization_IN corresponding to T3, as shown in FIG. 9 show the first endpoint combination required for transmitting the first service.
  • the USB host sends first indication information to the USB device through the control endpoint, and the USB device receives the first indication information sent by the USB host, where the first indication information is used to indicate the first endpoint combination determined in S507.
  • the USB device determines the numbers of the N second endpoints according to the first endpoint combination.
  • the USB device may assign numbers to the first endpoint combinations indicated by the first indication information in the endpoint numbers of the M second endpoints initialized in S501. For example, the USB device may assign numbers to the M second endpoints currently occupied The situation assigns a number to the first endpoint combination indicated by the first indication information.
  • the combination of the first endpoint indicated by the first indication information is BULK_IN and interrupt_IN, then the USB device assigns a number to BULK_IN in BULK_1 IN ⁇ BULK_8 IN in Table 1, and in Interrupt 9_IN ⁇ Interrupt 12_IN in Table 1 is an interrupt _IN assigns a number.
  • the endpoint configuration resource management module on the USB device side assigns an endpoint number to the first endpoint combination indicated by the first indication information.
  • the USB device needs to allocate resources for the N second endpoints indicated by the first endpoint combination.
  • the endpoint configuration resource management module of the USB device allocates endpoint resources for the N second endpoints.
  • the USB device may not allocate resources to the N second endpoints indicated by the first endpoint combination.
  • the USB device sends the serial numbers of the N second endpoints allocated for the endpoints for transmitting the first service to the USB host through the control endpoint.
  • the USB host determines N channels for transmitting the first service among the M channels according to the N second endpoint numbers in S510.
  • the USB host can determine a unique channel according to an endpoint number at one end of the channel, and the endpoint number at the other end of the channel is the endpoint number of the endpoint on the UBS host side .
  • the resource management module on the USB host side determines N channels for transmitting the first service among the M channels.
  • the USB host establishes M channels with the USB device according to the endpoint numbers of the M first endpoints on the USB host side and the endpoint numbers of the M second endpoints on the USB device side.
  • the USB host determines in S504 that there are 16 first endpoints on the USB host side corresponding to the 16 second endpoints, and the numbers are 0, 16, 17, ⁇ , 30 respectively.
  • the endpoint 0 of the USB device side and the USB host side is the control endpoint, which is also a bidirectional channel, and the other endpoints form 15 channels, which are the second endpoint of the number 1 on the USB device side and the second endpoint of the number 16 on the USB host side.
  • One endpoint constitutes channel 1; the second endpoint number 2 on the USB device side corresponds to the first endpoint number 17 on the USB host side to constitute channel 2; the second endpoint number 3 on the USB device side corresponds to number 18 on the USB host side
  • the first endpoint of the USB device side constitutes channel 3; the second endpoint of the number 4 on the USB device side corresponds to the first endpoint of the number 19 on the USB host side to constitute channel 4; the second endpoint of the number 5 on the USB device side corresponds to the USB host side.
  • the first endpoint of number 20 constitutes channel 5; the second endpoint of number 6 on the USB device side corresponds to the first endpoint of number 21 on the USB host side to constitute channel 6; the second endpoint of number 7 on the USB device side corresponds to the USB host The first endpoint of number 22 on the side constitutes channel 7; the second endpoint of number 8 on the USB device side corresponds to the first endpoint of number 23 on the USB host side to constitute channel 8, and so on. 16 channels.
  • the second endpoint of number 6 on the USB device side corresponds to the first endpoint of number 21 on the USB host side to constitute channel 6
  • the second endpoint of number 7 on the USB device side corresponds to the USB host
  • the first endpoint of number 22 on the side constitutes channel 7
  • the second endpoint of number 8 on the USB device side corresponds to the first endpoint of number 23 on the USB host side to constitute channel 8, and so on. 16 channels.
  • the USB host determines that channel 1, channel 2, channel 3, channel 4, channel 5 and channel 6 are used to transmit the first service, that is, T2 corresponds to channel 1, channel 2 and channel 3, and T3 corresponds to channel 4, channel 5 and channel 6. channel 6.
  • the USB host allocates resources for the M first endpoints on the USB host side, the USB host may not correspond to the N first endpoints for the N channels used to transmit the first service on the USB side. Allocate resources; if in S503, the USB host does not allocate resources for the M first endpoints on the USB host side, then the USB host needs to allocate resources for the N channels used to transmit the first service on the USB side corresponding to the N first endpoints For example, resources may be allocated to the N first endpoints corresponding to the N channels used for transmitting the first service on the USB side through the resource management module as shown in FIG. 4 .
  • S507-S511 may not exist, and as an alternative to S507-S511, the USB host may determine a service conforming to the first service among the M first endpoints according to the service type of the first service. For the N first endpoints required by the type, the N channels corresponding to the N first endpoints are determined as channels for transmitting the first service.
  • the USB host transmits the first service with the USB device using the N channels determined in S511.
  • both the USB device and the USB host can configure resources for M endpoints on each side corresponding to the M channels in advance; or neither the USB device nor the USB host configures resources corresponding to the M channels in advance
  • the resources of the M first endpoints and the M second endpoints configure resources for the N first endpoints and the N second endpoints corresponding to the N channels used to transmit the first service as needed .
  • the corresponding configuration resources in this embodiment of the present application are not limited.
  • the USB host may configure resources in advance for some or all of the M first endpoints on the USB host side, or the USB host may configure the M first endpoints on the USB host side with resources in advance.
  • Some or all of the first endpoints do not configure resources in advance, and configure resources during real-time transmission.
  • the USB device side configures resources for the M second endpoints on the USB device side; on the contrary, the USB device can Configure resources in advance for some or all of the M second endpoints on the USB device side, or the USB device may not configure resources in advance for some or all of the M second endpoints on the USB device side, and configure resources in real-time transmission.
  • the configuration of the resources required for the N channels used for transmitting the first service is not limited, and the configuration may be performed when the first service is transmitted or may be configured in advance.
  • the USB device can report the first endpoint information indicating the M second endpoints it supports to the USB host, and the USB device also reports at least one endpoint combination information to the USB host;
  • the USB host can The endpoint information configures M channels corresponding to the M second endpoints in advance, the USB host and the USB device can also configure the resources occupied by the M channels in advance, and the M channels can be multiple channels corresponding to one virtual USB interface.
  • the channel for transmitting the first service is determined among the M channels, which can avoid the need to configure the number of the channel for transmitting the first service in real time. And the delay caused by the resources can reduce the transmission delay.
  • the USB host may configure M channels corresponding to the M second endpoints in advance according to the first endpoint information, and the M channels may be multiple channels corresponding to one virtual USB interface.
  • N channels for transmitting the first service are determined among the M channels, and resources are configured for the N channels for transmitting the first service in real time, which can avoid the need to configure and transmit the first service in real time.
  • the delay caused by the numbering of N channels of a service can reduce the transmission delay.
  • method 1000 includes:
  • the USB host determines to switch the first service transmitted by the method 500 to the second service.
  • the application layer on the USB host side determines to switch the transmitted first service to the second service, and sends a switching command to the message processing module of the host service management module, where the switching command carries the second service.
  • logo for business the application layer on the USB host side determines to switch the transmitted first service to the second service, and sends a switching command to the message processing module of the host service management module, where the switching command carries the second service.
  • the method further includes: the USB host sends a switching command to the USB device, where the switching command is used to instruct switching from the first service currently being transmitted to the second service.
  • the switching command may include the identifier of the second service, and after receiving the switching command, the USB device may execute S1004.
  • the USB host determines a combination of endpoints required to transmit service data of the second service.
  • the USB host determines to transmit the second service endpoint combination information in at least one endpoint combination information according to the service type of the second service, and determines the service data needs to transmit the second service according to the endpoint combination indicated by the transmission second service endpoint combination information.
  • combination of endpoints For example, if the second service is a printing service, and the data of the USB device needs to be printed, T1 and T2 in Table 2 may be determined according to the printing service required for transmitting the second service.
  • the USB host determines the endpoint combination that needs to be reconfigured according to the first endpoint combination required for transmitting the service data of the first service and the endpoint combination required for transmitting the service data of the second service, for example, the USB host determines that the USB device needs to be reconfigured The endpoint combination assignment number of .
  • the USB host determines the same endpoint combination in the endpoint combination required for transmitting the service data of the first service and the endpoint combination required for transmitting the service data of the second service as the endpoint combination that does not need to be reconfigured.
  • the endpoint combination required for the service data that is different from the endpoint combination required for transmitting the first service is determined as the endpoint combination that needs to be reconfigured.
  • the second endpoint combination information and the third endpoint combination information are required to transmit the second service, and the second endpoint combination indicated by the second endpoint combination information is the same as the first endpoint combination, that is, the number of endpoints indicated by the second endpoint combination is the same as the first endpoint combination.
  • the number of endpoints indicated by one endpoint combination is the same as N, and the endpoint type indicated by the second endpoint combination is the same as the endpoint type of the first endpoint combination, then the USB host determines the second endpoint combination as an endpoint that does not need to be reconfigured combination.
  • the third endpoint combination indicated by the third endpoint combination information is different from the first endpoint combination, that is, the number of endpoints (P) indicated by the third endpoint combination information is different from the number of endpoints (N) indicated by the first endpoint combination. , or, the endpoint type indicated by the third endpoint combination information is different from the endpoint type indicated by the first endpoint combination information, and the USB host determines the third endpoint combination as the endpoint combination that needs to be reconfigured.
  • the USB host may determine in S1003 that the USB device does not need to allocate resources for the reconfigured endpoint combination, and the USB device only allocates the endpoint number. ; If the USB device does not allocate resources for the M second endpoints on the USB device side, the USB host can determine in S1003 that the USB device needs to allocate numbers and resources for the reconfigured endpoint combination.
  • the USB host and the USB device transmit different first services and second services
  • these common endpoint combinations can be maintained.
  • the channels of the combination of endpoints are not disconnected, that is, the number of these common endpoint combinations does not change and the occupied resources remain unchanged, and the USB device does not need to renumber these common endpoint combinations.
  • the USB device only needs to provide the second service and the first service Different combinations of endpoints can be assigned numbers, or numbers and resources can be assigned.
  • the USB device reports four endpoint combination information of T1, T2, T3, and T4 shown in Table 2.
  • the first service is a duplication service, and T2 and T3 are required to transmit the first service in the method 500 .
  • the second service is a printing service, which needs to print the data of the USB device, and T1 and T2 required for transmitting the second service can be determined according to the printing service. As shown in FIG. 11 , they are endpoints required for transmitting the second service. Because the first service and the second service have common endpoint combination information T2. Then, the USB device and the USB host maintain T2 unchanged, that is, compared with FIG. 9 , the BULK_IN, BULK_OUT and interrupt_IN in FIG. 9 remain unchanged in FIG. 11 .
  • the USB host determines that only the USB device needs to assign numbers to the indicated endpoints of T1, or the USB host determines that only the USB device needs to assign numbers and resources to the indicated endpoints of T1.
  • the USB device and the USB host can also release the resources occupied by the channel corresponding to the endpoint combination indicated by T3, or can also delete the number of the endpoint combination indicated by T3, and so on.
  • the USB host determines the same endpoint combination in the first endpoint combination required for transmitting the service data of the first service and the endpoint combination required for transmitting the service data of the second service as the endpoint combination that does not need to be reconfigured, and transmits the same endpoint combination.
  • the endpoint combination that is different from the endpoint combination required for transmitting the second service among the endpoint combinations required by the service data of the first service is determined as the endpoint combination to be released.
  • the USB host can release the resources of these endpoint combinations, or release the resources of these endpoint combinations and delete the numbers of these endpoint combinations. In this way, resource overhead can be saved.
  • the USB host sends second indication information to the USB device through the control endpoint, the USB device receives the second indication information sent by the USB host, and the second indication information is used to indicate the endpoint combination determined in S1003 that needs to be reassigned by the USB device, for example, the second indication information
  • the indication information indicates the aforementioned third endpoint combination.
  • the USB device allocates an endpoint number to the endpoint combination indicated by the second indication information.
  • the endpoint configuration resource management module on the USB device side allocates an endpoint number for the endpoint combination indicated by the second indication information. For example, according to Table 1, the USB device allocates the number assigned by the endpoint to the combination of endpoints indicated by the second indication information.
  • the USB device assigns numbers to BULK_IN and BULK_OUT according to Table 1, for example, assigns number 7 to BULK_IN corresponding to T1, and assigns number 8 to BULK_OUT.
  • the USB device determines an endpoint combination that is different from the endpoint combination required for transmitting the second service among the endpoint combinations required for transmitting the service data of the first service as the endpoint combination to be released.
  • the USB device can release the resources of these endpoint combinations, or release the resources of these endpoint combinations and delete the numbers of these endpoint combinations. In this way, resource overhead can be saved.
  • the USB device sends the endpoint number assigned to the endpoint for transmitting the second service to the USB host through the control endpoint, for example, the USB device assigns P numbers to the P endpoints indicated by the third endpoint combination.
  • the USB host determines a channel for transmitting the second service in the remaining channels according to the endpoint number in S1006.
  • the USB host determines P channels from the remaining MN channels according to the P endpoint numbers, where P is less than or equal to MN positive integer of .
  • the resource management module on the USB host side determines a channel for transmitting the second service among the remaining channels.
  • the USB device and the USB host have established a total of 16 channels.
  • the USB device and the USB host maintain channel 1, channel 2 and channel 3 unchanged.
  • the USB host only needs to allocate endpoints for the endpoints corresponding to T1.
  • number 7 is assigned to BULK_IN
  • number 8 is assigned to BULK_OUT.
  • the USB host determines that the channels for transmitting the second service are channel 7 and channel 8.
  • the USB host and the USB device can use the channel 1, the channel 2, the channel 3, the channel 7 and the channel 8 to transmit the service data of the second service.
  • the USB host and USB device can release the resources occupied by channel 4, channel 5 and channel 6.
  • the USB host can determine that the USB host does not need to allocate resources for the combination of endpoints to be configured; if the USB device is a USB device If no resources are allocated to the M second endpoints on the side, the USB host may determine in S1003 that the USB host also needs to allocate resources for the reconfigured combination of endpoints. Combined with the above example, the USB host needs to allocate resources to the endpoints of channel 7 and channel 8 on the USB host side.
  • the USB host transmits the second service with the USB device using the channel determined in S1007 and the channel that exists in common with the first service.
  • P channels may be determined, and there are N channels in common with the first service, and the USB host may transmit the second service with the USB device through P+N channels.
  • the USB device reports the endpoint information of the total M second endpoints supported by the USB device to the USB host.
  • the M second endpoints are endpoints corresponding to a virtual USB interface.
  • the USB device reports to the USB host that the endpoint combination indicated by at least one endpoint combination information is the endpoint function combination of the M second endpoints.
  • the embodiment of the present application is not limited.
  • L second endpoints among the M second endpoints are endpoints corresponding to a virtual USB interface, L is a positive integer less than or equal to M, and the remaining ML second endpoints are The endpoint corresponding to another virtual USB interface, L is a positive integer less than M.
  • part of the endpoint combination information in the at least one endpoint combination information reported by the USB device is the endpoint function combination of the L endpoints
  • the remaining part of the endpoint combination information is the endpoint function combination of the M-L endpoints.
  • the endpoint function combinations can be switched between the endpoint function combinations of L endpoints; or the endpoint functions can also be switched between endpoint function combinations of M-L endpoints.
  • the manner of determining the endpoint combinations for transmitting different services in the endpoint combinations corresponding to different virtual USB interfaces refer to the method 500 and the method 1000, which are not described in detail in this application in order to avoid repetition.
  • the USB device may report to the USB host that the virtual USB interface E corresponds to M-L second endpoints, and the virtual USB interface F corresponds to L endpoints.
  • the USB device may report the endpoint combination information of the M-L endpoints corresponding to the virtual USB interface E and the endpoint combination information of the L endpoints corresponding to the virtual USB interface F to the USB host.
  • the USB host and the USB device transmit service 1 through at least some of the ML endpoints.
  • the USB host needs to switch the service 1 to the service 2
  • the USB host determines, according to the requirements of the service 2, among the ML endpoints to transmit the service.
  • the common endpoint combination can be kept undisconnected, that is, the number of these endpoint combinations or the number and resources are unchanged, and the USB device is different from that of business 1.
  • the endpoint combination configures the endpoint number, or configures the endpoint number and resources, so as to realize the transmission of different services among ML endpoints.
  • the USB host and the USB device transmit service 3 through at least some of the L endpoints. When the USB host needs to switch the service 3 to the service 4, the USB host determines among the L endpoints for transmission according to the requirements of the service 4.
  • the endpoint combination of service 4 if there is a common endpoint combination between service 3 and service 4, the common endpoint combination can be kept undisconnected, that is, the number of these endpoint combinations or the number and resources are unchanged, and the USB device is different from service 3.
  • the following describes a method 1300 for USB transmission according to an embodiment of the present application with reference to FIG. 13 .
  • the endpoint configuration resource management in the device service management module of the USB device is initialized.
  • the initialization includes creating an endpoint capability set and a protocol path capability set respectively according to the capability of the USB device, and completing resource initialization.
  • the endpoint capability set corresponds to the aforementioned endpoint types of the M second endpoints and endpoint numbers of the M second endpoints.
  • the protocol channel capability set corresponds to the foregoing at least one endpoint combination information.
  • One protocol path corresponds to one endpoint combining information.
  • the USB device is connected to the USB host, the USB device is configured with a single interface by default (the aforementioned one USB virtual interface), the USB host queries the USB device capability, obtains the USB device endpoint capability set, and completes the interface initialization and configuration.
  • the USB host obtains the endpoint capability set of the USB device to complete interface initialization and configuration, which may specifically include: the USB host determines the type and number of the endpoint on the USB host side according to the endpoint capability set of the USB device, and the endpoint on the USB host side can be the aforementioned. M first endpoints.
  • the resource management module in the host service management module of the USB host queries the protocol path capability set supported by the USB device, and completes the initialization of the resources required by the protocol path set on the USB host side.
  • the resource management module in the host service management module may query the protocol channel capability set supported by the USB device, and allocate resources to the endpoint combination corresponding to the protocol channel set on the USB host side.
  • the application layer of the USB host obtains the function set supported by the USB device through the host service management module, sends a switching command to the host service management module according to the requirements of the first service or the second service, and the message processing module processes and executes the switching action, And notify the resource management module.
  • the resource management module applies for the protocol path n (Tn), and while the USB host manages resources, it also needs to notify the USB device to manage the resources synchronously, and the endpoint of the device service management module of the USB device configures the resource management module, apply for the corresponding protocol path.
  • this step can dynamically apply for, enable, disable, suspend, and destroy resources.
  • the protocol encapsulation and parsing module processes the protocol encapsulation and parsing of the communication data on the protocol path n, and also needs to be processed synchronously on the USB device side.
  • the protocol encapsulation and parsing module handles each protocol path.
  • the application program in the application program layer of the USB host can interact with the USB device through the protocol path n.
  • the application program in the application program layer can use the protocol path n and the USB host. interact.
  • the USB host and the USB device can be divided into functional modules according to the above method example.
  • each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module, such as shown in Figure 4.
  • the above-mentioned integrated modules can be implemented in the form of hardware. It should be noted that the division of the modules in FIG. 4 in this embodiment is schematic, and is only a logical function division, and other division methods may be used in actual implementation.
  • the USB host and the USB device provided in this embodiment are used to execute the above-mentioned method for USB transmission, and thus can achieve the same effect as the above-mentioned implementation method.
  • the USB host and the USB device may include a processing module, a storage module and a communication module, respectively.
  • the processing module can be used to control and manage the actions of the USB host and the USB device.
  • the storage module can be used to support the USB host and the USB device to execute stored program codes and data.
  • the communication module can be used to support the communication between the client and the server and other devices.
  • the processing module may be a processor or a controller. It may implement or execute the various exemplary logical blocks, modules and circuits described in connection with this disclosure.
  • the processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, and the like.
  • the storage module may be a memory.
  • the communication module may specifically be a device that interacts with other electronic devices, such as a radio frequency circuit, a Bluetooth chip, and a Wi-Fi chip.
  • the electronic device involved in this embodiment may be a device having the structure shown in FIG. 14 .
  • FIG. 14 is a schematic structural diagram of an example of an electronic device 1400 provided by an embodiment of the present application.
  • the electronic device 1400 may be a USB host or a USB device, and the electronic device 1400 may include a processor 1410, a memory 1420, a communication module 1430, and the like.
  • the processor 1410 may include one or more processing units, and the memory 1420 is used to store program codes and data. In this embodiment of the present application, the processor 1410 can execute the computer-executed instructions stored in the memory 1420 to control and manage the actions of the electronic device 1400 .
  • the processor 1410 may include the USB device controller shown in FIG. 4 .
  • the electronic device 1400 is a USB host, and the processor 1410 may include the USB host controller shown in FIG. 4 .
  • the communication module 1430 may be used for communication between various internal modules of the electronic device 1400, or communication between the electronic device 1400 and other external electronic devices, and the like.
  • the communication module 1430 may include a physical USB interface and a USB bus as shown in FIG.
  • the physical USB interface can be an interface that conforms to the USB standard specification, and specifically can be a Mini physical USB interface, a Micro physical USB interface, a USB Type C interface, and the like.
  • the physical USB interface can be used to connect a charger to charge the electronic device 1400, and can also be used to transfer data between the electronic device 1400 and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
  • the interface can also be used to connect other electronic devices, such as AR devices.
  • the communication module 1430 may include an audio device, a radio frequency circuit, a Bluetooth chip, a wireless fidelity (Wi-Fi) chip, a near-field communication (NFC) module, etc. way to realize the interaction between the electronic device 1400 and other electronic devices.
  • Wi-Fi wireless fidelity
  • NFC near-field communication
  • the electronic device 1400 may further include a display screen 1440, and the display screen 1440 may display images or videos, etc. in the human-computer interaction interface.
  • the electronic device 1400 may further include peripheral devices 1450, such as a mouse, a keyboard, a speaker, a microphone, and the like.
  • peripheral devices 1450 such as a mouse, a keyboard, a speaker, a microphone, and the like.
  • the structure of the electronic device 1400 is not specifically limited in this embodiment of the present application.
  • the electronic device 1400 may further include more or less components than shown, or some components are combined, or some components are separated, or different components are arranged.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • This embodiment also provides a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are executed on the electronic device, the electronic device executes the above-mentioned related method steps to realize the above-mentioned embodiments.
  • This embodiment also provides a computer program product, which when the computer program product runs on the computer, causes the computer to execute the above-mentioned relevant steps, so as to realize the method for USB transmission in the above-mentioned embodiment.
  • the embodiments of the present application also provide an apparatus, which may specifically be a chip, a component or a module, and the apparatus may include a connected processor and a memory; wherein, the memory is used for storing computer execution instructions, and when the apparatus is running, The processor can execute the computer-executed instructions stored in the memory, so that the chip executes the method for securely accessing data in the foregoing method embodiments.
  • the electronic device, computer storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding method provided above. Therefore, for the beneficial effects that can be achieved, reference can be made to the corresponding provided above. The beneficial effects in the method will not be repeated here.
  • the disclosed apparatus and method may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative.
  • the division of modules or units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or May be integrated into another device, or some features may be omitted, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • Units described as separate components may or may not be physically separated, and components shown as units may be one physical unit or multiple physical units, that is, may be located in one place, or may be distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium.
  • a readable storage medium including several instructions to make a device (which may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Information Transfer Systems (AREA)

Abstract

一种用于USB传输的方法和电子设备。该方法包括:USB设备和USB主机可以在传输第一业务之前,提前配置USB设备支持的M个第二端点对应的M个通道,当USB主机和USB设备确定传输第一业务需要N通道时,可以在该M个通道中选择N个通道传输第一业务。这样,不需要USB主机重新加载主机驱动生成N个通道,从而可以节省传输时延。一个虚拟USB接口可以对应M个通道,这样,在传输任何一个业务的业务数据时,不需要通过删除虚拟USB接口或增加虚拟USB接口来切换不同的通道,只需要在一个虚拟USB接口内确定传输业务的通道即可,从而可以节省传输时延。

Description

用于USB传输的方法和电子设备
本申请要求于2020年09月02日提交国家知识产权局、申请号为202010912316.3、申请名称为“用于USB传输的方法和电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信领域,并且更具体地涉及通信领域中的用于USB传输的方法和电子设备。
背景技术
通用串行总线(universal serial bus,USB)设备支持即插即用。USB设备可以虚拟出多个虚拟USB接口,多个虚拟USB接口的不同组合对应不同的配置,USB主机和USB设备可以基于不同的配置传输不同的业务。当然,USB主机与USB设备也可以基于一个配置传输一个或多个业务。USB主机和USB设备需要切换不同配置对应的不同的业务时,USB主机也需要切换不同的配置,在切换配置的过程中,USB主机需要与USB设备断开,具体地,USB主机需要清除USB主机侧保存的USB设备描述符、配置描述符以及配置对应的虚拟USB接口描述符。即在这个过程中相当于USB主机与USB设备在物理上先彻底断开,然后USB设备需要向USB主机上报设备描述符,配置描述符以及该配置描述符对应的虚拟USB接口描述符等,这样。需要至少三次握手才能建立新的配置对应的虚拟USB接口,这样,会导致传输时延较长。
发明内容
本申请实施例提供了一种用于USB传输的方法和装置,能够降低传输时延。
第一方面,提供了一种用于USB传输的方法,包括:USB主机确定与USB设备传输第一业务;所述USB主机在M个第一端点中确定用于传输所述第一业务的N个第一端点;所述USB主机通过所述N个第一端点与所述USB设备的一个虚拟USB接口对应的M个第二端点中的N个第二端点之间的N个通道传输所述第一业务的业务数据,所述USB设备的物理接口对应所述一个虚拟的USB接口,所述M个第二端点为所述USB设备支持的端点数目,所述M个第二端点、所述M个第一端点与M个通道一一对应,所述N个第一端点、所述N个第二端点与所述M个通道中的所述N个通道一一对应,所述M个第一端点为所述USB主机的端点,所述M个第二端点为所述USB设备的端点;其中,M、N为正整数,M大于或等于N。
在上述方案中,USB设备和USB主机可以在传输第一业务之前,提前配置USB设备支持的M个第二端点对应的M个通道,当USB主机和USB设备确定传输第一业务需要N通道时,可以在该M个通道中选择N个通道传输第一业务。这样,不需要USB主机重新加载主机驱动生成N个通道,从而可以节省传输时延。并且一个虚拟的虚拟USB接口对应USB设备支持的总的端点,换句话说,一个虚拟的虚拟USB接口 可以对应M个通道,这样,在传输任何一个业务的业务数据时,不需要通过删除虚拟USB接口或增加虚拟USB接口来切换不同的通道,只需要在该虚拟USB接口内确定传输业务的通道即可,从而可以节省传输时延。
USB设备支持的M个第二端点对应的M个编号与USB主机的M个第一端点对应的M个编号一一对应。
其中,USB主机的M个第一端点对应的M个编号可以为USB主机分配的,或者USB主机可以根据M个第二端点的编号确定M个第一端点的编号,例如,USB主机可以将M个第二端点的编号作为M个第一端点的编号。
可选地,所述USB主机在M个第一端点中确定用于传输所述第一业务的N个第一端点,包括:USB主机根据第一业务的业务类型在M个第一端点中选择满足第一业务的业务类型的N个第一端点。
在一些可能的实现方式中,在所述USB主机确定传输第一业务之前,所述方法还包括:
所述USB主机接收来自所述USB设备的第一端点信息,所述第一端点信息用于指示所述USB设备支持的所述M个第二端点的端点类型以及所述M个第二端点的端点编号:所述USB主机根据所述第一端点信息确定所述M个第一端点的端点编号;所述USB主机根据所述M个第一端点的端点编号和所述M个第二端点的端点编号与所述USB设备建立所述M个通道。
在上述方案中,USB设备可以提前将USB设备支持的M个第二端点的端点编号和端点类型上报给USB主机,USB主机和USB设备可以提前配好M个通道,为后续传输第一业务的业务数据做好前期的准备工作。
在一些可能的实现方式中,所述USB主机在M个第一端点中确定用于传输所述第一业务的N个第一端点,包括:
所述USB主机在至少一个端点组合信息中确定用于传输所述第一业务的第一端点组合信息,所述至少一个端点组合信息中的不同端点组合信息用于指示所述USB设备支持的不同的端点组合,不同的端点组合包括不同数量的端点和/或不同类型的端点,所述第一端点组合信息用于指示第一端点组合;
所述USB主机根据所述第一端点组合在所述M个第一端点中确定所述N个第一端点,所述第一端点组合用于指示端点的数量为N个以及N个端点的端点类型。
在上述方案中,USB主机可以在至少一个端点组合信息中确定用于传输第一业务的第一端点组合信息。USB主机可以根据第一端点组合信息指示的第一端点组合在M个第一端点中确定用于传输第一业务的业务数据的N个第一端点。
可选地,至少一个端点组合信息可以是USB设备上报给USB主机的,也可以是预设的,本申请不予限制。
在一些可能的实现方式中,USB主机可以根据第一端点组合以及M个第二端点的端点编号和端点类型在M个第一端点中确定N个第一端点。即USB主机可以根据第一端点组合中端点的类型在M个第二端点中选择符合第一端点组合的端点类型的N个第二端点,然后将这些选择出来的N个第二端点对应的第一端点确定为N个第一端点。
在一些可能的实现方式中,所述USB主机根据所述第一端点组合在所述M个第 一端点中确定所述N个第一端点,包括:所述USB主机向所述USB设备发送第一指示信息,所述第一指示信息用于指示所述第一端点组合;
所述USB主机接收所述USB设备根据所述第一指示信息指示的所述第一端点组合确定的所述N个第二端点的编号;
所述USB主机根据所述N个第二端点的编号确定所述N个第一端点。
在上述方案中,USB主机可以将指示第一端点组合的第一指示信息发送给USB设备,USB设备根据第一端点组合确定N个第二端点的端点编号,USB主机可以将与N个第二端点的端点编号指示的N个第二端点对应的第一端点确定为N个第一端点。
可选地,USB主机可以通过控制端点向USB设备发送第一指示信息。
在一些可能的实现方式中,在所述USB主机确定传输第一业务之前,所述方法还包括:所述USB主机为所述M个第一端点分配资源。换句话说,USB主机可以提前为M个通道分配资源。
在一些可能的实现方式中,在所述USB主机在M个第一端点中确定用于传输所述第一业务的N个第一端点之后,所述方法还包括:所述USB主机为所述N个第一端点分配资源。换句话说,USB主机在M个第一端点中确定用于传输第一业务的N个第一端点,然后为N个第一端点分配资源。
在一些可能的实现方式中,在所述USB主机确定传输第一业务之后,所述方法还包括:
所述USB主机确定传输第二业务;
所述USB主机在所述至少一个端点组合信息中确定用于传输所述第二业务的第二端点组合信息和第三端点组合信息,所述第二端点组合信息用于指示所述第二端点组合,所述第三端点组合信息用于指示第三端点组合;
若所述USB主机确定所述第一端点组合与所述第二端点组合相同,所述USB主机通过所述N个通道传输所述第二业务的部分数据。
在上述方案中,USB主机可以将用于传输第一业务的业务数据的N个通道用来传输第二业务,这样,在切换业务时,可以避免USB主机和USB设备重新为N个通道分配资源和编号,从而可以节省开销。
第一端点组合与第二端点组合相同可以理解为第一端点组合和第二端点组合指示的端点数量都为N个以及N个端点的端点类型也相同。
在一些可能的实现方式中,所述第三端点组合用于指示端点的数量为P个以及P个端点的端点类型,P小于或等于M-N,所述方法还包括:
若所述USB主机确定所述第一端点组合与所述第三端点组合不同,所述USB主机向所述USB设备发送第二指示信息,所述第二指示信息用于指示所述第三端点组合;
所述USB主机接收所述USB设备根据所述第二指示信息确定的所述P个第二端点的编号;
所述USB主机根据所述P个第二端点的端点编号在M-N个通道中确定P个通道;
所述USB主机通过所述P个通道与所述USB设备传输所述第二业务的剩余部分业务数据。
在上述方案中,USB主机可以将与第一业务的第一端点组合不同的第三端点组合 通过第二指示信息发送给USB设备,USB设备可以根据第三端点组合在剩余的端点中确定P个第二端点的编号,USB主机可以根据P个第二端点的编号在M-N个通道中确定用于传输第二业务的剩余部分业务数据的P个通道。
可选地,USB主机可以通过控制端点向USB设备发送第二指示信息。
在一些可能的实现方式中,在所述USB主机确定传输第二业务之后,所述方法还包括:所述USB主机向所述USB设备发送切换命令,所述切换命令用于指示将当前正在传输的第一业务切换为第二业务。
可选地,USB主机可以通过控制端点向USB设备发送切换命令。
第二方面,提供了一种用于通用串行总线USB传输的方法,包括:USB设备在一个虚拟USB接口对应的M个第二端点中确定与USB主机传输第一业务的N个第二端点,所述M个第二端点为所述USB设备支持的端点数目,所述USB设备的物理USB接口对应所述一个虚拟USB接口;
所述USB设备通过所述N个第二端点与所述USB主机的M个第一端点中的N个第一端点之间的N个通道传输所述第一业务的业务数据;
其中,所述M个第二端点、所述M个第一端点与M个通道一一对应,所述N个第一端点、所述N个第二端点与所述M个通道中的所述N个通道一一对应,M、N为正整数,M大于或等于N,所述M个第一端点为所述USB主机的端点,所述M个第二端点为所述USB设备的端点。
在一些可能的实现方式中,在所述USB设备在一个虚拟USB接口对应的M个第二端点中确定与USB主机传输第一业务的N个第二端点之前,所述方法还包括:
所述USB设备向所述USB主机发送第一端点信息,所述第一端点信息用于指示所述USB设备支持的所述M个第二端点的端点类型以及所述M个第二端点的端点编号;
所述USB设备根据所述第一端点信息与所述USB主机建立所述M个通道。
在一些可能的实现方式中,所述USB设备在一个虚拟USB接口对应的M个第二端点中确定与USB主机传输第一业务的N个第二端点,包括:
所述USB设备接收所述USB主机发送的第一指示信息,所述第一指示信息用于指示第一端点组合所述第一端点组合用于指示端点的数量为N个以及N个端点的端点类型;
所述USB设备根据所述第一指示信息指示的所述第一端点组合在所述M个第二端点中确定所述N个第二端点。
在一些可能的实现方式中,所述方法还包括:所述USB设备向所述USB主机发送至少一个端点组合信息,所述至少一个端点组合信息的不同端点组合信息用于指示所述USB设备支持的不同的端点组合,不同的端点组合包括不同数量的端点和/或不同类型的端点,所述至少一个端点组合信息中的第一端点组合信息用于指示所述第一端点组合。
在一些可能的实现方式中,在所述USB设备在一个虚拟USB接口对应的M个第二端点中确定与USB主机传输第一业务的N个第二端点之前,所述方法还包括:
所述USB设备为所述M个第二端点分配资源。
在一些可能的实现方式中,在所述USB设备在一个虚拟USB接口对应的M个第二端点中确定与USB主机传输第一业务的N个第二端点之后,所述方法还包括:
所述USB设备为所述N个第二端点分配资源。
在一些可能的实现方式中,所述方法还包括:
所述USB设备接收所述USB主机发送的切换命令,所述切换命令用于指示所述USB设备将正在传输的所述第一业务切换为第二业务;
所述USB设备所述切换命令接收所述USB主机通过所述N个通道发送的所述第二业务的部分业务数据。
在一些可能的实现方式中,所述方法还包括:所述USB设备接收所述USB主机发送的第二指示信息,所述第二指示信息用于指示第三端点组合,所述第三端点组合用于指示端点的数量为P个以及P个端点的端点类型,P小于或等于M-N;
所述USB设备根据所述第二指示信息指示的所述第三端点组合在所述M个第二端点中确定P个第二端点的编号;
所述USB设备向所述USB主机发送所述P个第二端点的编号;
所述USB主机通过所述P个第二端点对应的P个通道与所述USB设备传输所述第二业务的剩余部分业务数据。
第三方面,提供了一种装置,该装置包含在电子设备中,该装置具有实现上述各方面及上述各方面的可能实现方式中电子设备行为的功能。功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的模块或单元。例如,确定模块或单元、传输模块或单元等。
可选地,该装置可以是上述的USB主机或者USB设备。
第四方面,提供了一种装置,所述装置包括处理器,处理器与存储器耦合,存储器用于存储计算机程序或指令,处理器用于执行存储器存储的计算机程序或指令,使得上述各方面及上述各方面的可能实现方式中的方法被执行。
例如,处理器用于执行存储器存储的计算机程序或指令,使得该装置执行上述各方面及上述各方面的可能实现方式中方法。
可选地,该装置包括的处理器为一个或多个。
可选地,该装置中还可以包括与处理器耦合的存储器。
可选地,该装置包括的存储器可以为一个或多个。
可选地,该存储器可以与该处理器集成在一起,或者分离设置。
可选地,该装置中还可以包括收发器。
第五方面,本申请提供了一种电子设备,包括:一个或多个处理器;存储器;多个应用程序;以及一个或多个计算机程序。其中,一个或多个计算机程序被存储在存储器中,一个或多个计算机程序包括指令。当指令被电子设备执行时,使得电子设备执行上述任一方面任一项可能的实现中的用于USB传输的方法。
可选地,该电子设备还可以包括:触摸显示屏和/或摄像头,其中,触摸显示屏包括触敏表面和显示器;
可选地,该电子设备可以是上述的USB设备或者USB主机。
第六方面,本申请提供了一种计算机可读存储介质,包括计算机指令,当计算机 指令在电子设备上运行时,使得电子设备执行上述任一方面任一项可能的用于USB传输的方法。
第七方面,本申请提供了一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行上述任一方面任一项可能的用于USB传输的方法。
附图说明
图1是本申请实施例提供的应用场景图。
图2是本申请实施例提供的虚拟USB接口与配置示意图。
图3是本申请实施例提供的另一虚拟USB接口与配置示意图。
图4是本申请实施例提供的系统架构图。
图5是本申请实施例提供的用于USB传输的方法示意图。
图6是本申请实施例提供的端点的示意图。
图7是本申请实施例提供的M个通道的示意图。
图8是本申请实施例提供的虚拟USB接口与至少一个端点组合信息示意图。
图9是本申请实施例提供的第一端点组合示意图。
图10是本申请实施例提供的切换业务的方法示意图。
图11是本申请实施例提供的传输第二业务的端点示意图。
图12是本申请实施例提供的虚拟USB接口与端点的示意图。
图13是本申请实施例提供的用于USB传输的方法示意图。
图14是本申请实施例提供的电子设备的示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。
下面对本申请实施例中用到的术语进行描述。
USB设备,USB设备用于与USB主机进行通信,可以用设备描述符描述USB设备的信息,设备描述符可以指示USB设备所包括的配置的个数。USB设备包括但不限于:键盘、鼠标、游戏杆、打印机、扫描仪、USB移动硬盘、优盘、USB光驱、麦克风、调制解调器、手机、平板、USB通讯上网卡、运动手表、运动手环、USB读卡器、USB key、USB蓝牙适配器、USB无线网卡、USB摄像头等等。
USB主机,用于为USB设备提供服务,USB主机可以为一个或多个USB设备提供服务。例如,USB主机包括但不限于:个人计算机((personal computer,PC)、主机(host)模式的手机、车机、销售终端(point of sale,POS)机或者电视(television,TV)等。
USB线,USB线是用于连接USB主机与USB设备的物理连接线。当然优盘插到电脑上也可以理解为通过USB线连接。
配置,一个USB设备可以包括一个或多个配置,一个配置描述符用于描述USB设备中的一个配置的特性,一个配置对应一个或多个虚拟USB接口,例如,一个配置描述符包括配置描述符的长度、配置描述符的类型、接口描述符等等。USB设备和USB主机可以通过不同的配置传输不同的业务,当然USB主机和USB设备也可以通过一个配置传输不同的业务。如USB设备可以采用两个不同的配置传输低功耗模式业务和高功耗模式业务, 其中,低功耗模式业务可以包括一个或多个业务,高功耗模式业务可以包括一个或多个业务。
虚拟USB接口(interface),一个物理USB接口可以虚拟出一个或多个虚拟的虚拟USB接口,本申请实施例中提到的虚拟USB接口指的是虚拟USB接口,虚拟USB接口为逻辑概念。可以用一个虚拟USB接口描述符标识一个虚拟USB接口,虚拟USB接口描述符用于描述虚拟USB接口对应的一个或多个端点。USB主机和USB设备通过虚拟USB接口通信实际上是通过虚拟USB接口对应的端点进行通信。
端点(endpoint,EP),端点是USB设备中的实际的物理单元,USB数据传输实际是在USB主机的端点与USB设备的端点之间的传输。虚拟USB接口可以对应一个或多个端点。如图1所示,一个物理USB接口可以对应一个多个虚拟USB接口,一个虚拟USB接口对应一个或多个端点。USB主机在加载虚拟USB接口主机驱动时,USB主机可以为USB主机侧的每个虚拟USB接口对应的端点分配端点号,这样,可以根据USB设备侧的每个虚拟USB接口对应的端点的端点编号和USB主机对应的端点的端点编号建立通道(图中示出的虚线即为通道),利用USB设备和USB主机侧的端点号唯一标识一个通道,USB主机和USB设备可以通过建立的通道传输业务对应的数据。其中,端点的传输方向是固定的,端点的传输方向以USB主机为参考,例如USB设备的虚拟USB接口对应端点1和端点2,端点1用于发送数据,此时对于USB主机来讲是输入,因此端点1为输入(IN)端点;端点2用于接收数据,此时对于USB主机来讲是输出,因此端点2为输出(OUT)端点。
其中,端点可以分为控制端点、批量传输端点、中断端点和同步端点。其中,控制端点用于传输控制命令,控制端点为双向端点,即USB主机能够通过控制端点向USB设备传输控制命令,USB设备也能够通过控制端点向USB主机返回控制命令的响应。
如图1所示,USB设备通过USB线与USB主机传输数据,包括USB设备通过USB线向USB主机发送数据,USB主机通过USB线向USB设备发送数据。USB设备支持即插即拔,USB设备可以利用一个物理USB接口虚拟出多个虚拟USB接口,多个虚拟USB接口的不同组合对应不同的配置。当然,USB主机与USB设备也可以基于一个配置传输一个或多个业务。USB主机和USB设备需要切换不同配置对应的不同的业务时,USB主机需要与USB设备断开,具体地,USB主机需要清除USB主机侧保存的USB设备描述符、配置描述符以及配置对应的虚拟USB接口描述符。在这个过程中相当于USB主机与USB设备在物理上先彻底断开,然后USB设备需要向USB主机上报设备描述符,配置描述符以及该配置描述符对应的虚拟USB接口描述符等进行至少三次握手才能建立新的配置对应的虚拟USB接口,这样,会导致传输时延较长。此外,即使原来配置对应的虚拟USB接口中与新的配置对应的虚拟USB接口中存在共同的虚拟USB接口,则也需要先将这个共同的虚拟USB接口断开,释放这些虚拟USB接口所占的资源,清除这些虚拟USB接口的接口描述符,USB主机再加载这些虚拟USB接口的主机驱动,为这些虚拟USB接口配置资源以及为这些虚拟USB接口对应的端点分配端点编号,同样的,USB设备也需要为这些虚拟USB接口对应的端点重新分配端点编号以及资源,这样会导致浪费资源,并且成本也高。
需要说明的是,图1仅是示例性的示出了USB主机侧的M个端点和USB设备侧的M 个端点,且编号都为1,2……M,在实际应用中USB主机侧与USB设备侧的端点编号可以相同或者不同,本申请的不予限制。
举例来说,如图2所示,USB设备的配置1对应虚拟USB接口A,USB设备需要为配置1对应的虚拟USB接口A对应的端点分配资源和编号。USB设备需要上报关于配置1的描述符,USB主机根据配置1的配置描述符初始化虚拟USB接口A对应的端点,并且加载虚拟USB接口A的主机驱动,以建立虚拟USB接口A对应的端点的通道,建立的端点的通道用于传输业务1,其中,USB主机初始化虚拟USB接口A对应的端点的过程中USB主机可以为配置1分配资源,其中USB主机为配置1分配的资源包括虚拟USB接口A所对应的端点的编号以及端点的所占的资源。当USB设备和USB主机需要切换业务1时,USB主机需要清除USB主机为配置1分配的资源、配置1的配置描述符,USB设备也需要释放为虚拟USB接口A对应的端点分配的资源。USB设备和USB主机需要将业务1切换到配置2对应的业务2,如图3中USB设备的配置2对应虚拟USB接口A、虚拟USB接口B和虚拟USB接口C,USB设备需要先向USB主机上报USB设备的描述符,再上报配置2的配置描述符,还需要上报配置2对应的三个虚拟USB接口的接口描述符。并且,USB设备也需要为配置2对应的虚拟USB接口A、虚拟USB接口B和虚拟USB接口C这些虚拟USB接口所对应的端点分配的资源和编号。USB主机根据配置2的配置描述符以及虚拟USB接口A的接口描述符初始化虚拟USB接口A并且加载虚拟USB接口A的主机驱动,以建立虚拟USB接口A对应的端点的通道;USB主机根据配置2的配置描述符以及虚拟USB接口B的接口描述符初始化虚拟USB接口B并且加载虚拟USB接口B的主机驱动,以建立虚拟USB接口B对应的端点的通道;USB主机根据配置2的配置描述符以及虚拟USB接口C的接口描述符初始化虚拟USB接口C并且加载虚拟USB接口C的主机驱动,以建立虚拟USB接口C对应的端点的通道。其中,USB主机初始化虚拟USB接口A、虚拟USB接口B和虚拟USB接口C这些虚拟的USB接口对应的端点的过程中可以生成配置2对应的资源,配置2对应的资源包括虚拟USB接口A、虚拟USB接口B和虚拟USB接口C这三个接口所对应的端点的编号以及端点所占的资源。建立的虚拟USB接口A对应的端点的通道、建立的虚拟USB接口B对应的端点的通道和建立的虚拟USB接口C对应的端点的通道用于传输业务2。这个过程中,USB主机需要清除USB主机侧的USB设备描述符、配置1的配置描述符以及配置1对应的资源,USB主机需要重新为USB设备分配资源,具体地需要为USB设备的配置2分配资源,这个过程导致传输时延大,并且配置1和配置2包括一个共同的接口A,在切换过程中,USB主机仍然需要先清除USB主机侧的配置1中的关于虚拟USB接口A的资源和虚拟USB接口A的接口描述符,如虚拟USB接口A的资源包括虚拟USB接口A对应的端点的编号和资源。USB设备再上报虚拟USB接口A的接口描述符,USB主机再生成虚拟USB接口A对应的端点的资源,如虚拟USB接口A的资源包括虚拟USB接口A对应的端点的编号和资源,这样会导致USB主机需要不停的加载虚拟USB接口A的主机驱动,传输时延较长,并且成本也比较高。此外,USB设备在配置1中为虚拟USB接口A对应的端点分配了资源和编号,在切换过程中,USB设备需要释放为配置1中的虚拟USB接口A对应的端点分配的资源,并删除虚拟USB接口A对应的端点的编号,并重新为配置2中的虚拟USB接口A对应的端点分配资源和编号,这样,在切换业务的过程中,USB设备需要不停的释放资 源和分配资源,删除编号和分配编号,会导致成本较高。
鉴于上述问题,在本申请实施例中,USB设备和USB主机可以将USB设备支持的总的端点编号提前配置好,不同的业务对应不同的端点组合信息,不同的端点组合信息包括不同的端点组合,这样,在传输不同的业务时,可以根据不同的端点组合传输数据,从而可以避免需要重新配置端点的编号所带来的时延。此外,若在不同的业务切换的过程中,若存在共同的端点,可以使得共同的端点保持不断开,即这些USB主机与USB设备不需要为这些共同的端点重新分配资源和编号,这样,可以简化设计,降低时延,有助于降低开销,也能节省成本。
为了更好的描述本申请的实施例,下面结合图4介绍本申请实施例的系统架构图。图4是本申请实施例的软硬件结合的结构框图。分层架构将软件和硬件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过接口通信。
在一些实施例中,将USB主机分为五层,在USB主机侧从上至下分别为应用程序层,主机服务管理模块,USB主机应用基础库,内核层以及物理层。
如图4所示,应用程序层可以包括一系列应用程序。例如,应用程序可以为华为手机助手(HiSuite),USB虚拟串口调试工具,拨号上网,USB设备连接USB主机之后通过浏览器打开网关显示应用等。
主机服务管理模块,包括消息处理模块,资源管理模块和协议封装与解析模块。其中,消息处理模块用于处理应用程序层发送的控制命令,例如,控制命令包括切换业务的命令;资源管理模块用于进行资源调度;协议封装与解析模块用于对数据进行解析和封装。
其中,主机服务管理模块中的部分或者全部子模块可以属于应用程序层也可以属于USB应用基础库,或者主机服务管理子模块可中的部分或者全部子模块可以独立于应用程序层和USB主机应用基础库,本申请实施例不予限制。
USB主机应用基础库为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。USB主机应用基础库包括一些预先定义的函数。
内核层可以包括USB功能驱动和USB主机控制器驱动等。USB主机控制器驱动用于驱动USB主机控制器识别USB设备,并驱动USB主机控制器为USB设备找到对应的USB功能驱动,例如USB功能驱动包括显卡对应显卡驱动、摄像头对应摄像头驱动、声卡对应音频驱动、传感器对应传感器驱动等等。此外,USB主机控制器驱动还用于为虚拟USB接口对应的端点分配资源。USB功能驱动用于驱动USB设备的功能,具体地,USB设备驱动用于驱动USB设备的功能并控制与USB设备的通信。其中,图1、图2、图3、图7中的虚拟USB接口主机驱动包括USB主机控制器驱动和USB功能驱动。
物理层,物理层可以为USB主机内部、或者与USB设备之间的数据通信提供传输媒体及互连通道,为数据传输提供可靠的环境。物理层可以理解为提供"信号和介质"的传输层。如图4所示,物理层包括USB主机控制器以及USB总线等等。
在一些实施例中,将USB设备分为五层,在USB设备侧从上至下分别为应用程序层,设备服务管理模块,USB设备应用基础库,内核层以及物理层。
如图4所示,USB设备的应用程序层可以包括一系列应用程序。应用程序可以包括图库、音乐、视频、电子邮件、日历、便签等。
设备服务管理模块,包括端点配置模块和协议封装解析模块。其中,端点配置模块用 于管理端点的资源调度;协议封装与解析模块用于对数据进行解析和封装。
其中,设备服务管理模块中的部分或者全部模块可以属于应用程序层也可以属于USB设备应用基础库,或者设备服务管理模块可中的部分或者全部模块可以独立于应用程序层和USB设备应用基础库,本申请实施例不予限制。
USB设备应用基础库包括USB设备的API。API为应用层的应用提供与内核层的交互接口。例如,API包括打开(open)、关闭(close)、读(read)、写(write)、控制(control)某个应用的接口等。
内核层至少包含USB功能驱动,USB设备控制器驱动等。USB设备控制器驱动用于驱动USB设备控制器,并驱动USB设备控制器为USB设备找到对应的USB功能驱动。此外USB设备控制器驱动还用于为虚拟USB接口对应的端点分配资源。USB功能驱动用于驱动USB设备的功能,具体地,USB设备驱动用于驱动USB设备与USB主机进行通信。
物理层,物理层可以为USB设备内部、或者与USB主机之间的数据通信提供传输媒体及互连通道,为数据传输提供可靠的环境。物理层可以理解为提供"信号和介质"的传输层。如图4所示,物理层包括USB设备控制器以及USB总线等等。
需要说明的是,在图4所示的架构下,USB主机向USB设备传输信令或者数据的传输过程为:USB主机的高层到低层,USB主机的低层传给USB设备的低层,再由USB设备的低层传递到USB设备的高层;具体地,信令或者数据依次从图4中的USB主机的应用程序层、主机服务管理模块、USB主机应用基础库、内核层、内核层的USB总线驱动物理层向USB设备发送数据或者信令;USB设备的物理层接收到来自USB主机的数据或者信令之后,依次从内核层、USB设备应用基础库、设备服务管理模块上报到应用程序层。USB设备向USB主机传输信令或者数据的传输过程为:USB设备的高层到低层,USB设备的低层传给USB主机的低层,再由USB主机的低层传递到USB主机的高层;具体地,信令或者数据依次从图4中的USB设备的应用程序层、设备服务管理模块、USB设备应用基础库、内核层、内核层的USB总线驱动物理层向USB主机发送数据或者信令;USB主机的物理层接收到来自USB设备的数据或者信令之后,依次从内核层、USB主机应用基础库、主机服务管理模块上报到应用程序层。下面的实施例为了避免赘述,描述的是USB设备与USB主机之间传输数据或者信令,本领域人员应该理解,USB主机与USB设备之间的数据或者信令是根据图4所示的不同层从高到低或者从低到高传输的。
下面结合图5描述本申请实施例提供的用于USB传输的方法。如图5所示,方法500包括:
S501,USB设备初始化。
可选地,USB设备初始化包括:USB设备确定自身支持的总的M个第二端点的端点类型以及M个第二端点的端点编号,例如,可以利用第一端点信息指示USB设备支持的总的M个第二端点的端点类型以及M个第二端点的端点编号。
例如,如表1所示的示出了USB设备支持15个IN端点的端点类型和15个OUT端点的端点类型以及这些端点的端点编号,表1中M为30(15个IN端点和15个OUT端点)。如图6所示为初始化的不同类型的端点的示意图,其中,USB主机和USB设备在初始化过程中建立控制端点的通道,图6中的黑色填充的端点表示该端点用于传输控制指令, 包括输出控制指令和输入控制指令,其中,输出控制指令表示USB主机向USB设备发送控制指令,输入控制指令表示USB设备向USB主机发送控制指令。
需要说明的是,本申请实施例中控制端点不属于USB设备初始化过程中需要初始化的端点,控制端点可以是每次传输的业务公共的控制端点,因此本申请实施例提到的第一端点组合信息指示的端点组合不包括控制端点。
表1
Figure PCTCN2021112163-appb-000001
可选地,USB设备初始化,包括:USB设备确定至少一个端点组合信息,至少一个端点组合信息中的每个端点组合信息用于指示USB设备支持的端点组合,不同端点组合信息指示不同的端点组合,其中,USB主机传输一种业务需要一个或多个端点组合信息对应的端点组合。其中,每个端点组合信息指示的端点组合为USB设备支持的M个第二端点中的端点组合,换种方式理解为,每个端点组合信息指示的端点组合为M个第二端点中的端点的功能组合,可以不包括端点的编号组合,如每个端点组合信息指示的端点组合为中断输入或输出功能、批量传输输入或输出功能、同步输入或输出功能和控制功能中至少一个功能的组合。
例如,USB设备根据自身支持的第一业务需要批量数据的输入输出功能、中断输入功能、同步输入功能组合,则USB可以上报端点组合信息1和端点组合信息2;端点组合信息1用于指示批量数据输入端点(BULK端点IN)、批量数据输出端点(BULK端点OUT),端点组合信息2用于指示中断输入端点和同步输入端点(同步端点IN)。端点组合信息1和端点组合信息2分别指示的是哪些功能的组合,可以是USB设备自身确定的。
举例来说,USB设备初始化确定5个端点组合信息(2个端点组合信息对应的端点组合用于传输业务1,3个端点组合信息对应的端点组合用于传输业务2)。
可选地,USB设备可以根据USB设备支持的业务确定至少一个端点组合信息。具体 地,USB设备支持的不同的业务可能需要不同的端点组合。
可选地,USB设备也可以根据配置确定至少一个端点组合信息,举例来说,USB设备支持图3的配置2,配置2对应虚拟USB接口A、虚拟USB接口B和虚拟USB接口C,虚拟USB接口A对应表1所示的BULK 1_IN端点和BULK 2_OUT端点,虚拟USB接口B对应表1所示的BULK 2_IN端点、BULK 3_OUT端点和中断9_IN端点,虚拟USB接口C对应表1所示的BULK 3_IN端点、中断9_IN端点和同步13_IN;这样,端点组合信息1包括的端点组合为BULK_IN端点和BULK_OUT端点,换句话说,端点组合信息1指示的端点组合需要具备虚拟USB接口A的批量数据的输入输出功能的组合;端点组合信息2包括的端点组合为BULK_IN端点、BULK_OUT端点和中断_IN端点,换句话说,端点组合信息2指示的端点组合需要具备虚拟USB接口B的批量数据的输入、输出以及中断输入功能的组合;端点组合信息3包括端点组合为:BULK_IN端点、中断_IN端点和同步_IN,换句话说,端点组合信息3指示的端点组合需要具备虚拟USB接口C的批量数据的输入、中断输入以及同步输入功能的组合。
示例性的,如表2所示,示出了至少一个端点组合信息。上述的端点组合信息1为表2的T1,端点组合信息2为表2的T2,端点组合信息3为表2的T3。
表2
Figure PCTCN2021112163-appb-000002
示例性地,如图4所示,USB设备中的端点配置资源管理模块用于初始化,具体地,端点配置资源管理模块用于确定USB设备支持的总的M个第二端点的端点编号、M个第二端点的端点类型以及至少一个端点组合信息。
S502,USB设备插到USB主机上时,USB主机发现USB设备并对USB设备进行查询,USB主机查询到USB设备之后,USB设备向USB主机上报第一端点信息,第一端点信息用于指示M个第二端点的端点类型以及M个第二端点的端点编号,M大于或等于2。
可选地,USB设备可以通过描述符向USB主机上报第一端点信息,例如描述符可以是配置描述符或者接口描述符或者是自定义的描述符,本申请实施例不予限定。
S503,USB主机根据第一端点信息为USB主机侧的M个第一端点分配端点编号。
可选地,USB主机可以为USB主机侧M个第一端点分配新的端点编号,USB主机也可以复用M个第二端点的编号,将M个第二端点的编号作为M个第一端点的编号。
可选地,USB主机根据第一端点信息指示的M个第二端点的端点类型确定M个第一端点的端点类型。例如,USB主机根据第一端点信息指示的M个第二端点的端点类型对应的功能确定在USB主机侧需要相应功能的端点,举例来说,如果USB设备上报了一个端点的端点类型是BULK端点_IN,则USB主机确定USB主机侧该BULK端点_IN对应的端点类型是BULK端点_OUT。
可选地,USB主机可以为USB主机侧的M个第一端点分配资源,下面分两种情况讨论USB主机给M个第一端点分配资源的方式:
方式一,USB主机加载USB主机控制器驱动和USB功能驱动为USB主机侧的M个第一端点分配编号和资源。
方式二,USB主机加载USB主机控制器驱动和USB功能驱动为USB主机侧的M个第一端点分配编号,USB主机侧的图4所示的资源管理模块根据M个第一端点的编号为M个第一端点分配资源。
相应的,USB设备侧的如图4所示的端点配置资源管理模块也可以为M个第二端点分配USB设备侧的资源。
需要说明的是,本申请实施例中提到的端点的资源为端点的硬件资源,例如硬件资源包括内存资源、Flash资源和CPU资源中的至少一个。本申请实施例提到的端点的编号也可以称为软件资源。
S504,USB主机根据USB主机侧的M个第一端点的端点编号,以及,USB设备侧的M个第二端点的端点编号与USB设备建立M个通道。
具体地,S504中,USB主机建立USB主机侧的M个第一端点与USB设备侧的M个第二端点之间的M个连接,USB设备配合USB主机建立M个连接,M个连接也称为M个通道。
可选的,若USB设备为USB设备侧的M个第二端点分配了资源,USB主机为USB主机侧的M个第一端点分配了资源,则此时S504中的M个通道也占用相应的资源,即此时可以确定S504中的每个通道两端的端点编号也可以确定每个通道所占的资源。
可选的,若USB主机没有为M个第一端点分配资源,且USB设备也没有为M个第二端点分配资源,则只能确定S504中每个通道两端的编号,USB主机和USB设备可以根据传输的业务数据实时的为需要传输业务的通道分配资源。
当然,USB设备可以为M个通道对应的M个第二端点中的部分第二端点分配资源,剩余第二端点不分配资源;同样的,USB主机也可以为M个通道对应的M个第一端点中的部分第一端点分配资源,剩余部分第一端点不分配资源,本申请实施例不予限制。
示例性的,如图7所示,USB设备可以利用一个USB物理接口虚拟出一个虚拟USB接口,该一个虚拟USB接口对应USB设备侧的M个第二端点,同样地,在USB主机侧,一个虚拟USB接口对应的加载USB主机控制器驱动和USB功能驱动可以确定USB主机侧的M个第一端点。这样,USB主机可以根据USB设备侧的M个第二端点和USB主机侧的M个第一端点建立M个通道,图7所示的多个虚线表示M个通道。
S505,USB设备插到USB主机上时,USB主机发现USB设备并对USB设备进行查询,USB主机查询到USB设备之后,USB设备向USB主机上报S501的初始化生成的至少一个端点组合信息。
可选地,在S505中,USB设备根据图4所示的资源管理模块可以为不同的端点组合信息指示的端点组合分配资源。可选地,图4所示的资源管理模块用于管理申请、启用、停用、挂起或者销毁等至少一个端点组合信息指示的端点组合过程中的资源调度。
可选地,USB设备可以通过描述符向USB主机上报至少一个端点组合信息,例如描述符可以是配置描述符或者接口描述符或者是自定义的描述符,本申请实施例不予限定。
为了更好的理解至少一个端点组合信息,下面结合图8理解,如图8所示,USB设备的一个虚拟USB接口可以对应至少一个端点组合信息,相应的,USB主机加载USB控制器驱动和USB功能驱动之后USB主机对应至少一个端点组合信息指示的端点组合。图8中的一个虚线表示一个端点组合信息指示的端点组合所组成的通道,图8中的一个虚线可以对应图7中的一个或多个端点组成的通道,具体地,图8所示的一条虚线对应图7中的一条或一条以上的通道,换句话说,一个端点组合信息对应的一个或多个端点的组合,该一个端点或多个端点对应的一个或多个通道与一个端点组合信息对应。例如,图8中的从上到下的第一条虚线可以对应图7所示的从上到下的第一条虚线和第二条虚线。
需要说明的是,S502和S505中,USB设备插到USB主机上时,USB主机发现USB设备并对USB设备进行查询,USB主机查询到USB设备之后,USB设备可以向USB主机上报第一端点信息和至少一个端点组合信息,USB设备向USB主机可以同时上报第一端点信息和至少一个端点组合信息,也可以按照先后顺序上报第一端点信息和至少一个端点组合信息。
在方法500中,USB设备与USB主机可以执行一次S501-505,执行多次S506-S511。换句话说,S501-505是预先配置的过程,S506-S511是实时传输的过程,可以基于一次配置传输多次业务。
S506,USB主机确定与USB设备传输第一业务的业务数据。
示例性的,如图4所示的应用程序层触发传输第一业务,应用程序层向主机服务管理模块的消息处理模块发送传输第一业务的指令。
可选地,S506,包括:USB主机确定向USB设备发送第一业务的业务数据;或者包括:USU主机确定USB设备向USB主机发送第一业务的业务数据。
S507,USB主机在S505中接收到的至少一个端点组合信息中,确定传输第一业务的业务数据需要的第一端点组合信息,第一端点组合信息用于指示第一端点组合,第一端点组合用于指示端点的数量为N个以及N个端点的端点类型。其中,N为小于或等于M的正整数。
具体地,USB主机根据第一业务的业务类型在至少一个端点组合信息中确定传输第一业务所需要第一端点组合信息,USB主机根据第一端点组合信息所指示的第一端点组合确定传输第一业务的业务数据需要的端点。例如,USB设备上报了表2所示的T1、T2、T3、T4共四个端点组合信息。第一业务为复制业务,需要将USB设备的业务复制到USB主机,则可以确定传输第一业务需要T2和T3,则USB主机确定传输第一业务需要T2对应的BULK_IN、BULK_OUT、中断_IN以及T3对应的BULK_IN、中断_IN、同步_IN,如图9所示,示出了传输第一业务需要的第一端点组合。
S508,USB主机通过控制端点向USB设备发送第一指示信息,USB设备接收USB主机发送的第一指示信息,第一指示信息用于指示S507中确定的第一端点组合。
S509,USB设备根据第一端点组合确定N个第二端点的编号。
具体地,USB设备可以在S501中初始化的M个第二端点的端点编号中为第一指示信息指示的第一端点组合分配编号,例如,USB设备可以根据当前M个第二端点被占用的情况给第一指示信息指示的第一端点组合分配编号。例如,第一指示信息指示的第一端点组合为BULK_IN和中断_IN,则USB设备在表1的BULK_1 IN~BULK_8 IN为BULK_IN 分配一个编号,在表1的中断9_IN~中断12_IN中为中断_IN分配一个编号。
示例性的,如图4所示,USB设备侧的端点配置资源管理模块为第一指示信息指示的第一端点组合分配端点编号。
可选地,若USB设备没有为M个第二端点分配资源,USB设备需要为第一端点组合指示的N个第二端点分配资源。示例性地,如图4所示,USB设备的端点配置资源管理模块为N个第二端点分配端点资源。
可选地,若USB设备为M个第二端点分配资源,USB设备可以不为第一端点组合指示的N个第二端点分配资源。
S510,USB设备通过控制端点将为传输第一业务的端点分配的N个第二端点的编号发送给USB主机。
S511,USB主机根据S510中的N个第二端点编号在M个通道中确定用于传输第一业务的N个通道。
换句话说,S503中的每个通道的两端的端点编号固定,USB主机可以根据通道一端的一个端点编号确定唯一的通道,该通道的另一端的端点编号即为UBS主机侧的端点的端点编号。
示例性地,如图4所示,USB主机侧的资源管理模块在M个通道中确定用于传输第一业务的N个通道。
具体地,在S504中,USB主机根据USB主机侧的M个第一端点的端点编号,以及,USB设备侧的M个第二端点的端点编号与USB设备建立了M个通道。USB主机在S504中建立的M个通道确定用于传输第一业务的N个通道。例如,M=15,在USB设备侧16个第二端点的编号分别为0,1,2,3···,15。USB主机在S504中确定与这16个第二端点对应的USB主机侧的第一端点为16个,编号分别为0,16,17,···,30。其中,USB设备侧和USB主机侧的端点0为控制端点,也为双向通道,其余的端点组成15个通道,分别为USB设备侧的编号1的第二端点对应USB主机侧的编号16的第一端点组成通道1;USB设备侧的编号2的第二端点对应USB主机侧的编号17的第一端点组成通道2;USB设备侧的编号3的第二端点对应USB主机侧的编号18的第一端点组成通道3;USB设备侧的编号4的第二端点对应USB主机侧的编号19的第一端点组成通道4;USB设备侧的编号5的第二端点对应USB主机侧的编号20的第一端点组成通道5;USB设备侧的编号6的第二端点对应USB主机侧的编号21的第一端点组成通道6;USB设备侧的编号7的第二端点对应USB主机侧的编号22的第一端点组成通道7;USB设备侧的编号8的第二端点对应USB主机侧的编号23的第一端点组成通道8,依次类推,加上控制端点组成的通道共16个通道。结合图9的例子,若USB设备根据上述端点的编号为传输第一业务分配的T2对应的BULK_IN的编号分别为1,BULK_OUT的编号为2,中断端点的编号为3;为传输第一业务分配的T3对应的BULK_IN的编号为4,中断端点的编号为5,同步端点的编号为6。则USB主机确定通道1、通道2、通道3、通道4、通道5和通道6用于传输第一业务,即此时T2对应通道1、通道2和通道3,T3对应通道4、通道5和通道6。
可选地,若S503中,USB主机为USB主机侧的M个第一端点分配了资源,则USB主机可以不为USB侧用于传输第一业务的N个通道对应N个第一端点分配资源;若S503中,USB主机没有为USB主机侧的M个第一端点分配资源,则USB主机需要为USB侧 用于传输第一业务的N个通道对应N个第一端点分配资源,例如,可以通过如图4所述资源管理模块为USB侧的用于传输第一业务的N个通道对应的N个第一端点分配资源。
可选地,在方法500中,可以不存在S507-S511,作为S507-S511可替换的方式,USB主机可以根据第一业务的业务类型在M个第一端点中确定符合第一业务的业务类型需求的N个第一端点,将这N个第一端点对应的N个通道确定为用于传输第一业务的通道。
S512,USB主机利用S511确定的N个通道与USB设备传输第一业务。
需要说明的是,在方法500中,描述的是USB设备与USB主机都可以提前为M个通道对应的每侧的M端点配置资源;或者USB设备与USB主机都不提前配置M个通道对应的M个第一端点和M个第二端点的资源,在实时传输过程中,根据需要为用于传输第一业务的N个通道对应的N个第一端点和N个第二端点配置资源。在实际应用过程中,本申请实施例对应配置资源不予限定,USB主机可以给USB主机侧的M个第一端点中部分或全部端点提前配置资源,或者USB主机可以给USB主机侧的M个第一端点中的部分或者全部端点不提前配置资源,实时传输时再配置资源,对USB设备侧是否给USB设备侧的M个第二端点配置资源不予限定;相反地,USB设备可以给USB设备侧的M个第二端点中部分或全部端点提前配置资源,或者USB设备可以给USB设备侧的M个第二端点中的部分或者全部端点不提前配置资源,实时传输时再配置资源,对USB主机侧是否给USB主机侧的M个第一端点配置资源不予限定。换句话说,本申请实施例中,对用于传输第一业务的N个通道所需的资源的配置不予限制,可以在传输第一业务时配置也可以提前配置。
在上述方案中,USB设备可以将指示自身支持的M个第二端点的第一端点信息上报给USB主机,同时USB设备也将至少一个端点组合信息上报给USB主机;USB主机可以根据第一端点信息提前配置与M个第二端点对应的M个通道,USB主机和USB设备也可以将该M个通道所占的资源提前配置好,该M个通道可以是一个虚拟USB接口对应的多个通道,这样,在传输第一业务时,根据该业务所需的端点组合信息,在M个通道中确定用于传输第一业务的通道,可以避免需要实时配置传输第一业务的通道的编号以及资源所带来的时延,能够降低传输时延。或者,USB主机可以根据第一端点信息提前配置与M个第二端点对应的M个通道,该M个通道可以是一个虚拟USB接口对应的多个通道,这样,在传输第一业务时,根据该业务所需的第一端点组合信息,在M个通道中确定用于传输第一业务的N个通道,实时为传输第一业务的N个通道配置资源,可以避免需要实时配置传输第一业务的N个通道的编号所带来的时延,能够降低传输时延。
此外,USB主机与USB设备在切换不同的业务时,若不同的业务包括相同的端点组合信息,或者,若不同的业务对应不同的端点组合信息,但是不同的端点组合信息指示的端点存在交集,则可以保持该相同的端点组合信息对应的端点或者不同的端点组合信息存在交集的端点维持不断开,可以提高传输效率,并且也不需要重新配置该相同的端点的编号等,下面结合上述方法500以及图10描述切换业务的场景。如图10所示,方法1000,包括:
S1001,USB主机确定将方法500传输的第一业务切换为第二业务。
示例性的,如图4所示,USB主机侧的应用程序层确定将传输的第一业务切换为第二业务,并向主机服务管理模块的消息处理模块发送切换命令,该切换命令携带第二业务的 标识。
可选地,在S1001之后,所述方法还包括:USB主机向USB设备发送切换命令,切换命令用于指示将当前正在传输的第一业务切换为第二业务。切换命令可以包括第二业务的标识,USB设备接收到切换命令之后,可以执行S1004。
S1002,USB主机确定传输第二业务的业务数据需要的端点组合。
具体地,USB主机根据第二业务的业务类型在至少一个端点组合信息中确定传输第二业务端点组合信息,根据传输第二业务端点组合信息所指示的端点组合确定传输第二业务的业务数据需要的端点组合。例如,第二业务为打印业务,需要打印USB设备的数据,则可以根据该打印业务确定传输第二业务需要表2的T1和T2。
S1003,USB主机根据传输第一业务的业务数据需要的第一端点组合与传输第二业务的业务数据需要的端点组合,确定需要重新配置的端点组合,例如USB主机确定USB设备需要给重新配置的端点组合分配编号。
具体地,USB主机将传输第一业务的业务数据需要的端点组合与传输第二业务的业务数据需要的端点组合中相同的端点组合确定为不需要重新配置的端点组合,将传输第二业务的业务数据需要的端点组合与传输第一业务需要的端点组合不同的确定为需要重新配置的端点组合。例如,传输第二业务需要第二端点组合信息和第三端点组合信息,第二端点组合信息指示的第二端点组合与第一端点组合相同,即第二端点组合指示的端点个数与第一端点组合指示的端点个数相同都为N个,第二端点组合指示的端点类型与第一端点组合的端点类型相同,则USB主机将第二端点组合确定为不需要重新配置的端点组合。第三端点组合信息指示的第三端点组合与第一端点组合不同,即第三端点组合信息指示的端点个数(P个)与第一端点组合指示的端点个数(N个)不同,或者,第三端点组合信息指示的端点类型与第一端点组合信息指示的端点类型不同,USB主机将第三端点组合确定为需要重新配置的端点组合。
可选地,若USB设备为USB设备侧的M个第二端点分配了资源,则USB主机在S1003中可以确定USB设备不需要为重新配置的端点组合分配资源,USB设备只分配端点编号即可;若USB设备为USB设备侧的M个第二端点没有分配资源,则USB主机在S1003中可以确定USB设备需要为重新配置的端点组合分配编号和资源。
具体地,USB主机与USB设备传输不同的第一业务和第二业务时,若传输第一业务所需的业务端点组合与传输第二业务的端点组合存在共同的端点组合,则可以维持这些共同的端点组合的通道不断开,即这些公共端点组合的编号不变所占的资源不变,USB设备也不需要为这些共同的端点组合重新编号,USB设备只需要为第二业务与第一业务不同的端点组合分配编号即可,或者分配编号和资源即可。
例如,USB设备上报了表2所示的T1、T2、T3、T4共四个端点组合信息。第一业务为复制业务,方法500中传输第一业务需要T2和T3。第二业务为打印业务,需要打印USB设备的数据,则可以根据该打印业务确定传输第二业务需要T1和T2,如图11所示,为传输第二业务需要的端点。由于第一业务与第二业务存在共同的端点组合信息T2。则USB设备与USB主机维持T2不变,即图11与图9相比,在图11中保持图9中的BULK_IN、BULK_OUT和中断_IN不变。USB主机确定只需要USB设备给T1的指示的端点分配编号即可,或者USB主机确定只需要USB设备给T1的指示的端点分配编号和资源即可。 当然,USB设备和USB主机还可以释放T3指示的端点组合对应的通道所占的资源,或者还可以删除T3指示的端点组合的编号等。
可选地,USB主机将传输第一业务的业务数据需要的第一端点组合与传输第二业务的业务数据需要的端点组合中相同的端点组合确定为不需要重新配置的端点组合,将传输第一业务的业务数据需要的端点组合中与传输第二业务需要的端点组合不同的端点组合确定为待释放的端点组合。USB主机可以释放这些端点组合的资源,或者释放这些端点组合的资源以及删除这些端点组合的编号。这样,可以节省资源开销。
S1004,USB主机通过控制端点向USB设备发送第二指示信息,USB设备接收USB主机发送的第二指示信息,第二指示信息用于指示S1003确定的需要USB设备重新分配的端点组合,例如第二指示信息指示前述的第三端点组合。
S1005,USB设备为第二指示信息指示的端点组合分配端点编号。
示例性的,如图4所示,USB设备侧的端点配置资源管理模块为第二指示信息指示的端点组合分配端点编号。例如USB设备根据表1为第二指示信息指示的端点组合分配端点分配的编号。
结合S1003的例子,若第二指示信息指示了T1指示的端点组合,则USB设备根据表1为BULK_IN和BULK_OUT分配编号,例如为T1对应的BULK_IN分配编号7,为BULK_OUT分配编号8。
可选地,USB设备将传输第一业务的业务数据需要的端点组合中与传输第二业务需要的端点组合不同的端点组合确定为待释放的端点组合。USB设备可以释放这些端点组合的资源,或者释放这些端点组合的资源以及删除这些端点组合的编号。这样,可以节省资源开销。
S1006,USB设备通过控制端点将为传输第二业务的端点分配的端点编号发送给USB主机,例如USB设备为第三端点组合指示的P个端点分配P个编号。
S1007,USB主机根据S1006中的端点编号在剩余的通道中确定用于传输第二业务的通道。
如前述第二端点组合和第三端点组合的例子中,若S1006中的端点编号为P个,USB主机根据P个端点编号在剩余的M-N个通道中确定P个通道,P为小于或等于M-N的正整数。
示例性地,如图4所示,USB主机侧的资源管理模块在剩余的通道中确定用于传输第二业务的通道。
结合S511中的例子和S1005的例子,USB设备与USB主机共建立了16个通道,USB设备与USB主机维持通道1、通道2和通道3不变,USB主机只需要为T1对应的端点分配端点编号,如为BULK_IN分配编号7,为BULK_OUT分配编号8,这样,S1007中USB主机确定传输第二业务的通道为通道7和通道8。这样,USB主机和USB设备可以利用通道1、通道2、通道3、通道7和通道8传输第二业务的业务数据。此外,USB主机和USB设备可以释放通道4、通道5和通道6所占的资源。
可选地,若在S503中,USB主机为USB主机侧的M个第一端点分配了资源,则USB主机可以确定USB主机不需要为待配置的端点组合分配资源;若USB设备为USB设备侧的M个第二端点没有分配资源,则USB主机在S1003中可以确定USB主机也需要为重新 配置的端点组合分配资源。结合上述的例子,USB主机需要给USB主机侧的通道7和通道8的端点分配资源。
S1008,USB主机利用S1007确定的通道以及与第一业务存在共同的通道与USB设备传输第二业务。
示例性地,S1007可以确定P个通道,与第一业务存在共同的N个通道,则USB主机可以通过P+N个通道与USB设备传输第二业务。
在上述方案中,USB主机和USB设备在切换不同的传输业务时,不同业务存在共同的端点组合信息对应的端点组合维持不变,即这些端点组合的编号不变所占的资源不变,只需要为不同的端点组合信息指示的端点组合分配编号,或者分配编号和资源,这样,可以节省开销。此外,由于一个虚拟USB接口包括M个第二端点,在USB设备与USB主机切换不同的业务时,只需要动态切换该虚拟USB接口中的端点组合即可,不需要断开虚拟USB接口,也不需要删除虚拟USB接口描述符和设备描述符,避免切换业务时需要重新上报设备描述符以及接口描述符所带来的时延。
上述方法500的S502中,USB设备向USB主机上报USB设备支持的总的M个第二端点的端点信息,如图7所示,M个第二端点为一个虚拟USB接口对应的端点。USB设备向USB主机上报至少一个端点组合信息所指示的端点组合为这M个第二端点的端点功能组合。但本申请实施例不予限制,例如,M个第二端点中的L个第二端点为一个虚拟USB接口对应的端点,L为小于或等于M的正整数,剩余的M-L个第二端点为另一个虚拟USB接口对应的端点,L为小于M的正整数。这样,USB设备上报的至少一个端点组合信息中的部分端点组合信息为L个端点的端点功能组合,剩余部分端点组合信息为M-L个端点的端点功能组合。这样,USB设备与USB主机在传输不同的业务时,可以在L个端点的端点功能组合切换端点功能组合;或者也可以在M-L个端点的端点功能组合中切换端点功能。具体的,在不同虚拟USB接口对应的端点组合中确定传输不同业务的端点组合的方式参见方法500和方法1000,为了避免赘述,本申请不详细描述。
举例来说,如图12所示,USB设备向USB主机可以上报虚拟USB接口E对应M-L个第二端点,虚拟USB接口F对应L个端点。此外,USB设备可以向USB主机上报虚拟USB接口E对应的M-L个端点的端点组合信息以及虚拟USB接口F对应的L个端点的端点组合信息。如,USB主机与USB设备通过M-L个端点中的至少部分端点传输业务1,当USB主机需要将业务1切换为业务2时,USB主机根据业务2的需求在M-L个端点中确定用于传输业务2的端点组合,若业务1与业务2存在共同的端点组合,可以保持共同的端点组合不断开,即这些端点组合的编号不变或者编号和资源都不变,USB设备为与业务1不同的端点组合配置端点编号,或者配置端点编号和资源,从而实现在M-L个端点中传输不同的业务。又例如,USB主机与USB设备通过L个端点中的至少部分端点传输业务3,当USB主机需要将业务3切换为业务4时,USB主机根据业务4的需求在L个端点中确定用于传输业务4的端点组合,若业务3与业务4存在共同的端点组合,可以保持共同的端点组合不断开,即这些端点组合的编号不变或者编号和资源都不变,USB设备为与业务3不同的端点组合配置端点编号,或者配置端点编号和资源,从而实现在L个端点中传输不同的业务。
需要说明的是,一个虚拟USB接口所对应的端点被释放之后,另外一个虚拟USB接 口可以申请被释放的端点。结合上述例子,假设USB主机与USB设备释放了虚拟USB接口F的对应的L个端点中的端点1,则USB主机可以重新为虚拟USB接口E申请该端点1。
下面结合图13描述本申请实施例用于USB传输的方法1300。
S1301,USB设备的设备服务管理模块中的端点配置资源管理进行初始化,初始化包括根据USB设备的能力,分别创建端点能力集与协议通路能力集,并完成资源初始化。
示例性的,端点能力集对应前述的M个第二端点的端点类型和M个第二端点的端点编号。
示例性的,协议通路能力集对应前述的至少一个端点组合信息。一个协议通路对应一个端点组合信息。
S1302,USB设备连接USB主机,USB设备默认配置单一接口(前述的一个USB虚拟接口),USB主机查询USB设备能力,获取USB设备端点能力集,完成接口初始化和配置。
示例性的,USB主机获取USB设备端点能力集完成接口初始化和配置,具体可以包括:USB主机根据USB设备的端点能力集确定USB主机侧的端点的类型和编号,USB主机侧端点可以为前述的M个第一端点。
S1303,USB主机的主机服务管理模块中的资源管理模块查询USB设备支持的协议通路能力集,完成USB主机侧的协议通路集所需资源的初始化。
示例性的,主机服务管理模块中的资源管理模块可以查询USB设备支持的协议通道能力集,并对USB主机侧的协议通路集对应的端点组合分配资源。
S1304,USB主机的应用程序层通过主机服务管理模块获取USB设备所支持的功能集,根据第一业务或第二业务所需向主机服务管理模块发送切换命令,由消息处理模块处理执行切换动作,并通知资源管理模块。
S1305,主机服务管理模块中,资源管理模块申请协议通路n(Tn),在USB主机管理资源的同时,也需通知USB设备同步进行资源的管理,USB设备的设备服务管理模块的端点配置资源管理模块,申请对应的协议通路。在不同业务场景下,该步骤可动态申请、启用、停用、挂起、销毁资源。
S1306,主机服务管理模块中,协议封装与解析模块处理协议通路n上通信数据的协议封装与解析,在USB设备侧也需同步处理。当存在多种协议通路时,该协议封装与解析模块处理每个协议通路。
S1307,USB主机的应用程序层中的应用程序可以通过协议通路n与USB设备交互,在USB设备侧,也存在USB设备应用程序层,应用程序层中的应用程序可以通过协议通路n与USB主机交互。
本实施例可以根据上述方法示例对USB主机和USB设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中,如图4所示。上述集成的模块可以采用硬件的形式实现。需要说明的是,本实施例中对图4的模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
需要说明的是,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能 模块的功能描述,在此不再赘述。
本实施例提供的USB主机和USB设备,用于执行上述用于USB传输的方法,因此可以达到与上述实现方法相同的效果。在采用集成的单元的情况下,USB主机和USB设备分别可以包括处理模块、存储模块和通信模块。其中,处理模块可以用于对USB主机和USB设备的动作进行控制管理。存储模块可以用于支持USB主机和USB设备执行存储程序代码和数据等。通信模块,可以用于支持客户端和服务端与其他设备的通信。
其中,处理模块可以是处理器或控制器。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理(digital signal processing,DSP)和微处理器的组合等等。存储模块可以是存储器。通信模块具体可以为射频电路、蓝牙芯片、Wi-Fi芯片等与其他电子设备交互的设备。
在一个实施例中,当处理模块为处理器,存储模块为存储器时,本实施例所涉及的电子设备可以为具有图14所示结构的设备。
示例性的,图14是本申请实施例提供的一例电子设备1400的结构示意图。电子设备1400可以是USB主机或USB设备,电子设备1400可以是包括处理器1410、存储器1420和通信模块1430等。
其中,处理器1410可以包括一个或多个处理单元,存储器1420用于存储程序代码和数据。在本申请实施例中,处理器1410可执行存储器1420存储的计算机执行指令,用于对电子设备1400的动作进行控制管理。例如,若电子设备1400为USB设备,处理器1410可以包括图4所示的USB设备控制器。又例如,电子设备1400为USB主机,处理器1410可以包括图4所示的USB主机控制器。
通信模块1430可以用于电子设备1400的各个内部模块之间的通信、或者电子设备1400和其他外部电子设备之间的通信等。示例性的,如果电子设备1400通过有线连接的方式和其他电子设备通信,通信模块1430可以包括物理USB接口和如图4所示的USB总线等,例如一个物理USB接口可以虚拟出本申请实施例中的上述一个或多个虚拟USB接口,物理USB接口可以是符合USB标准规范的接口,具体可以是Mini物理USB接口,Micro物理USB接口,USB Type C接口等。物理USB接口可以用于连接充电器为电子设备1400充电,也可以用于电子设备1400与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
或者,通信模块1430可以包括音频器件、射频电路、蓝牙芯片、无线保真(wireless fidelity,Wi-Fi)芯片、近距离无线通讯技术(near-field communication,NFC)模块等,可以通过多种不同的方式实现电子设备1400与其他电子设备之间的交互。
可选地,电子设备1400还可以包括显示屏1440,显示屏1440可以显示人机交互界面中的图像或视频等。
可选地,电子设备1400还可以包括外设设备1450,例如鼠标、键盘、扬声器、麦克风等。
应理解,除了图14中列举的各种部件或者模块之外,本申请实施例对电子设备1400的结构不做具体限定。在本申请另一些实施例中,电子设备1400还可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部 件可以以硬件,软件或软件和硬件的组合实现。
本实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的用于USB传输的方法。
本实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中的用于USB传输的方法。
另外,本申请的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中的安全访问数据的方法。
其中,本实施例提供的电子设备、计算机存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。
通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。

Claims (20)

  1. 一种用于通用串行总线USB传输的方法,其特征在于,包括:
    USB主机确定与USB设备传输第一业务;
    所述USB主机在M个第一端点中确定用于传输所述第一业务的N个第一端点;
    所述USB主机通过所述N个第一端点与所述USB设备的一个虚拟USB接口对应的M个第二端点中的N个第二端点之间的N个通道传输所述第一业务的业务数据,所述USB设备的物理USB接口对应所述一个虚拟USB接口,所述M个第二端点为所述USB设备支持的端点数目,所述M个第二端点、所述M个第一端点与M个通道一一对应,所述N个第一端点、所述N个第二端点与所述M个通道中的所述N个通道一一对应,所述M个第一端点为所述USB主机的端点,所述M个第二端点为所述USB设备的端点;
    其中,M、N为正整数,M大于或等于N。
  2. 根据权利要求1所述的方法,其特征在于,在所述USB主机确定传输第一业务之前,所述方法还包括:
    所述USB主机接收来自所述USB设备的第一端点信息,所述第一端点信息用于指示所述USB设备支持的所述M个第二端点的端点类型以及所述M个第二端点的端点编号:
    所述USB主机根据所述第一端点信息确定所述M个第一端点的端点编号;
    所述USB主机根据所述M个第一端点的端点编号和所述M个第二端点的端点编号与所述USB设备建立所述M个通道。
  3. 根据权利要求1或2所述的方法,其特征在于,所述USB主机在M个第一端点中确定用于传输所述第一业务的N个第一端点,包括:
    所述USB主机在至少一个端点组合信息中确定用于传输所述第一业务的第一端点组合信息,所述至少一个端点组合信息中的不同端点组合信息用于指示所述USB设备支持的不同的端点组合,不同的端点组合包括不同数量的端点和/或不同类型的端点,所述第一端点组合信息用于指示第一端点组合;
    所述USB主机根据所述第一端点组合在所述M个第一端点中确定所述N个第一端点,所述第一端点组合用于指示端点的数量为N个以及N个端点的端点类型。
  4. 根据权利要求3所述的方法,其特征在于,所述USB主机根据所述第一端点组合在所述M个第一端点中确定所述N个第一端点,包括:
    所述USB主机向所述USB设备发送第一指示信息,所述第一指示信息用于指示所述第一端点组合;
    所述USB主机接收所述USB设备根据所述第一指示信息指示的所述第一端点组合确定的所述N个第二端点的编号;
    所述USB主机根据所述N个第二端点的编号确定所述N个第一端点。
  5. 根据权利要求3或4所述的方法,其特征在于,所述方法还包括:
    所述USB主机接收来自所述USB设备的所述至少一个端点组合信息。
  6. 根据权利要求3至5中任一项所述的方法,其特征在于,在所述USB主机确定传输第一业务之后,所述方法还包括:
    所述USB主机确定传输第二业务;
    所述USB主机在所述至少一个端点组合信息中确定用于传输所述第二业务的第二端点组合信息和第三端点组合信息,所述第二端点组合信息用于指示第二端点组合,所述第三端点组合信息用于指示第三端点组合;
    若所述USB主机确定所述第一端点组合与所述第二端点组合相同,所述USB主机通过所述N个通道传输所述第二业务的部分数据。
  7. 根据权利要求6所述的方法,其特征在于,所述第三端点组合用于指示端点的数量为P个以及P个端点的端点类型,P小于或等于M-N,所述方法还包括:
    若所述USB主机确定所述第一端点组合与所述第三端点组合不同,所述USB主机向所述USB设备发送第二指示信息,所述第二指示信息用于指示所述第三端点组合;
    所述USB主机接收所述USB设备根据所述第二指示信息确定的P个第二端点的编号;
    所述USB主机根据所述P个第二端点的端点编号在M-N个通道中确定P个通道;
    所述USB主机通过所述P个通道与所述USB设备传输所述第二业务的剩余部分业务数据。
  8. 根据权利要求6或7所述的方法,其特征在于,在所述USB主机确定传输第二业务之后,所述方法还包括:
    所述USB主机向所述USB设备发送切换命令,所述切换命令用于指示将当前正在传输的第一业务切换为第二业务。
  9. 根据权利要求1至8中任一项所述的方法,其特征在于,在所述USB主机确定传输第一业务之前,所述方法还包括:
    所述USB主机为所述M个第一端点分配资源。
  10. 根据权利要求1至8中任一项所述的方法,其特征在于,在所述USB主机在M个第一端点中确定用于传输所述第一业务的N个第一端点之后,所述方法还包括:
    所述USB主机为所述N个第一端点分配资源。
  11. 一种用于通用串行总线USB传输的方法,其特征在于,包括:
    USB设备在一个虚拟USB接口对应的M个第二端点中确定与USB主机传输第一业务的N个第二端点,所述M个第二端点为所述USB设备支持的端点数目,所述USB设备的物理USB接口对应所述一个虚拟USB接口;
    所述USB设备通过所述N个第二端点与所述USB主机的M个第一端点中的N个第一端点之间的N个通道传输所述第一业务的业务数据;
    其中,所述M个第二端点、所述M个第一端点与M个通道一一对应,所述N个第一端点、所述N个第二端点与所述M个通道中的所述N个通道一一对应,M、N为正整数,M大于或等于N,所述M个第一端点为所述USB主机的端点,所述M个第二端点为所述USB设备的端点。
  12. 根据权利要求11所述的方法,其特征在于,在所述USB设备在一个虚拟USB接口对应的M个第二端点中确定与USB主机传输第一业务的N个第二端点之前,所述方法还包括:
    所述USB设备向所述USB主机发送第一端点信息,所述第一端点信息用于指示所述USB设备支持的所述M个第二端点的端点类型以及所述M个第二端点的端点编号;
    所述USB设备根据所述第一端点信息与所述USB主机建立所述M个通道。
  13. 根据权利要求11或12所述的方法,其特征在于,所述USB设备在一个虚拟USB接口对应的M个第二端点中确定与USB主机传输第一业务的N个第二端点,包括:
    所述USB设备接收所述USB主机发送的第一指示信息,所述第一指示信息用于指示第一端点组合,所述第一端点组合用于指示端点的数量为N个以及N个端点的端点类型;
    所述USB设备根据所述第一指示信息指示的所述第一端点组合在所述M个第二端点中确定所述N个第二端点。
  14. 根据权利要求13所述的方法,其特征在于,所述方法还包括:
    所述USB设备向所述USB主机发送至少一个端点组合信息,所述至少一个端点组合信息的不同端点组合信息用于指示所述USB设备支持的不同的端点组合,不同的端点组合包括不同数量的端点和/或不同类型的端点,所述至少一个端点组合信息中的第一端点组合信息用于指示所述第一端点组合。
  15. 根据权利要求11至14中任一项所述的方法,其特征在于,所述方法还包括:
    所述USB设备接收所述USB主机发送的切换命令,所述切换命令用于指示所述USB设备将正在传输的所述第一业务切换为第二业务;
    所述USB设备根据所述切换命令接收所述USB主机通过所述N个通道发送的所述第二业务的部分业务数据。
  16. 根据权利要求15所述的方法,其特征在于,所述方法还包括:
    所述USB设备接收所述USB主机发送的第二指示信息,所述第二指示信息用于指示第三端点组合,所述第三端点组合用于指示端点的数量为P个以及P个端点的端点类型,P小于或等于M-N;
    所述USB设备根据所述第二指示信息指示的所述第三端点组合在所述M个第二端点中确定P个第二端点的编号;
    所述USB设备向所述USB主机发送所述P个第二端点的编号;
    所述USB设备通过所述P个第二端点对应的P个通道与所述USB主机传输所述第二业务的剩余部分业务数据。
  17. 根据权利要求11至16中的任一项所述的方法,其特征在于,在所述USB设备在一个虚拟USB接口对应的M个第二端点中确定与USB主机传输第一业务的N个第二端点之前,所述方法还包括:
    所述USB设备为所述M个第二端点分配资源。
  18. 根据权利要求11至16中的任一项所述的方法,其特征在于,在所述USB设备在一个虚拟USB接口对应的M个第二端点中确定与USB主机传输第一业务的N个第二端点之后,所述方法还包括:
    所述USB设备为所述N个第二端点分配资源。
  19. 一种USB主机,其特征在于,包括处理器,所述处理器与存储器耦合,所述处理器用于执行所述存储器中存储的计算机程序或指令,以使得所述USB主机实现如权利要求1至10中任一项所述的方法。
  20. 一种USB设备,其特征在于,包括处理器,所述处理器与存储器耦合,所述处理器用于执行所述存储器中存储的计算机程序或指令,以使得所述USB设备实现如权利要求11至18中任一项所述的方法。
PCT/CN2021/112163 2020-09-02 2021-08-12 用于usb传输的方法和电子设备 WO2022048419A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010912316.3A CN114201432B (zh) 2020-09-02 2020-09-02 用于usb传输的方法和电子设备
CN202010912316.3 2020-09-02

Publications (1)

Publication Number Publication Date
WO2022048419A1 true WO2022048419A1 (zh) 2022-03-10

Family

ID=80492155

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/112163 WO2022048419A1 (zh) 2020-09-02 2021-08-12 用于usb传输的方法和电子设备

Country Status (2)

Country Link
CN (1) CN114201432B (zh)
WO (1) WO2022048419A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114817115A (zh) * 2022-05-20 2022-07-29 深圳市广和通无线通信软件有限公司 串口通信方法及相关装置
CN115118552B (zh) * 2022-06-21 2024-04-16 深圳市中创电测技术有限公司 一种宽带载波通信网关装置
CN115379280B (zh) * 2022-10-19 2023-01-31 深圳沛喆微电子有限公司 一种信源通道互通传输方法、装置和智能相框
CN115883645B (zh) * 2022-11-24 2024-07-12 百富计算机技术(深圳)有限公司 通信配置方法、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040133708A1 (en) * 2003-01-06 2004-07-08 Netchip Technology, Inc. Virtual endpoint for USB devices
US20080228962A1 (en) * 2007-03-15 2008-09-18 Ping-Wen Ong Virtual pipe for wire adapter communications
CN105531684A (zh) * 2013-09-06 2016-04-27 思科技术公司 通用pci express端口
CN111858439A (zh) * 2019-04-26 2020-10-30 英特尔公司 用于多种通信业务的共享的资源

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4740897B2 (ja) * 2007-05-24 2011-08-03 株式会社日立製作所 仮想ネットワーク構成方法及びネットワークシステム
CN111447103B (zh) * 2020-03-09 2022-01-28 杭州海康威视系统技术有限公司 虚拟设备的管理系统及方法、电子设备及介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040133708A1 (en) * 2003-01-06 2004-07-08 Netchip Technology, Inc. Virtual endpoint for USB devices
US20080228962A1 (en) * 2007-03-15 2008-09-18 Ping-Wen Ong Virtual pipe for wire adapter communications
CN105531684A (zh) * 2013-09-06 2016-04-27 思科技术公司 通用pci express端口
CN111858439A (zh) * 2019-04-26 2020-10-30 英特尔公司 用于多种通信业务的共享的资源

Also Published As

Publication number Publication date
CN114201432A (zh) 2022-03-18
CN114201432B (zh) 2024-07-23

Similar Documents

Publication Publication Date Title
WO2022048419A1 (zh) 用于usb传输的方法和电子设备
US9396101B2 (en) Shared physical memory protocol
CN109445905B (zh) 虚拟机数据通信方法和系统以及虚拟机配置方法和装置
TWI303025B (en) Physical device , i/o device and computer system with virtual machine capable interfaces
US20180210752A1 (en) Accelerator virtualization method and apparatus, and centralized resource manager
US11829309B2 (en) Data forwarding chip and server
CN105122210B (zh) Gpu虚拟化的实现方法及相关装置和系统
US20080320501A1 (en) Aggregate personal computer system
US10509758B1 (en) Emulated switch with hot-plugging
JP7100154B2 (ja) プロセッサコアのスケジューリング方法、装置、端末及び記憶媒体
WO2020259523A1 (zh) 与fpga通信的主机及方法、fpga接口芯片
JP2016541072A (ja) リソース処理方法、オペレーティング・システム、およびデバイス
KR20140065837A (ko) 소프트웨어 가상화를 이용하여 소프트웨어 서비스를 제공하기 위한 장치, 시스템 및 그 방법
US20180373454A1 (en) Cascading Board and SSD Shared Remote Access System and Method
US20150205630A1 (en) Method and System for Mapping Multiple Virtual Machines, and Client Device
CA2625297A1 (en) Dynamic bus-based virtual channel multiplexing device driver architecture
CN112749022A (zh) 相机资源访问方法、操作系统、终端和虚拟相机
WO2023174146A1 (zh) 卸载卡命名空间管理、输入输出请求处理系统和方法
US11934289B2 (en) Graph-based data multi-operation system
CN115298656A (zh) 用于调度可共享pcie端点设备的系统和方法
WO2022143717A1 (zh) 一种虚拟机迁移方法、装置及系统
KR101498965B1 (ko) 가상화 기술을 이용한 내외부망 격리 시스템 및 방법
WO2021239073A1 (zh) 物联网操作系统构建方法、系统、云平台及物联网设备
US20140075063A1 (en) Smart device with no AP
JP2006277204A (ja) 携帯通信端末装置

Legal Events

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

Ref document number: 21863486

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21863486

Country of ref document: EP

Kind code of ref document: A1