Method and apparatus for accelerating the processing of urb requests for usb devices
By intercepting and periodically sending URB requests in the cloud server, combined with virtual USB device processing, the problem of poor user experience caused by network latency in the cloud environment for USB devices is solved, and faster response result reception and processing is achieved.
Patent Information
- Application Number
- CN202511535205.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-10-27
AI Technical Summary
In technologies such as cloud desktops and cloud gaming, the URB request processing process for USB devices is affected by network latency, resulting in a poor user experience.
The VHCI Client Driver intercepts URB requests from the cloud server, queries the response results, and periodically sends the request to the user terminal when no response result is found. It receives the response result, completes the request, and creates a virtual USB device to optimize the processing flow.
The issue of poor USB device operation experience caused by network latency has been optimized by reducing the delay in the request-response process by receiving the response result in advance.
Smart Images

Figure CN121012875B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computers, and in particular to a method and apparatus for accelerating the URB request processing of USB devices. Background Technology
[0002] With the development and maturation of technologies such as cloud desktops, cloud PCs, and cloud gaming, the variety of USB peripherals requiring compatibility and support in remote environments is increasing, and the requirements are becoming more stringent. This has led to the emergence of technologies like USB over IP, which enable local USB peripherals to be used seamlessly remotely. While USB over IP can quickly adapt to various USB peripherals, the inherent limitations of the USB protocol make many peripherals particularly sensitive to network latency. Even slight network latency can cause serious user experience issues. For example, in a cloud PC scenario, the user-side USB peripheral might use a mouse connected to their local computer. However, in USB over IP, the actual mouse is used by a cloud server located in a data center. Due to network latency, the time required for the cloud server application and the mouse to complete a single URB request increases dramatically, resulting in significant mouse operation latency.
[0003] In view of this, how to provide a solution to accelerate the URB request processing of USB devices in a USB over IP environment, so as to optimize the poor user experience of USB devices caused by network latency, has become an urgent technical problem to be solved. Summary of the Invention
[0004] To address the technical problems existing in the prior art, embodiments of this application provide a method and apparatus for accelerating the URB request processing process of a USB device.
[0005] In a first aspect, embodiments of this application provide a method for accelerating the URB request processing of a USB device, applied to an x86 architecture cloud server, comprising:
[0006] After the VHCI Client Driver intercepts the URB request for the target USB device issued by the application in the cloud server, it checks whether there is a corresponding response result for the URB request. In this process, after the target USB device is inserted into the user terminal, the VHCI Client Driver obtains the information of the target USB device, creates a virtual USB device based on the information of the target USB device, and notifies the PNP manager of the cloud server that a new USB device has been inserted.
[0007] If a response exists for the URB request, the VHCI Client Driver completes the URB request; or
[0008] If there is no response to the URB request, the VHCI Client Driver will send the URB request to the user terminal according to a preset period, and receive the response returned by the user terminal to complete the URB request. The response returned by the user terminal is generated by the target USB device.
[0009] Secondly, embodiments of this application also provide a method for accelerating the URB request processing of a USB device, applied to a user terminal, including:
[0010] Receives a URB request for the target USB device sent by the cloud server, and sends the URB request to the target USB device inserted into the user terminal through the USB Stub driver in the user terminal.
[0011] Receive the response result sent by the USB Stub driver and send the response result to the cloud server. The response result is generated by the target USB device.
[0012] Thirdly, embodiments of this application also provide an apparatus for accelerating the URB request processing of a USB device, applied to an x86 architecture cloud server, comprising:
[0013] VHCI Client Driver, used for:
[0014] After intercepting the URB request for the target USB device sent by the application in the cloud server, it checks whether there is a corresponding response result for the URB request. Among them, after the VHCI Client Driver inserts the target USB device into the user terminal, it obtains the information of the target USB device, creates a virtual USB device based on the information of the target USB device, and notifies the PNP manager of the cloud server that a new USB device has been inserted.
[0015] If a response exists for the URB request, then the URB request is completed; or
[0016] If there is no response to the URB request, the URB request will be sent to the user terminal according to a preset period, and the response returned by the user terminal will be received to complete the URB request. The response returned by the user terminal is generated by the target USB device.
[0017] Fourthly, embodiments of this application also provide an apparatus for accelerating the URB request processing of a USB device, applied to a user terminal, comprising:
[0018] Local USB App program, used for:
[0019] Receives a URB request for the target USB device sent by the cloud server, and sends the URB request to the target USB device inserted into the user terminal through the USB Stub driver in the user terminal.
[0020] Receive the response result sent by the USB Stub driver and send the response result to the cloud server. The response result is generated by the target USB device.
[0021] The method and apparatus for accelerating the URB request processing of USB devices provided in this application embodiment intercepts URB requests sent by applications on the cloud server to the target USB device by the VHCI Client Driver in the cloud server, and sends the URB requests to the user terminal according to a preset period. In this way, the response results returned by the user terminal can be continuously received, and the corresponding request is finally completed. That is to say, this solution can push the response results to the cloud server in advance by sending the URB requests periodically. Compared with the existing USB over IP technology, it eliminates the process of sending URB requests to the user terminal and receiving the response results returned by the user terminal, thus optimizing the problem of poor operating experience of USB devices caused by network latency. Attached Figure Description
[0022] Figure 1 A flowchart illustrating an embodiment of a method for accelerating the URB request processing of a USB device, provided in this application.
[0023] Figure 2 A flowchart illustrating another embodiment of a method for accelerating the URB request processing of a USB device, provided in this application;
[0024] Figure 3 A schematic diagram of an embodiment of an apparatus for accelerating the URB request processing of a USB device, provided in this application.
[0025] Figure 4 This is a schematic diagram of another embodiment of an apparatus for accelerating the URB request processing of a USB device, provided in this application. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0027] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0028] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0029] First, let's explain the terms that appear in this article:
[0030] VHCI Client Driver (Virtual Host Controller Interface Client Driver): This is the core of the invention. It creates a virtual target USB device in the cloud server system and is responsible for intercepting requests, backing up requests, and preparing response results in advance.
[0031] USB devices: physical devices such as mice, keyboards, USB flash drives, graphics tablets, etc.
[0032] Remote USB App: A background program running on a cloud server, responsible for communicating with the user terminal;
[0033] Local USB App: A background program that runs on the user terminal and is responsible for communicating with the cloud server and managing USB devices;
[0034] USB Stub: A "placeholder" driver that takes over the actual target USB device, preventing the system's built-in driver from using it directly;
[0035] USB Monitor: A USB bus filter or hook driver that can monitor the insertion and removal of USB devices on the user terminal side by intercepting messages from the user terminal's USBHub driver.
[0036] Reference Figure 1 The diagram shown is a flowchart illustrating a method for accelerating the URB request processing of a USB device according to an embodiment of this application. This method is applied to an x86-based cloud server and includes:
[0037] S10: After the VHCI Client Driver intercepts the URB request for the target USB device issued by the application in the cloud server, it checks whether there is a corresponding response result for the URB request. The VHCI Client Driver obtains the information of the target USB device after the target USB device is inserted into the user terminal, creates a virtual USB device based on the information of the target USB device, and notifies the PNP manager of the cloud server that a new USB device has been inserted.
[0038] S11. If a response exists for the URB request, the VHCI Client Driver completes the URB request; or
[0039] S12. If there is no response result corresponding to the URB request, the VHCI Client Driver will send the URB request to the user terminal according to a preset period, and receive the response result returned by the user terminal to complete the URB request. The response result returned by the user terminal is generated by the target USB device.
[0040] In this embodiment, it should be noted that the redirection strategy can be pre-sent to the USB Monitor driver via the Local USB App program. Specifically, it may include information about the target USB device (including at least one of device ID, compatibility ID, instance ID, device description, device type, etc.) and the USB device information corresponding to the USB Stub driver. When a new USB device is inserted into the user terminal, the USB Monitor driver, according to the preset redirection strategy, if it determines that the newly inserted USB device is the target USB device, will modify the target USB device information returned to the PNP manager by the USB Hub driver to the USB device information corresponding to the USB Stub driver in order to isolate the user terminal's system from the target USB device. As a result, the user terminal's system will load the USB Stub driver for the target USB device instead of loading the driver corresponding to the target USB device, thus realizing the takeover of the target USB device by the USB Stub driver. Specifically, when a user terminal inserts a new USB device, the USB Hub driver notifies the user terminal's PNP manager of the USB peripheral relationship change. The user terminal's PNP manager then sends a PNP request to the USB Hub driver to query the peripheral relationship. The USB Monitor driver intercepts this PNP request and forwards it to the USB Hub driver to retrieve the USB device list (which contains device objects of all USB devices currently inserted into the user terminal). The USB Monitor driver then uses the USB Hub driver to retrieve all information about each USB device in the USB device list. Based on the target USB device information type in the redirection policy, it compares the information of each USB device with the target USB device information in the redirection policy to determine if each USB device is the target USB device and marks the target USB device's device object within each USB device. If the information of a USB device M is the same as the target USB device N in the redirection policy, then USB device M is determined to be the target USB device N, and the device object of USB device M is marked. Afterwards, the PNP manager on the user terminal can obtain a list of USB devices from the USB Hub driver. After obtaining the list of USB devices, the PNP manager on the user terminal can identify the newly inserted USB device and send a PNP request to the USB Hub driver to query the information of the newly inserted USB device. The USB Monitor driver will intercept this PNP request. If it is determined that the device object carried in this PNP request is a marked device object, then the newly inserted USB device is determined to be the target USB device. Then, the information of the newly inserted USB device returned by the USB Hub driver to the PNP manager on the user terminal is modified to the USB device information corresponding to the USB Stub driver.The USB device information corresponding to the USB Stub driver can include at least some of the information written to the system by the USB device when the USB Stub driver is installed, such as at least one of the following: device ID, compatibility ID, instance ID, and device description. The target USB device is one that is sensitive to network latency, such as a mouse or keyboard. Redirection strategies can be used to redirect specific types and models of USB devices.
[0041] After the user terminal's system successfully loads the USB Stub driver, the Local USB App program sends the information of the newly inserted target USB device (which the Local USB App program obtains from the USB Monitor driver) to the Remote USB App program via the network. The Remote USB App program then notifies the VHCI Client Driver, which creates a corresponding virtual target USB device based on the target USB device information in the notification. The information of the virtual target USB device is completely consistent with the information of the newly inserted target USB device on the user terminal.
[0042] After the VHCI Client Driver creates a virtual target USB device, it notifies the PNP manager of the cloud server that a new USB device has been inserted. Then, the PNP manager loads the corresponding USB device driver and the upper-layer device driver based on the information of the virtual target USB device in the notification. Finally, the application in the cloud server can recognize that a target USB device has been inserted into the cloud server.
[0043] When an application on the cloud server detects a newly inserted target USB device, it sends a URB request. This URB request passes sequentially through the upper-layer device driver and the USB device driver, ultimately being intercepted by the VHCI Client Driver. Upon intercepting the URB request, the VHCI Client Driver first checks if a corresponding response exists. If a response exists, the URB request is completed; otherwise, it sends the URB request to the user terminal according to a preset period and receives the response from the user terminal, thus completing the URB request. The check for a corresponding response can be performed by querying a preset response chain. If a response exists in the response chain, the URB request is considered to have a corresponding response; otherwise, it is determined that no response exists. If a response exists for the URB request, the URB request is completed, including: determining if the number of response results for the URB request is 1; if so, the response result is used as the target response result to complete the URB request; or if the number of response results is not 1, each response result for the URB request is iterated in ascending order of storage time, and the time interval between the storage time of the current response result and the time when the VHCI Client Driver intercepts the URB request is greater than or equal to a preset time threshold; if it is greater than or equal to the preset time threshold, the process jumps to the next response result for the URB request; or if it is less than the preset time threshold, the current response result is used as the target response result to complete the URB request. If a target response result is found during the iteration, the iteration process ends, and response results whose storage time is earlier than that of the target response result are deleted. If the target response is not found during the traversal, the response with the latest storage time in the response results corresponding to the URB request is taken as the target response, the URB request is completed using the target response, and the response results in the response results corresponding to the URB request whose storage time is earlier than that of the target response are deleted.Sending URB requests to the user terminal according to a preset period can include: the VHCI Client Driver placing the URB request into a preset URB request queue and returning a Pending state (blocked); the VHCI Client Driver backing up the URB request and placing the backed-up URB request into a preset timed execution queue, where no duplicate URB requests exist in the timed execution queue; and the Remote USB App program retrieving the URB request from the timed execution queue according to a preset period and sending the URB request to the Local USB App program. For different target USB devices, the URB requests issued by the application may include one or more types. If the application issues only one type of URB request, then after placing the URB request into the timed execution queue, only one URB request exists in the timed execution queue. If the application issues multiple types of URB requests, then different types of URB requests can use the same timed execution queue or different timed execution queues, and no duplicate URB requests exist in any of the timed execution queues. If there are at least two URB requests in the timed execution queue, the Remote USB App can sequentially retrieve one URB request from the queue at a preset period and send it to the Local USB App. Alternatively, for each URB request in the timed execution queue, the Remote USB App can retrieve the URB request at a preset period and send it to the Local USB App. The preset period can be set according to the target USB device's properties, typically 1ms. After receiving a URB request, the Local USB App sends it to the USB Stub driver. Upon receiving the URB request, the USB Stub driver returns a Pending status and forwards the URB request sequentially through the user terminal's USB Hub driver and USB Host Control driver to the target USB device. The response from the target USB device is then sent sequentially through the USB Host Control driver and USB Hub driver to the USB Stub driver, which writes the response into a response list. The Local USB App then reads the response result from the response list and sends it to the Remote USB App over the network. The Remote USB App then passes the response result to the VHCI Client Driver. This completes the URB request process, including the VHCI Client Driver returning the response result to the cloud server system via the USB device driver and the upper-layer device driver.After receiving the response, the cloud server system converts it into a system peripheral event. When the cloud server's application monitors the system peripheral event, it executes the corresponding logic, renders the application screen, and sends the application screen to the user terminal after being collected and encoded. The user terminal receives the application screen, decodes it, and displays it.
[0044] After the target USB device is inserted, the VHCI Client Driver continuously receives response results. Each time it receives a response, the VHCI Client Driver checks if a corresponding URB request exists. If it does, it completes the corresponding URB request directly; otherwise, it stores the response (e.g., in a response list) and waits for the corresponding URB request to be completed. Checking for the existence of a corresponding URB request can include: checking if a URB request corresponding to the response exists in the URB request queue. If a URB request corresponding to the response exists in the queue, it is determined that a corresponding URB request exists; otherwise, it is determined that no corresponding URB request exists.
[0045] The method for accelerating the URB request processing of USB devices provided in this application embodiment involves the VHCI Client Driver in the cloud server intercepting URB requests sent by applications in the cloud server to the target USB device, and sending the URB requests to the user terminal according to a preset period. In this way, the response results returned by the user terminal can be continuously received, and the corresponding request is finally completed. In other words, this solution can push the response results to the cloud server in advance by sending URB requests periodically. Compared with the existing USB over IP technology, it eliminates the process of sending URB requests to the user terminal and receiving the response results returned by the user terminal, thus optimizing the problem of poor operating experience of USB devices caused by network latency.
[0046] Reference Figure 2 The diagram shown is a flowchart illustrating a method for accelerating the URB request processing of a USB device according to an embodiment of this application. This method is applied to a user terminal and includes:
[0047] S20. Receive the URB request for the target USB device sent by the cloud server, and send the URB request to the target USB device inserted in the user terminal through the USB Stub driver in the user terminal.
[0048] S21. Receive the response result sent by the USB Stub driver and send the response result to the cloud server. The response result is generated by the target USB device.
[0049] The method for accelerating the URB request processing of USB devices provided in this application embodiment receives a URB request for a target USB device sent by a cloud server, sends the URB request to the target USB device inserted into the user terminal through the USB Stub driver in the user terminal, receives the response result sent by the USB Stub driver, and sends the response result to the cloud server. This allows the cloud server to receive the response result returned by the user terminal in advance by sending the URB request periodically. Compared with the existing USB over IP technology, this eliminates the process of sending the URB request to the user terminal and receiving the response result returned by the user terminal, thus optimizing the problem of poor operating experience of USB devices caused by network latency.
[0050] Reference Figure 3 The diagram shown is a structural schematic of an apparatus for accelerating the URB request processing of a USB device according to an embodiment of this application. This apparatus is applied to an x86-based cloud server and includes:
[0051] VHCI Client Driver 30, used for:
[0052] After intercepting the URB request for the target USB device sent by the application in the cloud server, it checks whether there is a corresponding response result for the URB request. Among them, after the VHCI Client Driver inserts the target USB device into the user terminal, it obtains the information of the target USB device, creates a virtual USB device based on the information of the target USB device, and notifies the PNP manager of the cloud server that a new USB device has been inserted.
[0053] If a response exists for the URB request, then the URB request is completed; or
[0054] If there is no response to the URB request, the URB request will be sent to the user terminal according to a preset period, and the response returned by the user terminal will be received to complete the URB request. The response returned by the user terminal is generated by the target USB device.
[0055] The apparatus provided in this application for accelerating the URB request processing of USB devices involves a VHCI Client Driver in a cloud server intercepting URB requests sent by applications in the cloud server to the target USB device. The URB requests are then sent to the user terminal according to a preset period. This allows for a continuous stream of response results from the user terminal, ultimately completing the corresponding request. In other words, this solution, through the periodic sending of URB requests, can push the response results to the cloud server in advance. Compared to existing USB over IP technology, this eliminates the process of sending URB requests to the user terminal and receiving the response results, thus optimizing the problem of poor USB device operation experience caused by network latency.
[0056] Reference Figure 4 The diagram shown is a structural schematic of an apparatus for accelerating the URB request processing of a USB device according to an embodiment of this application. The apparatus is applied to a user terminal and includes:
[0057] Local USB App program 40, used for:
[0058] Receives a URB request for the target USB device sent by the cloud server, and sends the URB request to the target USB device inserted into the user terminal through the USB Stub driver in the user terminal.
[0059] Receive the response result sent by the USB Stub driver and send the response result to the cloud server. The response result is generated by the target USB device.
[0060] The apparatus provided in this application for accelerating the URB request processing of USB devices receives a URB request for a target USB device sent by a cloud server, sends the URB request to the target USB device inserted into the user terminal through a USB Stub driver in the user terminal, receives the response result sent by the USB Stub driver, and sends the response result to the cloud server. This allows the cloud server to receive the response result returned by the user terminal in advance by sending the URB request periodically. Compared with the existing USB over IP technology, this eliminates the process of sending the URB request to the user terminal and receiving the response result returned by the user terminal, thus optimizing the problem of poor operating experience of USB devices caused by network latency.
[0061] The apparatus for accelerating the URB request processing of a USB device provided in this application embodiment is implemented in the same way as the method for accelerating the URB request processing of a USB device provided in this application embodiment, and the effect it achieves is also the same as the method for accelerating the URB request processing of a USB device provided in this application embodiment, so it will not be described again here.
[0062] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for accelerating the URB request processing of USB devices, applied to an x86 architecture cloud server, characterized in that, include: After the VHCI Client Driver intercepts the URB request for the target USB device issued by the application in the cloud server, it checks whether there is a corresponding response result for the URB request. In this process, after the target USB device is inserted into the user terminal, the VHCI Client Driver obtains the information of the target USB device, creates a virtual USB device based on the information of the target USB device, and notifies the PNP manager of the cloud server that a new USB device has been inserted. If a response exists for the URB request, the VHCI Client Driver completes the URB request; or If there is no response to the URB request, the VHCI Client Driver will send the URB request to the user terminal according to a preset period, and receive the response returned by the user terminal to complete the URB request. The response returned by the user terminal is generated by the target USB device.
2. The method as described in claim 1, characterized in that, The acquisition of information about the target USB device includes: The VHCI Client Driver receives information about the target USB device sent by the Remote USB App program on the cloud server. This information is sent from the Local USB App program on the user terminal to the Remote USB App program.
3. The method as described in claim 1 or 2, characterized in that, The VHCI Client Driver sends URB requests to the user terminal at a preset period, including: The VHCI Client Driver places URB requests into a pre-defined URB request queue. The VHCI Client Driver backs up URB requests and puts the backed-up URB requests into a preset timed execution queue. The Remote USB App program retrieves URB requests from the timed execution queue at preset intervals and sends the URB requests to the Local USB App program.
4. The method as described in claim 3, characterized in that, Also includes: The VHCI Client Driver receives the response to the URB request sent by the Remote USB App program and determines whether there is a URB request in the URB request queue that corresponds to the response. If there is a URB request in the URB request queue that corresponds to the response, the URB request is completed; otherwise, if there is no URB request in the URB request queue that corresponds to the response, the response is stored.
5. An apparatus for accelerating the URB request processing of a USB device, applied to an x86 architecture cloud server, characterized in that, include: VHCI Client Driver, used for: After intercepting the URB request for the target USB device sent by the application in the cloud server, it checks whether there is a corresponding response result for the URB request. Among them, after the VHCI Client Driver inserts the target USB device into the user terminal, it obtains the information of the target USB device, creates a virtual USB device based on the information of the target USB device, and notifies the PNP manager of the cloud server that a new USB device has been inserted. If a response exists for the URB request, then the URB request is completed; or If there is no response to the URB request, the URB request will be sent to the user terminal according to a preset period, and the response returned by the user terminal will be received to complete the URB request. The response returned by the user terminal is generated by the target USB device.
Citation Information
Patent Citations
USB equipment access method, device and system, terminal and server
CN105183675A
Far-end sharing system for external equipment
CN105872096A