WO2018041193A1 - Method, device, and computer storage medium for usb device redirection - Google Patents

Method, device, and computer storage medium for usb device redirection Download PDF

Info

Publication number
WO2018041193A1
WO2018041193A1 PCT/CN2017/099843 CN2017099843W WO2018041193A1 WO 2018041193 A1 WO2018041193 A1 WO 2018041193A1 CN 2017099843 W CN2017099843 W CN 2017099843W WO 2018041193 A1 WO2018041193 A1 WO 2018041193A1
Authority
WO
WIPO (PCT)
Prior art keywords
usb device
information
usb
redirected
hub
Prior art date
Application number
PCT/CN2017/099843
Other languages
French (fr)
Chinese (zh)
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 WO2018041193A1 publication Critical patent/WO2018041193A1/en

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/10Program control for peripheral devices
    • G06F13/102Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver
    • 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/10Program control for peripheral devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0042Universal serial bus [USB]

Definitions

  • the present disclosure relates to the field of communications, and in particular, to a USB device redirection method and apparatus, and a computer storage medium.
  • USB (Universal Serial Bus) device redirection provides an end-to-end access solution that maps USB peripherals on physical terminals to cloud desktops
  • ie USB device redirection is a cloud desktop environment A technology that provides functions for USB devices on a physical terminal.
  • USB device redirection forwards all I/O requests of applications in the cloud desktop to the USB peripherals of the physical terminal through the network, so that the USB device drivers and applications in the cloud desktop do not perceive the controlled
  • the USB device is actually remote, making the user experience of the USB device in the cloud desktop environment closer to the physical machine.
  • the redirection function is automatically or manually implemented by establishing a complete control link between the cloud desktop and the physical terminal, so that the use of the USB peripheral is more flexible and convenient.
  • USB device redirection function when establishing and canceling the USB device redirection function, it is necessary to locally install each USB device driver to determine the USB device to be redirected.
  • the user only uses the redirected USB device in the cloud desktop, so it is only necessary to install the device driver of the redirected USB device in the cloud desktop, and install each device that inserts the USB device locally in the terminal.
  • the driver not only increases the storage pressure of the terminal, but also installs the device driver of the USB device multiple times in the terminal, which makes the user operation cumbersome and affects the user experience.
  • the embodiment of the invention provides a USB device redirection method and device.
  • the main technical problem is that when the USB device is redirected, the terminal needs to locally install the device driver inserted into the USB device, so that the terminal has high storage pressure and user experience. Bad question.
  • the embodiment of the invention provides a USB device redirection method, including:
  • the information structure completes the corresponding redirection process of the USB device to be redirected.
  • the embodiment of the invention further provides a USB device redirection device, comprising:
  • USB device determining module to be used for determining a USB device to be redirected according to location information of the USB device selected from the USB device list and location information corresponding to the physical device object created by the hub;
  • the device information structure sending module is configured to send the device information structure corresponding to the USB device to be redirected to the cloud desktop, so that the cloud desktop completes the corresponding redirection processing of the USB device to be redirected according to the device information structure.
  • the embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the USB device redirection method according to any one of the foregoing.
  • a USB device redirection method, apparatus, and computer storage medium determine a USB device to be redirected by using location information of a USB device selected from a USB device list and location information corresponding to a physical device object created by a hub;
  • the device information structure corresponding to the USB device to be redirected is sent to the cloud desktop, so that the cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure. That is, in the USB device redirection process, the USB device to be redirected can be determined by the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, and the determined to be redirected The USB device performs a redirection operation.
  • the terminal when performing USB device redirection, the terminal needs to locally install the device driver corresponding to each USB device to determine the manner in which the USB device to be redirected is redirected, thereby reducing the storage pressure of the terminal and making The redirection process is simple and improves the user experience.
  • FIG. 1 is a flowchart of a USB device redirection method according to Embodiment 1 of the present invention
  • FIG. 2 is a schematic diagram of a USB device redirection system according to Embodiment 2 of the present invention.
  • FIG. 3 is a flowchart of a method for generating a USB list according to Embodiment 2 of the present invention.
  • FIG. 5 is a schematic diagram of a USB device redirection device according to Embodiment 3 of the present invention.
  • FIG. 6 is a schematic diagram of another USB device redirection device according to Embodiment 3 of the present invention.
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • This embodiment provides a USB device redirection method.
  • the method specifically includes:
  • Step S101 Determine, according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, the USB device to be redirected;
  • Step S102 The device information structure corresponding to the USB device to be redirected is sent to the cloud desktop, so that the cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure.
  • the location information corresponding to the device information structure corresponding to the USB device selected from the USB device list is compared and matched with the location information corresponding to the physical device object created by the hub,
  • the USB device to be redirected can be determined, and then the determined redirected USB device is redirected.
  • the determined USB device to be redirected may be a USB device that needs to be redirected by the USB device, or a USB device that needs to cancel the USB device redirection function, which may be specifically selected and set according to requirements.
  • step S101 determining, according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, the USB device to be redirected, including: device information corresponding to the USB device selected from the USB device list.
  • device information corresponding to the USB device selected from the USB device list Obtaining location information of the USB device in the structure; enumerating the hub through the physical bus, acquiring location information corresponding to the physical device object created by each hub; matching the location information with the location information of the USB device selected from the USB device list
  • the USB device corresponding to the physical device object acts as the USB device to be redirected.
  • the USB device when performing USB device redirection, may be selected from the USB device list of the client, and then the device information structure corresponding to the selected USB device is obtained, and the device information structure is parsed to obtain the selection. Location information corresponding to the USB device.
  • the USB device is selected according to the needs of the USB device list of the client, and the user may manually select the USB device, such as in the USB device list displayed on the display page of the redirect setting of the client.
  • the USB device identifier performs a trigger operation such as clicking, and performs USB device selection; the USB device selection trigger command may also be set, and the system automatically selects the corresponding USB device according to the USB device identification information in the USB device selection trigger command; the USB device identifier Specifically, it may be a name of the USB device or the like that can identify the information of the USB device. Enumerate from the physical bus after getting the location information of the USB device selected from the USB device list A hub (HUB) acquires all physical device objects of USB devices created by each hub, and then acquires location information corresponding to each physical device object.
  • a hub (HUB) acquires all physical device objects of USB devices created by each hub, and then acquires location information corresponding to each physical device object.
  • the obtaining the location information corresponding to the physical device object may be: sending the location information acquisition message to the physical device corresponding to the physical device object, and acquiring the location information corresponding to the physical device object. After acquiring the location information corresponding to the physical device object, comparing the location information corresponding to the physical device object with the location information parsed from the device information structure, and matching the location information with the location information of the device information structure.
  • the USB device corresponding to the device object acts as the USB device to be redirected.
  • the location information corresponding to the physical device object is the location information of the physical device corresponding to the physical device object, such as the location information of the USB device corresponding to the physical device object.
  • the device driver corresponding to the USB device created by each hub in the terminal it is not necessary to install the device driver corresponding to the USB device created by each hub in the terminal to determine the USB device to be redirected, and only need to enumerate all the physical device objects of the USB device created by each hub from the physical bus.
  • the location information of the physical device object is matched with the location information corresponding to the device information structure of the selected USB device, and the USB device to be redirected can be determined.
  • the processing operation of the USB device to be redirected is determined according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, and specifically, the specific setting may be set on the client.
  • the driver performs processing, and the driver can be specifically named "quick-cut driver".
  • the process of generating the USB device list specifically includes: enumerating all the USB devices created by the terminal hub, and obtaining the device information structure corresponding to each USB device, and then generating the USB device identifier and USB corresponding to each USB device.
  • the USB device list corresponding to the device information structure of the device is stored in the client. Specifically, the USB device list may be displayed on a display interface such as a USB device redirection setting interface of the client.
  • the device information structure of the USB device is generated by: collecting hub information by enumerating a hub from the physical bus; acquiring USB device information according to the hub information; and generating device information according to the hub information and the USB device information.
  • the structure; the device information structure includes location information of the USB device.
  • the USB physical bus driver on the terminal can be opened by the client, and the hub is obtained by enumerating the hub from the physical bus through the USB physical bus driver, and the hub information may specifically include the hub serial number information. And then, according to the hub information, sending a device information acquisition message to each hub, and acquiring device information of the USB device corresponding to each hub, where the device information specifically includes a VID (Vendor ID, manufacturer ID) and a PID (Product ID,) of the USB device. Product ID), device instance ID and corresponding HUB name and USB Information about the port information corresponding to the device. Then, the device information structure of the USB device is obtained according to the hub information and the device information.
  • VID Vehicle ID
  • PID Product ID
  • the location information of the USB device when the device information of the USB device is acquired, the location information of the USB device cannot be directly obtained, and the location information of the USB device in the device information structure is generated by: determining the hub according to the hub information. Serial number information; determining the USB device port information according to the USB device information; splicing the USB device port information and the hub serial number information to obtain the location information of the USB device.
  • the device can be patched according to the hub serial number information in the obtained hub information and the USB device port information in the USB device information, to obtain the location information of the specific USB device.
  • the USB device list when the USB device list is generated, the USB device list may be generated according to the USB device list setting operation of the user, or the USB device list may be automatically generated when the USB device list generation condition is met.
  • the USB device list generation condition is met, the USB device list is automatically generated.
  • the USB device list generation operation is triggered to generate a new USB device list; and the USB device device may also be set.
  • a timer is generated to periodically generate a new list of USB devices when the USB device enumeration timer is triggered.
  • the new USB device list can be replaced with the USB device list stored by the client and displayed on the display interface specified on the client.
  • the method further includes: loading the USB device to be redirected by a preset unified device driver.
  • the determined USB device to be redirected may be manually inserted and removed, and the device information of the USB device to be redirected is changed, for example, the PID and VID information of the USB device are changed.
  • the USB device to be redirected is loaded with a unified device driver pre-installed in the terminal.
  • the unified device driver may specifically be a device driver corresponding to the changed device information.
  • the unified device driver is installed locally on the terminal and serves as a device driver corresponding to each USB device to be redirected, so that each USB device to be redirected is redirected according to the unified device driver, and does not need to install each USB device to be redirected each time.
  • Corresponding device driver when the USB device to be redirected is the first USB device that needs to be redirected in the current redirecting system, the unified device driver may be installed and loaded in real time after determining that it is the USB device to be redirected.
  • the unified device driver is used for redirection processing.
  • step S102 the device information structure corresponding to the USB device to be redirected is sent to the cloud desktop, so that The cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure.
  • the device information structure corresponding to the USB device to be redirected is sent to the cloud desktop, and the desktop creates the virtual USB device corresponding to the USB device to be redirected on the cloud desktop according to the device information structure of the USB device to be redirected.
  • the virtual USB device is installed on the virtual bus line of the cloud desktop, and the device driver corresponding to the USB device to be redirected is installed on the cloud desktop to complete the redirection of the USB device to be redirected.
  • the cloud desktop After the redirect is completed, the cloud desktop returns the redirect result to the terminal, and communicates with the terminal for data transmission.
  • the cloud desktop can cancel the redirection function of the USB device on the cloud desktop according to the USB device to be redirected, and the cloud desktop completes the corresponding redirection processing of the USB device to be redirected according to the device information structure, and can be redirected according to the USB to be redirected.
  • the type of device is specifically set.
  • the USB device redirection method determines the USB device to be redirected according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub; the USB device to be redirected
  • the corresponding device information structure is sent to the cloud desktop, so that the cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure. That is, in the USB device redirection process, the USB device to be redirected can be determined by the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, and the determined to be redirected
  • the USB device performs a redirection operation.
  • the terminal when performing USB device redirection, the terminal needs to locally install the device driver corresponding to each USB device to determine the manner in which the USB device to be redirected is redirected, thereby reducing the storage pressure of the terminal and making The redirection process is simple and improves the user experience.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • the USB device redirection system includes a cloud desktop and a terminal, where the cloud desktop generally includes a client service program, an application, a device driver, and a virtual bus.
  • Terminals typically include Terminal Services programs, unified device drivers, USB physical bus drivers, and USB physical devices, as well as cloud desktop clients and fast-cut drivers.
  • the cloud desktop and the terminal establish a virtual channel through the client service program and the terminal service program, and perform redirection processing.
  • the terminal may specifically be a thin terminal.
  • this embodiment provides a method for generating a USB device list.
  • the method specifically includes:
  • Step S301 triggering a USB device list refresh operation.
  • the cloud desktop client on the terminal is provided with a USB device enumeration timer, when the USB device enumerates When the timer is triggered, the refresh operation of the USB device list is triggered; or after the terminal receives the new USB device insertion message, triggering the USB device to be triggered, that is, triggering the refresh operation of the USB device list.
  • step S302 the USB device physical bus is opened.
  • the cloud desktop client opens the physical bus driver of the USB device on the terminal and obtains its handle; then sends a HUB acquisition message to the physical bus of the USB device to obtain the HUB information, and the HUB obtains
  • the message may be an IOCTL message; the HUB information includes a HUB serial number, and the HUB serial number is stored after the HUB serial number is obtained.
  • step S303 the HUB is enumerated.
  • the location information acquisition message is sent to each HUB according to the HUB information, and the device information of the USB device is requested.
  • the location information acquisition message may be an IOCTL message.
  • the device information of the USB device includes information such as a VID, a PID (a device instance ID, a HUB name corresponding to the USB device, and a port information corresponding to the USB device. In this manner, the device information of the USB device is obtained, and the USB device can be obtained.
  • the device information other than the location information of the device may be obtained by splicing the location information of the USB device and the port information of the USB device.
  • Step S304 obtaining a device information structure of the USB device.
  • the structure of the location information of the USB device is similar to the form of “Port_#0008.Hub_#0005”, wherein the data after “Port_#” indicates the port number of the HUB where the USB device is located, and the data after “Hub_#”. Indicates the serial number of the HUB where the USB device is located. Therefore, after obtaining the HUB information and the device information of the USB device, the location information of the USB device is obtained by splicing according to the HUB serial number in the HUB information and the port information in the device information of the USB device. Then, the location information and the VID, the PID, the device instance ID, and the name of the HUB where the USB device is located are used as the device information structure of the USB device.
  • the device driver corresponding to the USB device is not required to be installed locally in the terminal, that is, the API (Application Programming Interface) is not dependent on the USB device driver. ) function, you can get all the information of the device information structure that generates the USB device. After the device information structure is generated, the USB device to be redirected is determined according to the device information structure.
  • the API Application Programming Interface
  • Step S305 generating a USB device list display to the client.
  • the identification information such as the name of the at least one USB device is arranged to obtain a USB device list, and the USB device list is displayed to the client; the USB Each USB device name in the device list corresponds to a device information structure. Specifically, when the identifier information such as the name of the USB device in the USB device list is selected, the device information structure corresponding to the USB device is located.
  • the method for generating a USB device list does not need to locally install a device driver corresponding to each USB device inserted in the terminal, and the hub information can be obtained by enumerating the hub from the physical bus, and Obtaining the USB device information according to the hub information, generating a device information structure of the USB device, and then generating a USB device list including the device identifier of the USB device, where the device identifier of the USB device corresponds to the device information structure of each USB device.
  • the device driver corresponding to each USB device inserted in the terminal is required to be installed, and the device information generating device information structure is obtained through the series of API functions corresponding to the USB device, thereby reducing the storage pressure of the terminal.
  • the device information structure of the USB device can be conveniently obtained, and the user experience is improved.
  • this embodiment provides a specific USB device redirection method. Referring to FIG. 4, the method specifically includes:
  • Step S401 selecting a USB device name in the trigger USB device list.
  • the USB device redirection when the USB device redirection is required, select the USB device that needs to be redirected, and click the device identifier of the USB device in the USB device list, and the device identifier may specifically be a USB device name.
  • the terminal receives the user's click operation, and the cloud desktop client sends the device information structure of the USB device to the “quick-cut driver” in the client.
  • Step S402 determining a USB device to be redirected.
  • the fast-cut driver enumerates all the physical device objects created by the HUB, and sequentially requests the location information corresponding to each physical device object, and then each The location information corresponding to the physical device object is compared with the location information in the device information structure of the received USB device to determine the USB device to be redirected.
  • Step S403 the USB device to be redirected is loaded with a preset unified device driver.
  • the USB device to be redirected is subjected to software simulation insertion and removal.
  • the "quick-cut drive" HOOK handles the processing function of the PNP (Plug-and-Play) message in the HUB driver
  • the standby device is changed at the moment when the USB device to be redirected is subjected to software simulation insertion and removal.
  • the PID and VID information of the directed USB device causes the USB device to be redirected to load a unified device driver pre-installed in the terminal.
  • the unified device driver acts as a device driver for each USB device to be redirected
  • the redirection process that is, the redirection process of the USB device can be completed only by installing a unified device driver on the terminal; compared with the prior art, the device driver mode of each USB device to be redirected needs to be installed, and the terminal is reduced.
  • the storage pressure makes the redirection process simple and improves the user experience.
  • Step S404 The device information structure of the USB device to be redirected is sent to the cloud desktop, and the redirection of the USB device to be redirected is completed.
  • the device information structure of the USB device to be redirected is sent to the cloud desktop, so that the cloud desktop creates the USB corresponding to the USB device to be redirected on the cloud desktop according to the device information structure of the USB device to be redirected.
  • the device completes the redirection of the USB device to be redirected.
  • the cloud desktop returns the redirect result to the terminal, and communicates with the terminal for data transmission.
  • the USB device redirection method provided in this embodiment does not need to locally install the device driver corresponding to each USB device inserted in the terminal, and only needs to enumerate the physical device of the USB device created by the hub from the physical bus.
  • the object, the location information corresponding to the physical device object is matched with the location information of the USB device selected by the user from the USB device list, thereby determining the USB device to be redirected.
  • the device driver determines the manner of the USB device to be redirected, reduces the storage pressure of the terminal, and makes the redirection process simple and improves the user. Experience.
  • Embodiment 3 is a diagrammatic representation of Embodiment 3
  • the embodiment of the present invention provides a USB device redirection device.
  • the device includes: a USB device to be redirected determining module 51 and a device information structure transmitting module 52. Determining the USB device to be redirected from the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub; the device information structure sending module 52 is configured to configure the device information structure corresponding to the USB device to be redirected The system sends the cloud desktop to the cloud desktop, so that the cloud desktop completes the corresponding redirection processing of the USB device to be redirected according to the device information structure.
  • the location information corresponding to the device information structure corresponding to the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub may be determined to be redirected.
  • the USB device performs a redirection operation on the determined USB device to be redirected.
  • the determined USB device to be redirected may be a USB device that needs to be redirected by the USB device, or a USB device that needs to cancel the USB device redirection function, which may be specifically selected and set according to requirements.
  • the to-be-redirected USB device determining module is further configured to: select from the USB device list. Obtaining the location information of the USB device in the device information structure corresponding to the USB device; enumerating the hub through the physical bus to obtain location information corresponding to the physical device object created by each hub; and selecting the location information and the USB selected from the USB device list
  • the USB device corresponding to the physical device object whose location information of the device matches is used as the USB device to be redirected.
  • the USB device may be selected from the USB device list of the client, and then the device information structure corresponding to the selected USB device is obtained, and the device information structure is parsed to obtain the selection. Location information corresponding to the USB device.
  • the hub After obtaining the location information of the USB device selected from the USB device list, the hub is enumerated from the physical bus, and all the physical device objects created by each hub are acquired, and the location information corresponding to each physical device object is obtained. After acquiring the location information corresponding to the physical device object, the location information corresponding to the physical device object is compared with the location information parsed from the device information structure, and the location information is matched with the location information of the device information structure.
  • the USB device corresponding to the physical device object acts as the USB device to be redirected.
  • the function of the USB device determining module to be redirected in this embodiment can be completed by setting the specific driver.
  • the USB device redirection device further includes a device information structure generating module 53, configured to: obtain the hub information by enumerating the hub from the physical bus; The hub information acquires the USB device information; the device information structure is generated according to the hub information and the USB device information; and the device information structure includes the location information of the USB device.
  • the USB physical bus driver on the terminal can be opened by the client, and the hub is obtained by enumerating the hub from the physical bus through the USB physical bus driver, and the hub information may specifically include the hub serial number information. And then sending a device information acquisition message to each hub according to the hub information, and acquiring device information of the USB device corresponding to each hub,
  • the device information structure generating module in this embodiment is further configured to: determine hub serial number information according to the hub information; determine USB device port information according to the USB device information; and splicing the USB device port information and the hub serial number information to obtain the USB device Location information.
  • the specificity may be performed according to the hub serial number information in the hub information and the USB device port information in the USB device information. Cobble together to get the location information of the specific USB device.
  • the USB device redirection device further includes a unified device driver loading module 54.
  • the unified device driver loading module 54 is configured to: after determining the USB device to be redirected, make the USB device to be redirected. Load the default unified device driver. Specifically, after determining the USB device to be redirected, Specifically, the determined USB device to be redirected can be inserted and removed, and the device information such as the PID and the VID of the USB device to be redirected is changed, so that the USB device to be redirected loads the unified device driver pre-installed in the terminal. .
  • the device information structure sending module 52 sends the device information structure corresponding to the USB device to be redirected to the cloud desktop, so that the cloud desktop completes the corresponding redirection processing of the USB device to be redirected according to the device information structure.
  • the device information structure sending module 52 sends the device information structure corresponding to the USB device to be redirected to the cloud desktop, so that the desktop creates the USB to be redirected on the cloud desktop according to the device information structure of the USB device to be redirected.
  • the virtual USB device corresponding to the device is installed, and the device driver corresponding to the USB device to be redirected is installed on the cloud desktop to complete the redirection of the USB device to be redirected. After the redirect is completed, the cloud desktop returns the redirect result to the terminal, and communicates with the terminal for data transmission.
  • the USB device redirection device determines the USB device to be redirected according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub; the USB device to be redirected
  • the corresponding device information structure is sent to the cloud desktop, so that the cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure. That is, the location information corresponding to the device information structure and the location information corresponding to the physical device object created from the USB device list and the location information corresponding to the physical device object created by the hub can be determined to be redirected during the USB device redirection process.
  • the USB device performs a redirection operation on the determined USB device to be redirected.
  • the terminal when performing USB device redirection, the terminal needs to locally install the device driver corresponding to each USB device to determine the manner in which the USB device to be redirected is redirected, thereby reducing the storage pressure of the terminal and making The redirection process is simple and improves the user experience.
  • modules or steps of the above embodiments of the present invention can be implemented by a general computing device, which can be concentrated on a single computing device or distributed among multiple computing devices.
  • they may be implemented by program code executable by the computing device, such that they may be stored in a computer storage medium (ROM/RAM, disk, optical disk) by a computing device, and at some
  • the steps shown or described may be performed in an order different than that herein, or they may be separately fabricated into individual integrated circuit modules, or a plurality of modules or steps may be fabricated into a single integrated circuit module. . Therefore, the invention is not limited to any particular combination of hardware and software.
  • a USB device redirection method, apparatus, and computer storage medium determine a USB device to be redirected by using location information of a USB device selected from a USB device list and location information corresponding to a physical device object created by a hub;
  • the device information structure corresponding to the USB device to be redirected is sent to the cloud desktop, so that the cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure.
  • the USB device to be redirected can be determined by the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, and the determined to be redirected
  • the USB device performs a redirection operation.
  • the terminal needs to locally install the device driver corresponding to each USB device to determine the manner in which the USB device to be redirected is redirected, thereby reducing the storage pressure of the terminal and making The redirection process is simple and improves the user experience.

Abstract

A method, a device, and a computer storage medium for USB device redirection are provided. The method comprises: determining, according to location information of a USB device selected from a USB device list and location information corresponding to a physical device object established by a hub, a USB device to be redirected (S101); and transmitting a device information structure corresponding to the USB device to be redirected to a cloud desktop, such that the cloud desktop completes, according to the device information structure, a corresponding redirection process of the USB device to be redirected (S102). In other words, during the USB device redirection process, the USB device to be redirected can be determined according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object established by the hub, and the redirection operation is performed on the determined USB device to be redirected. In contrast with the prior art in which the terminal needs to locally install a device driver respectively corresponding to an inserted USB device in order to determine the USB device to be redirected so as to perform a redirection, the storage burden of the terminal is reduced, the redirection process is simplified, and user experience is improved.

Description

一种USB设备重定向方法和装置和计算机存储介质USB device redirection method and device and computer storage medium 技术领域Technical field
本公开涉及通信领域,尤其涉及一种USB设备重定向方法和装置和计算机存储介质。The present disclosure relates to the field of communications, and in particular, to a USB device redirection method and apparatus, and a computer storage medium.
背景技术Background technique
USB(Universal Serial Bus,通用串行总线)设备重定向提供一种端到端的接入方案,将物理终端上的USB外设映射到云桌面中,即USB设备重定向是一种在云桌面环境下提供物理终端上的USB设备使用功能的技术。USB设备重定向将云桌面中应用程序的所有I/O请求通过网络转发给物理终端的USB外设,这样对云桌面中的USB设备驱动及应用程序来说,并不会感知到所控制的USB设备实际上在远端,使得云桌面环境的用户对USB设备的使用体验更接近物理机。并且通过在云桌面与物理终端之间建立完整的控制链路来自动或手动实现重定向功能,使得USB外设的使用方式更加灵活,便捷。当前在建立及取消USB设备重定向功能时,都需要在终端本地安装各插入USB设备的驱动,以确定待进行重定向操作的USB设备。但是在实际使用时,用户只在云桌面中使用该重定向的USB设备,所以只需要在云桌面中安装该重定向的USB设备的设备驱动即可,在终端本地安装各插入USB设备的设备驱动,不仅增加了终端的存储压力,而且在终端多次安装USB设备的设备驱动,使得用户操作繁琐,影响用户体验。USB (Universal Serial Bus) device redirection provides an end-to-end access solution that maps USB peripherals on physical terminals to cloud desktops, ie USB device redirection is a cloud desktop environment A technology that provides functions for USB devices on a physical terminal. USB device redirection forwards all I/O requests of applications in the cloud desktop to the USB peripherals of the physical terminal through the network, so that the USB device drivers and applications in the cloud desktop do not perceive the controlled The USB device is actually remote, making the user experience of the USB device in the cloud desktop environment closer to the physical machine. And the redirection function is automatically or manually implemented by establishing a complete control link between the cloud desktop and the physical terminal, so that the use of the USB peripheral is more flexible and convenient. Currently, when establishing and canceling the USB device redirection function, it is necessary to locally install each USB device driver to determine the USB device to be redirected. However, in actual use, the user only uses the redirected USB device in the cloud desktop, so it is only necessary to install the device driver of the redirected USB device in the cloud desktop, and install each device that inserts the USB device locally in the terminal. The driver not only increases the storage pressure of the terminal, but also installs the device driver of the USB device multiple times in the terminal, which makes the user operation cumbersome and affects the user experience.
发明内容Summary of the invention
本发明实施例提供一种USB设备重定向方法和装置,主要解决的技术问题是当前在进行USB设备重定向时,需要终端本地安装各插入USB设备的设备驱动,使得终端存储压力大,用户体验不好的问题。The embodiment of the invention provides a USB device redirection method and device. The main technical problem is that when the USB device is redirected, the terminal needs to locally install the device driver inserted into the USB device, so that the terminal has high storage pressure and user experience. Bad question.
本发明实施例提供一种USB设备重定向方法,包括:The embodiment of the invention provides a USB device redirection method, including:
根据从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备;Determining the USB device to be redirected according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub;
将待重定向USB设备对应的设备信息结构体发送给云桌面,使云桌面根据设备 信息结构体完成待重定向USB设备的相应重定向处理。Send the device information structure corresponding to the USB device to be redirected to the cloud desktop, so that the cloud desktop is based on the device. The information structure completes the corresponding redirection process of the USB device to be redirected.
本发明实施例还提供一种USB设备重定向装置,包括:The embodiment of the invention further provides a USB device redirection device, comprising:
待重定向USB设备确定模块,用于根据从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备;a USB device determining module to be used for determining a USB device to be redirected according to location information of the USB device selected from the USB device list and location information corresponding to the physical device object created by the hub;
设备信息结构体发送模块,用于将待重定向USB设备对应的设备信息结构体发送给云桌面,使云桌面根据设备信息结构体完成待重定向USB设备的相应重定向处理。The device information structure sending module is configured to send the device information structure corresponding to the USB device to be redirected to the cloud desktop, so that the cloud desktop completes the corresponding redirection processing of the USB device to be redirected according to the device information structure.
本发明实施例还提供一种计算机存储介质,计算机存储介质中存储有计算机可执行指令,计算机可执行指令用于执行前述的任一项的USB设备重定向方法。The embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the USB device redirection method according to any one of the foregoing.
本发明实施例的有益效果是:The beneficial effects of the embodiments of the present invention are:
根据本发明实施例提供的USB设备重定向方法、装置以及计算机存储介质,通过从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备;将待重定向USB设备对应的设备信息结构体发送给云桌面,使得云桌面根据设备信息结构体完成待重定向USB设备的相应重定向处理。即在USB设备重定向过程中通过从USB设备列表中选择的USB设备的位置信息和根据集线器创建的物理设备对象对应的位置信息就可以确定待重定向USB设备,并对确定的该待重定向USB设备进行重定向操作。相比现有技术中在进行USB设备重定向时,需要终端本地安装各插入USB设备对应的设备驱动,以确定待重定向USB设备进行重定向的方式,减小了终端的存储压力,且使重定向过程变得简单,提高了用户体验。According to an embodiment of the present invention, a USB device redirection method, apparatus, and computer storage medium determine a USB device to be redirected by using location information of a USB device selected from a USB device list and location information corresponding to a physical device object created by a hub; The device information structure corresponding to the USB device to be redirected is sent to the cloud desktop, so that the cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure. That is, in the USB device redirection process, the USB device to be redirected can be determined by the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, and the determined to be redirected The USB device performs a redirection operation. Compared with the prior art, when performing USB device redirection, the terminal needs to locally install the device driver corresponding to each USB device to determine the manner in which the USB device to be redirected is redirected, thereby reducing the storage pressure of the terminal and making The redirection process is simple and improves the user experience.
附图说明DRAWINGS
图1为本发明实施例一的USB设备重定向方法流程图;1 is a flowchart of a USB device redirection method according to Embodiment 1 of the present invention;
图2为本发明实施例二的USB设备重定向系统示意图;2 is a schematic diagram of a USB device redirection system according to Embodiment 2 of the present invention;
图3为本发明实施例二的USB列表生成方法流程图;3 is a flowchart of a method for generating a USB list according to Embodiment 2 of the present invention;
图4为本发明实施例二的USB设备重定向方法流程图;4 is a flowchart of a USB device redirection method according to Embodiment 2 of the present invention;
图5为本发明实施例三的USB设备重定向装置示意图;5 is a schematic diagram of a USB device redirection device according to Embodiment 3 of the present invention;
图6为本发明实施例三的另一USB设备重定向装置示意图。 FIG. 6 is a schematic diagram of another USB device redirection device according to Embodiment 3 of the present invention.
具体实施方式detailed description
下面通过具体实施方式结合附图对本发明实施例作进一步详细说明。The embodiments of the present invention are further described in detail below with reference to the accompanying drawings.
实施例一:Embodiment 1:
本实施例提供一种USB设备重定向方法,请参见图1,具体包括:This embodiment provides a USB device redirection method. Referring to FIG. 1, the method specifically includes:
步骤S101,根据从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备;Step S101: Determine, according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, the USB device to be redirected;
步骤S102,将待重定向USB设备对应的设备信息结构体发送给云桌面,使云桌面根据设备信息结构体完成待重定向USB设备的相应重定向处理。Step S102: The device information structure corresponding to the USB device to be redirected is sent to the cloud desktop, so that the cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure.
具体的,在进行USB设备重定向的过程中通过将从USB设备列表中选择的USB设备对应的设备信息结构体对应的位置信息和与集线器创建的物理设备对象对应的位置信息进行对比匹配,就可以确定待重定向USB设备,然后对确定的该待重定向USB设备进行重定向操作。另外,本实施例中,确定的待重定向USB设备可以是需要进行USB设备重定向创建的USB设备,也可以是需要取消USB设备重定向功能的USB设备,其可以根据需要具体选择和设置。Specifically, in the process of performing USB device redirection, the location information corresponding to the device information structure corresponding to the USB device selected from the USB device list is compared and matched with the location information corresponding to the physical device object created by the hub, The USB device to be redirected can be determined, and then the determined redirected USB device is redirected. In addition, in this embodiment, the determined USB device to be redirected may be a USB device that needs to be redirected by the USB device, or a USB device that needs to cancel the USB device redirection function, which may be specifically selected and set according to requirements.
对于步骤S101,根据从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备,包括:从USB设备列表中选择的USB设备对应的设备信息结构体中获取该USB设备的位置信息;通过物理总线枚举集线器,获取各集线器创建的物理设备对象对应的位置信息;将位置信息与该从USB设备列表中选择的USB设备的位置信息相匹配的物理设备对象对应的USB设备作为待重定向USB设备。For the step S101, determining, according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, the USB device to be redirected, including: device information corresponding to the USB device selected from the USB device list. Obtaining location information of the USB device in the structure; enumerating the hub through the physical bus, acquiring location information corresponding to the physical device object created by each hub; matching the location information with the location information of the USB device selected from the USB device list The USB device corresponding to the physical device object acts as the USB device to be redirected.
具体的,在进行USB设备重定向时,可以从客户端的USB设备列表中根据需要选择USB设备,然后获取该选择的USB设备对应的设备信息结构体,对该设备信息结构体进行解析得到该选择的USB设备对应的位置信息。本实施例中,从客户端的USB设备列表中根据需要选择USB设备,可以是用户手动选择USB设备,如在客户端进行重定向设置的显示页面显示的USB设备列表中根据需要对USB设备列表中的USB设备标识进行点击等触发操作,进行USB设备选择;也可以设置USB设备选择触发指令,由系统根据该USB设备选择触发指令中的USB设备标识信息自动选择对应的USB设备;该USB设备标识具体可以是USB设备的名称等可以标识USB设备的信息。在得到从USB设备列表中选择的USB设备的位置信息后,从物理总线枚举 集线器(HUB),获取各集线器创建的USB设备的所有物理设备对象,然后获取各物理设备对象对应的位置信息。获取物理设备对象对应的位置信息具体可以是向物理设备对象对应的物理设备发送位置信息获取消息,获取物理设备对象对应的位置信息。在获取到物理设备对象对应的位置信息后,将物理设备对象对应的位置信息与从设备信息结构体中解析出的位置信息进行对比,将位置信息与该设备信息结构体的位置信息匹配的物理设备对象对应的USB设备作为待重定向USB设备。该物理设备对象对应的位置信息即为该物理设备对象对应的物理设备的位置信息,如该物理设备对象对应的USB设备的位置信息。即本实施例中,不需要在终端安装各集线器创建的USB设备对应的设备驱动以确定待重定向USB设备,只需要通过从物理总线枚举各集线器创建的USB设备的所有物理设备对象,获取该物理设备对象的位置信息与选择的USB设备的设备信息结构体对应的位置信息进行匹配,即可确定待重定向USB设备。Specifically, when performing USB device redirection, the USB device may be selected from the USB device list of the client, and then the device information structure corresponding to the selected USB device is obtained, and the device information structure is parsed to obtain the selection. Location information corresponding to the USB device. In this embodiment, the USB device is selected according to the needs of the USB device list of the client, and the user may manually select the USB device, such as in the USB device list displayed on the display page of the redirect setting of the client. The USB device identifier performs a trigger operation such as clicking, and performs USB device selection; the USB device selection trigger command may also be set, and the system automatically selects the corresponding USB device according to the USB device identification information in the USB device selection trigger command; the USB device identifier Specifically, it may be a name of the USB device or the like that can identify the information of the USB device. Enumerate from the physical bus after getting the location information of the USB device selected from the USB device list A hub (HUB) acquires all physical device objects of USB devices created by each hub, and then acquires location information corresponding to each physical device object. The obtaining the location information corresponding to the physical device object may be: sending the location information acquisition message to the physical device corresponding to the physical device object, and acquiring the location information corresponding to the physical device object. After acquiring the location information corresponding to the physical device object, comparing the location information corresponding to the physical device object with the location information parsed from the device information structure, and matching the location information with the location information of the device information structure The USB device corresponding to the device object acts as the USB device to be redirected. The location information corresponding to the physical device object is the location information of the physical device corresponding to the physical device object, such as the location information of the USB device corresponding to the physical device object. That is, in this embodiment, it is not necessary to install the device driver corresponding to the USB device created by each hub in the terminal to determine the USB device to be redirected, and only need to enumerate all the physical device objects of the USB device created by each hub from the physical bus. The location information of the physical device object is matched with the location information corresponding to the device information structure of the selected USB device, and the USB device to be redirected can be determined.
另外,本实施例中,该根据从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备的处理操作,具体可以在客户端设置具体的驱动进行处理,该驱动具体可以命名为“快切驱动”。In addition, in this embodiment, the processing operation of the USB device to be redirected is determined according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, and specifically, the specific setting may be set on the client. The driver performs processing, and the driver can be specifically named "quick-cut driver".
本实施例中,USB设备列表的生成过程具体包括:枚举终端集线器创建的所有USB设备,并得到各USB设备对应的设备信息结构体,然后,生成包含各USB设备对应的USB设备标识与USB设备的设备信息结构体对应关系的USB设备列表,存储在客户端,具体的还可以将该USB设备列表显示在如客户端的USB设备重定向设置界面等显示界面上。In this embodiment, the process of generating the USB device list specifically includes: enumerating all the USB devices created by the terminal hub, and obtaining the device information structure corresponding to each USB device, and then generating the USB device identifier and USB corresponding to each USB device. The USB device list corresponding to the device information structure of the device is stored in the client. Specifically, the USB device list may be displayed on a display interface such as a USB device redirection setting interface of the client.
进一步的,本实施例中,USB设备的设备信息结构体的生成方式包括:通过从物理总线枚举集线器,获取集线器信息;根据集线器信息获取USB设备信息;根据集线器信息和USB设备信息生成设备信息结构体;设备信息结构体包括USB设备的位置信息。Further, in this embodiment, the device information structure of the USB device is generated by: collecting hub information by enumerating a hub from the physical bus; acquiring USB device information according to the hub information; and generating device information according to the hub information and the USB device information. The structure; the device information structure includes location information of the USB device.
具体的,可以由客户端打开终端上的USB物理总线驱动,通过该USB物理总线驱动从物理总线枚举集线器,获取集线器信息,该集线器信息具体可以包括集线器序号信息。然后根据该集线器信息,向每个集线器发送设备信息获取消息,获取各集线器对应的USB设备的设备信息,该设备信息具体包括USB设备的VID(Vendor ID,生产厂商ID)、PID(Product ID,产品ID)、设备实例ID及对应的HUB名称和USB 设备对应的端口信息等信息。然后根据该集线器信息和设备信息得到USB设备的设备信息结构体。Specifically, the USB physical bus driver on the terminal can be opened by the client, and the hub is obtained by enumerating the hub from the physical bus through the USB physical bus driver, and the hub information may specifically include the hub serial number information. And then, according to the hub information, sending a device information acquisition message to each hub, and acquiring device information of the USB device corresponding to each hub, where the device information specifically includes a VID (Vendor ID, manufacturer ID) and a PID (Product ID,) of the USB device. Product ID), device instance ID and corresponding HUB name and USB Information about the port information corresponding to the device. Then, the device information structure of the USB device is obtained according to the hub information and the device information.
进一步的,本实施例中在获取USB设备的设备信息时,是无法直接获取到USB设备的位置信息的,该设备信息结构体中的USB设备的位置信息的生成方式包括:根据集线器信息确定集线器序号信息;根据USB设备信息确定USB设备端口信息;将USB设备端口信息和集线器序号信息进行拼接得到USB设备的位置信息。具体的,可以根据获取到的集线器信息中的集线器序号信息和USB设备信息中的USB设备端口信息进行拼凑,得到具体的USB设备的位置信息。Further, in the embodiment, when the device information of the USB device is acquired, the location information of the USB device cannot be directly obtained, and the location information of the USB device in the device information structure is generated by: determining the hub according to the hub information. Serial number information; determining the USB device port information according to the USB device information; splicing the USB device port information and the hub serial number information to obtain the location information of the USB device. Specifically, the device can be patched according to the hub serial number information in the obtained hub information and the USB device port information in the USB device information, to obtain the location information of the specific USB device.
本实施例中,生成USB设备列表时,具体可以是根据用户的USB设备列表设置操作,生成USB设备列表;也可以是在满足USB设备列表生成条件时,自动生成该USB设备列表。其中,在满足USB设备列表生成条件时,自动生成USB设备列表,具体可以是在终端有新的USB设备插入时,触发USB设备列表生成操作,生成新的USB设备列表;也可以设置USB设备枚举定时器,在该USB设备枚举定时器触发时,定时生成新的USB设备列表。进一步的,生成新的USB设备列表后,可以用该新的USB设备列表替换客户端之前存储的USB设备列表,并显示在客户端上指定的显示界面上。In this embodiment, when the USB device list is generated, the USB device list may be generated according to the USB device list setting operation of the user, or the USB device list may be automatically generated when the USB device list generation condition is met. When the USB device list generation condition is met, the USB device list is automatically generated. Specifically, when the terminal has a new USB device inserted, the USB device list generation operation is triggered to generate a new USB device list; and the USB device device may also be set. A timer is generated to periodically generate a new list of USB devices when the USB device enumeration timer is triggered. Further, after generating a new USB device list, the new USB device list can be replaced with the USB device list stored by the client and displayed on the display interface specified on the client.
进一步的,本实施例中,确定待重定向USB设备之后,还包括:使待重定向USB设备加载预设的统一设备驱动。具体的,在确定待重定向USB设备之后,具体可以对该确定的待重定向USB设备进行模拟插拔,并更改该待重定向USB设备的设备信息,如更改USB设备的PID和VID信息,使得该待重定向USB设备加载预先安装在终端中的统一设备驱动。该统一设备驱动具体可以是更改后的设备信息对应的设备驱动。该统一设备驱动安装在终端本地,充当各待重定向USB设备对应的设备驱动,使得各待重定向USB设备根据该统一设备驱动进行重定向处理,而不需要每次安装各待重定向USB设备对应的设备驱动。另外,当该待重定向USB设备是当前重定向系统中需要进行重定向的第一个USB设备时,也可以在去确定其为待重定向USB设备后,实时安装该统一设备驱动,并加载该统一设备驱动,进行重定向处理。使用该统一设备驱动作为各待重定向USB设备对应的设备驱动,可以减小终端的存储压力,且提高了云桌面中USB设备使用的便捷性和通用性。Further, in this embodiment, after determining the USB device to be redirected, the method further includes: loading the USB device to be redirected by a preset unified device driver. Specifically, after the USB device to be redirected is determined, the determined USB device to be redirected may be manually inserted and removed, and the device information of the USB device to be redirected is changed, for example, the PID and VID information of the USB device are changed. The USB device to be redirected is loaded with a unified device driver pre-installed in the terminal. The unified device driver may specifically be a device driver corresponding to the changed device information. The unified device driver is installed locally on the terminal and serves as a device driver corresponding to each USB device to be redirected, so that each USB device to be redirected is redirected according to the unified device driver, and does not need to install each USB device to be redirected each time. Corresponding device driver. In addition, when the USB device to be redirected is the first USB device that needs to be redirected in the current redirecting system, the unified device driver may be installed and loaded in real time after determining that it is the USB device to be redirected. The unified device driver is used for redirection processing. By using the unified device driver as the device driver corresponding to each USB device to be redirected, the storage pressure of the terminal can be reduced, and the convenience and versatility of using the USB device in the cloud desktop is improved.
对于步骤S102,将待重定向USB设备对应的设备信息结构体发送给云桌面,使 云桌面根据设备信息结构体完成待重定向USB设备的相应重定向处理。具体包括将待重定向USB设备对应的设备信息结构体发送给云桌面,使桌面根据该待重定向USB设备的设备信息结构体在云桌面创建该待重定向的USB设备对应的虚拟USB设备,将该虚拟USB设备安装在云桌面的虚拟总线行,并在云桌面安装该待重定向USB设备对应的设备驱动,完成该待重定向的USB设备的重定向。在完成重定向后,云桌面向终端返回重定向结果,并与该终端进行通信连接,进行数据传输。或者也可以使云桌面根据该待重定向USB设备取消云桌面端的USB设备的重定向功能,云桌面根据设备信息结构体完成待重定向USB设备的相应重定向处理,可以根据该待重定向USB设备的类型具体设置。In step S102, the device information structure corresponding to the USB device to be redirected is sent to the cloud desktop, so that The cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure. Specifically, the device information structure corresponding to the USB device to be redirected is sent to the cloud desktop, and the desktop creates the virtual USB device corresponding to the USB device to be redirected on the cloud desktop according to the device information structure of the USB device to be redirected. The virtual USB device is installed on the virtual bus line of the cloud desktop, and the device driver corresponding to the USB device to be redirected is installed on the cloud desktop to complete the redirection of the USB device to be redirected. After the redirect is completed, the cloud desktop returns the redirect result to the terminal, and communicates with the terminal for data transmission. Alternatively, the cloud desktop can cancel the redirection function of the USB device on the cloud desktop according to the USB device to be redirected, and the cloud desktop completes the corresponding redirection processing of the USB device to be redirected according to the device information structure, and can be redirected according to the USB to be redirected. The type of device is specifically set.
本发明实施例提供的USB设备重定向方法,通过根据从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备;将待重定向USB设备对应的设备信息结构体发送给云桌面,使得云桌面根据设备信息结构体完成待重定向USB设备的相应重定向处理。即在USB设备重定向过程中通过从USB设备列表中选择的USB设备的位置信息和根据集线器创建的物理设备对象对应的位置信息就可以确定待重定向USB设备,并对确定的该待重定向USB设备进行重定向操作。相比现有技术中在进行USB设备重定向时,需要终端本地安装各插入USB设备对应的设备驱动,以确定待重定向USB设备进行重定向的方式,减小了终端的存储压力,且使重定向过程变得简单,提高了用户体验。The USB device redirection method provided by the embodiment of the present invention determines the USB device to be redirected according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub; the USB device to be redirected The corresponding device information structure is sent to the cloud desktop, so that the cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure. That is, in the USB device redirection process, the USB device to be redirected can be determined by the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, and the determined to be redirected The USB device performs a redirection operation. Compared with the prior art, when performing USB device redirection, the terminal needs to locally install the device driver corresponding to each USB device to determine the manner in which the USB device to be redirected is redirected, thereby reducing the storage pressure of the terminal and making The redirection process is simple and improves the user experience.
实施例二:Embodiment 2:
本实施例提供一种具体的USB设备重定向系统,请参见图2,该USB设备重定向系统包括云桌面和终端,其中云桌面通常包括客户端服务程序,应用程序,设备驱动和虚拟总线;终端通常包括终端服务程序,统一设备驱动,USB物理总线驱动和USB物理设备,还包括云桌面客户端和快切驱动。该云桌面与终端通过客户端服务程序和终端服务程序建立虚拟通道,进行重定向处理。另外,该终端具体可以是瘦终端。This embodiment provides a specific USB device redirection system. Referring to FIG. 2, the USB device redirection system includes a cloud desktop and a terminal, where the cloud desktop generally includes a client service program, an application, a device driver, and a virtual bus. Terminals typically include Terminal Services programs, unified device drivers, USB physical bus drivers, and USB physical devices, as well as cloud desktop clients and fast-cut drivers. The cloud desktop and the terminal establish a virtual channel through the client service program and the terminal service program, and perform redirection processing. In addition, the terminal may specifically be a thin terminal.
基于前述USB设备重定向系统,本实施例提供一种USB设备列表的生成方法,请参见图3,具体包括:Based on the foregoing USB device redirection system, this embodiment provides a method for generating a USB device list. Referring to FIG. 3, the method specifically includes:
步骤S301,触发USB设备列表刷新操作。Step S301, triggering a USB device list refresh operation.
具体的,终端上云桌面客户端设置有USB设备枚举定时器,当该USB设备枚举 定时器触发时,即触发该USB设备列表的刷新操作;或者终端收到新USB设备插入消息后,触发USB设备的枚举行为,即触发该USB设备列表的刷新操作。Specifically, the cloud desktop client on the terminal is provided with a USB device enumeration timer, when the USB device enumerates When the timer is triggered, the refresh operation of the USB device list is triggered; or after the terminal receives the new USB device insertion message, triggering the USB device to be triggered, that is, triggering the refresh operation of the USB device list.
步骤S302,打开USB设备物理总线。In step S302, the USB device physical bus is opened.
具体的,触发USB设备列表刷新操作后,云桌面客户端打开终端上USB设备的物理总线驱动,并获取其句柄;然后向该USB设备的物理总线发送HUB获取消息,获取HUB信息,该HUB获取消息具体可以是IOCTL消息;该HUB信息包括HUB序号,获取到HUB序号后存储该HUB序号。Specifically, after triggering the USB device list refresh operation, the cloud desktop client opens the physical bus driver of the USB device on the terminal and obtains its handle; then sends a HUB acquisition message to the physical bus of the USB device to obtain the HUB information, and the HUB obtains The message may be an IOCTL message; the HUB information includes a HUB serial number, and the HUB serial number is stored after the HUB serial number is obtained.
步骤S303,枚举HUB。In step S303, the HUB is enumerated.
具体的,在得到HUB信息后,根据该HUB信息依次向每个HUB发送位置信息获取消息,请求USB设备的设备信息;该位置信息获取消息具体可以是IOCTL消息。另外,该USB设备的设备信息包括VID、PID(、设备实例ID、USB设备对应的HUB名称和USB设备对应的端口信息等信息。通过这种方式获取USB设备的设备信息,可以获取到除USB设备的位置信息外的其他设备信息,该USB设备的位置信息具体可以通过HUB序号和USB设备的端口信息进行拼接得到。Specifically, after the HUB information is obtained, the location information acquisition message is sent to each HUB according to the HUB information, and the device information of the USB device is requested. The location information acquisition message may be an IOCTL message. In addition, the device information of the USB device includes information such as a VID, a PID (a device instance ID, a HUB name corresponding to the USB device, and a port information corresponding to the USB device. In this manner, the device information of the USB device is obtained, and the USB device can be obtained. The device information other than the location information of the device may be obtained by splicing the location information of the USB device and the port information of the USB device.
步骤S304,得到USB设备的设备信息结构体。Step S304, obtaining a device information structure of the USB device.
具体的,由于USB设备的位置信息的结构具体类似于“Port_#0008.Hub_#0005”的形式,其中“Port_#”后的数据表示USB设备所在HUB的端口号,“Hub_#”后的数据表示USB设备所在HUB的序号。所以,在得到HUB信息和USB设备的设备信息后,根据该HUB信息中的HUB序号和USB设备的设备信息中的端口信息进行拼接得到USB设备的位置信息。然后将该位置信息与VID、PID、设备实例ID、及USB设备所在HUB的名称等信息作为该USB设备的设备信息结构体。本实施例中,在生成USB设备的设备信息结构体的过程中,不需要在终端本地安装该USB设备对应的设备驱动,即不依赖该USB设备驱动的API(Application Programming Interface,应用程序编程接口)函数,就可以获取生成该USB设备的设备信息结构体的所有信息。在生成该设备信息结构体后,后续根据该设备信息结构体确定待重定向USB设备。Specifically, the structure of the location information of the USB device is similar to the form of “Port_#0008.Hub_#0005”, wherein the data after “Port_#” indicates the port number of the HUB where the USB device is located, and the data after “Hub_#”. Indicates the serial number of the HUB where the USB device is located. Therefore, after obtaining the HUB information and the device information of the USB device, the location information of the USB device is obtained by splicing according to the HUB serial number in the HUB information and the port information in the device information of the USB device. Then, the location information and the VID, the PID, the device instance ID, and the name of the HUB where the USB device is located are used as the device information structure of the USB device. In this embodiment, in the process of generating the device information structure of the USB device, the device driver corresponding to the USB device is not required to be installed locally in the terminal, that is, the API (Application Programming Interface) is not dependent on the USB device driver. ) function, you can get all the information of the device information structure that generates the USB device. After the device information structure is generated, the USB device to be redirected is determined according to the device information structure.
步骤S305,生成USB设备列表显示到客户端。Step S305, generating a USB device list display to the client.
具体的,在生成USB设备的设备信息结构体后,将至少一个USB设备的名称等标识信息进行排列得到USB设备列表,将该USB设备列表显示到客户端;该USB 设备列表中的各USB设备名称对应一个设备信息结构体。具体的,当选择触发该USB设备列表中的USB设备的名称等标识信息时,会定位到该USB设备对应的设备信息结构体。Specifically, after generating the device information structure of the USB device, the identification information such as the name of the at least one USB device is arranged to obtain a USB device list, and the USB device list is displayed to the client; the USB Each USB device name in the device list corresponds to a device information structure. Specifically, when the identifier information such as the name of the USB device in the USB device list is selected, the device information structure corresponding to the USB device is located.
本实施例提供的USB设备列表的生成方法,在生成USB设备列表时,不需要在终端本地安装各插入USB设备对应的设备驱动,通过从物理总线枚举集线器,即可以获取到集线器信息,并根据该集线器信息获取到USB设备信息,生成USB设备的设备信息结构体,然后生成包含USB设备的设备标识的USB设备列表,该USB设备的设备标识对应各USB设备的设备信息结构体。相比于现有技术中需要在终端安装各插入USB设备对应的设备驱动,通过该USB设备对应驱动的系列API函数来获取设备信息生成设备信息结构体的方式,减小了终端的存储压力,可以方便的得到USB设备的设备信息结构体,提高了用户体验。The method for generating a USB device list provided by this embodiment does not need to locally install a device driver corresponding to each USB device inserted in the terminal, and the hub information can be obtained by enumerating the hub from the physical bus, and Obtaining the USB device information according to the hub information, generating a device information structure of the USB device, and then generating a USB device list including the device identifier of the USB device, where the device identifier of the USB device corresponds to the device information structure of each USB device. Compared with the prior art, the device driver corresponding to each USB device inserted in the terminal is required to be installed, and the device information generating device information structure is obtained through the series of API functions corresponding to the USB device, thereby reducing the storage pressure of the terminal. The device information structure of the USB device can be conveniently obtained, and the user experience is improved.
基于前述USB设备重定向系统,本实施例该提供一种具体的USB设备重定向方法,请参见图4,具体包括:Based on the foregoing USB device redirection system, this embodiment provides a specific USB device redirection method. Referring to FIG. 4, the method specifically includes:
步骤S401,选择触发USB设备列表中的一个USB设备名称。Step S401, selecting a USB device name in the trigger USB device list.
具体的,当需要进行USB设备重定向时,选择需要进行重定向的USB设备,并点击USB设备列表中该USB设备的设备标识,该设备标识具体可以是USB设备名称。在用户点击USB设备名称后,终端接收用户的点击操作,由云桌面客户端将该USB设备的设备信息结构体发送给客户端中的“快切驱动”。Specifically, when the USB device redirection is required, select the USB device that needs to be redirected, and click the device identifier of the USB device in the USB device list, and the device identifier may specifically be a USB device name. After the user clicks on the USB device name, the terminal receives the user's click operation, and the cloud desktop client sends the device information structure of the USB device to the “quick-cut driver” in the client.
步骤S402,确定待重定向的USB设备。Step S402, determining a USB device to be redirected.
具体的,“快切驱动”接收到云桌面客户端发送的USB设备的设备信息结构体后,枚举HUB创建的所有物理设备对象,并依次请求各物理设备对象对应的位置信息,然后将各物理设备对象对应的位置信息与接收到的USB设备的设备信息结构体中的位置信息进行对比,以确定待重定向USB设备。Specifically, after receiving the device information structure of the USB device sent by the cloud desktop client, the fast-cut driver enumerates all the physical device objects created by the HUB, and sequentially requests the location information corresponding to each physical device object, and then each The location information corresponding to the physical device object is compared with the location information in the device information structure of the received USB device to determine the USB device to be redirected.
步骤S403,使该待重定向USB设备加载预设的统一设备驱动。Step S403, the USB device to be redirected is loaded with a preset unified device driver.
具体的,确定待重定向USB设备后,对该待重定向USB设备进行软件模拟拔插。另外,由于“快切驱动”HOOK了HUB驱动中PNP(Plug-and-Play,即插即用)消息的处理函数,所以在待重定向USB设备进行软件模拟拔插的瞬间,改变该待重定向的USB设备的PID和VID信息,使得该待重定向的USB设备加载预先安装在终端里的统一设备驱动。该统一设备驱动充当每个待重定向USB设备的设备驱动参与 重定向过程,即只在终端安装一个统一设备驱动,就可以完成USB设备的重定向处理;相比于现有技术中,需要安装各个待重定向USB设备的设备驱动的方式,减小了终端的存储压力,且使得重定向过程变得简单,提高了用户体验。Specifically, after the USB device to be redirected is determined, the USB device to be redirected is subjected to software simulation insertion and removal. In addition, since the "quick-cut drive" HOOK handles the processing function of the PNP (Plug-and-Play) message in the HUB driver, the standby device is changed at the moment when the USB device to be redirected is subjected to software simulation insertion and removal. The PID and VID information of the directed USB device causes the USB device to be redirected to load a unified device driver pre-installed in the terminal. The unified device driver acts as a device driver for each USB device to be redirected The redirection process, that is, the redirection process of the USB device can be completed only by installing a unified device driver on the terminal; compared with the prior art, the device driver mode of each USB device to be redirected needs to be installed, and the terminal is reduced. The storage pressure makes the redirection process simple and improves the user experience.
步骤S404,将待重定向的USB设备的设备信息结构体发送给云桌面,完成该待重定向的USB设备的重定向。Step S404: The device information structure of the USB device to be redirected is sent to the cloud desktop, and the redirection of the USB device to be redirected is completed.
具体的,将待重定向的USB设备的设备信息结构体发送给云桌面,使得云桌面根据该待重定向的USB设备的设备信息结构体在云桌面创建该待重定向的USB设备对应的USB设备,完成该待重定向的USB设备的重定向。然后,在完成重定向后,云桌面向终端返回重定向结果,并与该终端进行通信连接,进行数据传输。Specifically, the device information structure of the USB device to be redirected is sent to the cloud desktop, so that the cloud desktop creates the USB corresponding to the USB device to be redirected on the cloud desktop according to the device information structure of the USB device to be redirected. The device completes the redirection of the USB device to be redirected. Then, after the redirect is completed, the cloud desktop returns the redirect result to the terminal, and communicates with the terminal for data transmission.
本实施例提供的USB设备重定向方法,在确定待重定向USB设备时,不需要在终端本地安装各插入USB设备对应的设备驱动,只需要从物理总线枚举集线器创建的USB设备的物理设备对象,获取物理设备对象对应的位置信息与用户从USB设备列表中选择的USB设备的位置信息进行匹配,从而确定待重定向USB设备。相比于需要在终端本地安装各插入USB设备对应的设备驱动,通过该设备驱动确定待重定向USB设备的方式,减小了终端的存储压力,且使重定向过程变得简单,提高了用户体验。The USB device redirection method provided in this embodiment does not need to locally install the device driver corresponding to each USB device inserted in the terminal, and only needs to enumerate the physical device of the USB device created by the hub from the physical bus. The object, the location information corresponding to the physical device object is matched with the location information of the USB device selected by the user from the USB device list, thereby determining the USB device to be redirected. Compared with the device driver corresponding to each USB device inserted in the terminal, the device driver determines the manner of the USB device to be redirected, reduces the storage pressure of the terminal, and makes the redirection process simple and improves the user. Experience.
实施例三:Embodiment 3:
本实施例提供一种USB设备重定向装置,请参见图5,具体包括:待重定向USB设备确定模块51和设备信息结构体发送模块52,其中,待重定向USB设备确定模块51用于根据从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备;设备信息结构体发送模块52用于将待重定向USB设备对应的设备信息结构体发送给云桌面,使云桌面根据设备信息结构体完成待重定向USB设备的相应重定向处理。具体的,在进行USB设备重定向的过程中通过从USB设备列表中选择的USB设备对应的设备信息结构体对应的位置信息和与集线器创建的物理设备对象对应的位置信息就可以确定待重定向USB设备,并对确定的该待重定向USB设备进行重定向操作。另外,本实施例中,确定的待重定向USB设备可以是需要进行USB设备重定向创建的USB设备,也可以是需要取消USB设备重定向功能的USB设备,其可以根据需要具体选择和设置。The embodiment of the present invention provides a USB device redirection device. Referring to FIG. 5, the device includes: a USB device to be redirected determining module 51 and a device information structure transmitting module 52. Determining the USB device to be redirected from the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub; the device information structure sending module 52 is configured to configure the device information structure corresponding to the USB device to be redirected The system sends the cloud desktop to the cloud desktop, so that the cloud desktop completes the corresponding redirection processing of the USB device to be redirected according to the device information structure. Specifically, in the process of performing USB device redirection, the location information corresponding to the device information structure corresponding to the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub may be determined to be redirected. The USB device performs a redirection operation on the determined USB device to be redirected. In addition, in this embodiment, the determined USB device to be redirected may be a USB device that needs to be redirected by the USB device, or a USB device that needs to cancel the USB device redirection function, which may be specifically selected and set according to requirements.
本实施例中,该待重定向USB设备确定模块还用于:从USB设备列表中选择的 USB设备对应的设备信息结构体中获取该USB设备的位置信息;通过物理总线枚举集线器,获取各集线器创建的物理设备对象对应的位置信息;将位置信息与该从USB设备列表中选择的USB设备的位置信息相匹配的物理设备对象对应的USB设备作为待重定向USB设备。具体的,在进行USB设备重定向时,可以从客户端的USB设备列表中根据需要选择USB设备,然后获取该选择的USB设备对应的设备信息结构体,对该设备信息结构体进行解析得到该选择的USB设备对应的位置信息。在得到从USB设备列表中选择的USB设备的位置信息后,从物理总线枚举集线器,获取各集线器创建的所有物理设备对象,并获取各物理设备对象对应的位置信息。在获取到物理设备对象对应的位置信息后,将该物理设备对象对应的位置信息与从设备信息结构体中解析出的位置信息进行对比,将位置信息与该设备信息结构体的位置信息匹配的物理设备对象对应的USB设备作为待重定向USB设备。本实施例中的待重定向USB设备确定模块的功能可以通过设置具体的驱动,由该驱动完成。In this embodiment, the to-be-redirected USB device determining module is further configured to: select from the USB device list. Obtaining the location information of the USB device in the device information structure corresponding to the USB device; enumerating the hub through the physical bus to obtain location information corresponding to the physical device object created by each hub; and selecting the location information and the USB selected from the USB device list The USB device corresponding to the physical device object whose location information of the device matches is used as the USB device to be redirected. Specifically, when performing USB device redirection, the USB device may be selected from the USB device list of the client, and then the device information structure corresponding to the selected USB device is obtained, and the device information structure is parsed to obtain the selection. Location information corresponding to the USB device. After obtaining the location information of the USB device selected from the USB device list, the hub is enumerated from the physical bus, and all the physical device objects created by each hub are acquired, and the location information corresponding to each physical device object is obtained. After acquiring the location information corresponding to the physical device object, the location information corresponding to the physical device object is compared with the location information parsed from the device information structure, and the location information is matched with the location information of the device information structure. The USB device corresponding to the physical device object acts as the USB device to be redirected. The function of the USB device determining module to be redirected in this embodiment can be completed by setting the specific driver.
请参见图6,本实施例提供的USB设备重定向装置,还包括设备信息结构体生成模块53,该设备信息结构体生成模块53用于:通过从物理总线枚举集线器,获取集线器信息;根据集线器信息获取USB设备信息;根据集线器信息和USB设备信息生成设备信息结构体;设备信息结构体包括USB设备的位置信息。具体的,可以由客户端打开终端上的USB物理总线驱动,通过该USB物理总线驱动从物理总线枚举集线器,获取集线器信息,该集线器信息具体可以包括集线器序号信息。然后根据该集线器信息,向每个集线器发送设备信息获取消息,获取各集线器对应的USB设备的设备信息,Referring to FIG. 6, the USB device redirection device provided in this embodiment further includes a device information structure generating module 53, configured to: obtain the hub information by enumerating the hub from the physical bus; The hub information acquires the USB device information; the device information structure is generated according to the hub information and the USB device information; and the device information structure includes the location information of the USB device. Specifically, the USB physical bus driver on the terminal can be opened by the client, and the hub is obtained by enumerating the hub from the physical bus through the USB physical bus driver, and the hub information may specifically include the hub serial number information. And then sending a device information acquisition message to each hub according to the hub information, and acquiring device information of the USB device corresponding to each hub,
进一步的,本实施例中的设备信息结构体生成模块还用于:根据集线器信息确定集线器序号信息;根据USB设备信息确定USB设备端口信息;将USB设备端口信息和集线器序号信息进行拼接得到USB设备的位置信息。具体的,本实施例中在获取USB设备的设备信息时,是无法直接获取到USB设备的位置信息的,其具体可以根据集线器信息中的集线器序号信息和USB设备信息中的USB设备端口信息进行拼凑,得到具体的USB设备的位置信息。Further, the device information structure generating module in this embodiment is further configured to: determine hub serial number information according to the hub information; determine USB device port information according to the USB device information; and splicing the USB device port information and the hub serial number information to obtain the USB device Location information. Specifically, in the embodiment, when the device information of the USB device is obtained, the location information of the USB device cannot be directly obtained, and the specificity may be performed according to the hub serial number information in the hub information and the USB device port information in the USB device information. Cobble together to get the location information of the specific USB device.
请参见图6,本实施例提供的USB设备重定向装置,还包括统一设备驱动加载模块54,该统一设备驱动加载模块54用于:在确定待重定向USB设备之后,使待重定向USB设备加载预设的统一设备驱动。具体的,在确定待重定向USB设备之后, 具体可以对该确定的待重定向USB设备进行模拟插拔,并更改该待重定向USB设备的如PID和VID等设备信息,使得该待重定向USB设备加载预先安装在终端中的统一设备驱动。Referring to FIG. 6, the USB device redirection device provided in this embodiment further includes a unified device driver loading module 54. The unified device driver loading module 54 is configured to: after determining the USB device to be redirected, make the USB device to be redirected. Load the default unified device driver. Specifically, after determining the USB device to be redirected, Specifically, the determined USB device to be redirected can be inserted and removed, and the device information such as the PID and the VID of the USB device to be redirected is changed, so that the USB device to be redirected loads the unified device driver pre-installed in the terminal. .
本实施例中,设备信息结构体发送模块52将待重定向USB设备对应的设备信息结构体发送给云桌面,使云桌面根据设备信息结构体完成待重定向USB设备的相应重定向处理,具体包括:设备信息结构体发送模块52将待重定向USB设备对应的设备信息结构体发送给云桌面,使桌面根据该待重定向USB设备的设备信息结构体在云桌面创建该待重定向的USB设备对应的虚拟USB设备,并在云桌面安装该待重定向USB设备对应的设备驱动,完成该待重定向的USB设备的重定向。在完成重定向后,云桌面向终端返回重定向结果,并与该终端进行通信连接,进行数据传输。In this embodiment, the device information structure sending module 52 sends the device information structure corresponding to the USB device to be redirected to the cloud desktop, so that the cloud desktop completes the corresponding redirection processing of the USB device to be redirected according to the device information structure. The device information structure sending module 52 sends the device information structure corresponding to the USB device to be redirected to the cloud desktop, so that the desktop creates the USB to be redirected on the cloud desktop according to the device information structure of the USB device to be redirected. The virtual USB device corresponding to the device is installed, and the device driver corresponding to the USB device to be redirected is installed on the cloud desktop to complete the redirection of the USB device to be redirected. After the redirect is completed, the cloud desktop returns the redirect result to the terminal, and communicates with the terminal for data transmission.
本发明实施例提供的USB设备重定向装置,通过根据从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备;将待重定向USB设备对应的设备信息结构体发送给云桌面,使得云桌面根据设备信息结构体完成待重定向USB设备的相应重定向处理。即在USB设备重定向过程中通过设备信息结构体对应的位置信息和通过从从USB设备列表中选择的USB设备的位置信息和根据集线器创建的物理设备对象对应的位置信息就可以确定待重定向USB设备,并对确定的该待重定向USB设备进行重定向操作。相比现有技术中在进行USB设备重定向时,需要终端本地安装各插入USB设备对应的设备驱动,以确定待重定向USB设备进行重定向的方式,减小了终端的存储压力,且使重定向过程变得简单,提高了用户体验。The USB device redirection device provided by the embodiment of the present invention determines the USB device to be redirected according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub; the USB device to be redirected The corresponding device information structure is sent to the cloud desktop, so that the cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure. That is, the location information corresponding to the device information structure and the location information corresponding to the physical device object created from the USB device list and the location information corresponding to the physical device object created by the hub can be determined to be redirected during the USB device redirection process. The USB device performs a redirection operation on the determined USB device to be redirected. Compared with the prior art, when performing USB device redirection, the terminal needs to locally install the device driver corresponding to each USB device to determine the manner in which the USB device to be redirected is redirected, thereby reducing the storage pressure of the terminal and making The redirection process is simple and improves the user experience.
显然,本领域的技术人员应该明白,上述本发明实施例的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在计算机存储介质(ROM/RAM、磁碟、光盘)中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。所以,本发明不限制于任何特定的硬件和软件结合。 Obviously, those skilled in the art should understand that the modules or steps of the above embodiments of the present invention can be implemented by a general computing device, which can be concentrated on a single computing device or distributed among multiple computing devices. On the network, optionally, they may be implemented by program code executable by the computing device, such that they may be stored in a computer storage medium (ROM/RAM, disk, optical disk) by a computing device, and at some In some cases, the steps shown or described may be performed in an order different than that herein, or they may be separately fabricated into individual integrated circuit modules, or a plurality of modules or steps may be fabricated into a single integrated circuit module. . Therefore, the invention is not limited to any particular combination of hardware and software.
以上内容是结合具体的实施方式对本发明实施例所作的进一步详细说明,不能认定本发明的具体实施只局限于这些说明。对于本发明所属技术领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本发明的保护范围。The above is a detailed description of the embodiments of the present invention in conjunction with the specific embodiments, and the specific embodiments of the present invention are not limited to the description. It will be apparent to those skilled in the art that the present invention may be made without departing from the spirit and scope of the invention.
工业实用性Industrial applicability
本发明实施例提供的技术方案可以应用于通信技术领域。根据本发明实施例提供的USB设备重定向方法、装置以及计算机存储介质,通过从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备;将待重定向USB设备对应的设备信息结构体发送给云桌面,使得云桌面根据设备信息结构体完成待重定向USB设备的相应重定向处理。即在USB设备重定向过程中通过从USB设备列表中选择的USB设备的位置信息和根据集线器创建的物理设备对象对应的位置信息就可以确定待重定向USB设备,并对确定的该待重定向USB设备进行重定向操作。相比现有技术中在进行USB设备重定向时,需要终端本地安装各插入USB设备对应的设备驱动,以确定待重定向USB设备进行重定向的方式,减小了终端的存储压力,且使重定向过程变得简单,提高了用户体验。 The technical solutions provided by the embodiments of the present invention can be applied to the field of communications technologies. According to an embodiment of the present invention, a USB device redirection method, apparatus, and computer storage medium determine a USB device to be redirected by using location information of a USB device selected from a USB device list and location information corresponding to a physical device object created by a hub; The device information structure corresponding to the USB device to be redirected is sent to the cloud desktop, so that the cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure. That is, in the USB device redirection process, the USB device to be redirected can be determined by the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub, and the determined to be redirected The USB device performs a redirection operation. Compared with the prior art, when performing USB device redirection, the terminal needs to locally install the device driver corresponding to each USB device to determine the manner in which the USB device to be redirected is redirected, thereby reducing the storage pressure of the terminal and making The redirection process is simple and improves the user experience.

Claims (11)

  1. 一种USB设备重定向方法,包括:A USB device redirection method includes:
    根据从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备;Determining the USB device to be redirected according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub;
    将所述待重定向USB设备对应的设备信息结构体发送给云桌面,使云桌面根据所述设备信息结构体完成所述待重定向USB设备的相应重定向处理。The device information structure corresponding to the USB device to be redirected is sent to the cloud desktop, and the cloud desktop completes the corresponding redirection process of the USB device to be redirected according to the device information structure.
  2. 如权利要求1所述的USB设备重定向方法,其中,根据从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备,包括:The USB device redirection method according to claim 1, wherein the determining the USB device to be redirected according to the location information of the USB device selected from the USB device list and the location information corresponding to the physical device object created by the hub comprises:
    从USB设备列表中选择的USB设备对应的设备信息结构体中获取所述USB设备的位置信息;Obtaining location information of the USB device from a device information structure corresponding to the USB device selected in the USB device list;
    通过物理总线枚举集线器,获取各集线器创建的物理设备对象对应的位置信息;Enumerating a hub through a physical bus to obtain location information corresponding to a physical device object created by each hub;
    将位置信息与所述从USB设备列表中选择的USB设备的位置信息相匹配的物理设备对象对应的USB设备作为所述待重定向USB设备。A USB device corresponding to the physical device object that matches the location information with the location information of the USB device selected from the USB device list is used as the USB device to be redirected.
  3. 如权利要求2所述的USB设备重定向方法,其中,所述设备信息结构体的生成方式包括:The USB device redirection method according to claim 2, wherein the generating manner of the device information structure comprises:
    通过从物理总线枚举集线器,获取集线器信息;Obtain hub information by enumerating hubs from the physical bus;
    根据所述集线器信息获取USB设备信息;Obtaining USB device information according to the hub information;
    根据所述集线器信息和所述USB设备信息生成设备信息结构体;所述设备信息结构体包括USB设备的位置信息。Generating a device information structure according to the hub information and the USB device information; the device information structure includes location information of the USB device.
  4. 如权利要求3所述的USB设备重定向方法,其中,所述设备信息结构体中USB设备的位置信息的生成方式包括:The USB device redirection method according to claim 3, wherein the manner of generating the location information of the USB device in the device information structure comprises:
    根据所述集线器信息确定集线器序号信息;Determining hub serial number information according to the hub information;
    根据所述USB设备信息确定USB设备端口信息;Determining USB device port information according to the USB device information;
    将所述USB设备端口信息和所述集线器序号信息进行拼接得到所述USB设备的位置信息。Splicing the USB device port information and the hub serial number information to obtain location information of the USB device.
  5. 如权利要求1-4任一项所述的USB设备重定向方法,其中,确定待重定向USB设备之后,还包括: The USB device redirection method according to any one of claims 1 to 4, wherein after determining the USB device to be redirected, the method further includes:
    使所述待重定向USB设备加载预设的统一设备驱动。The USB device to be redirected is loaded with a preset unified device driver.
  6. 一种USB设备重定向装置,包括:A USB device redirection device includes:
    待重定向USB设备确定模块,设置为从USB设备列表中选择的USB设备的位置信息和集线器创建的物理设备对象对应的位置信息确定待重定向USB设备;The USB device determining module to be redirected is configured to determine the USB device to be redirected by setting location information of the USB device selected from the USB device list and location information corresponding to the physical device object created by the hub;
    设备信息结构体发送模块,设置为将所述待重定向USB设备对应的设备信息结构体发送给云桌面,使云桌面根据所述设备信息结构体完成所述待重定向USB设备的相应重定向处理。The device information structure sending module is configured to send the device information structure corresponding to the USB device to be redirected to the cloud desktop, so that the cloud desktop completes the corresponding redirection of the USB device to be redirected according to the device information structure. deal with.
  7. 如权利要求6所述的USB设备重定向装置,其中,所述待重定向USB设备确定模块还设置为:The USB device redirection device of claim 6, wherein the to-be-redirected USB device determining module is further configured to:
    从USB设备列表中选择的USB设备对应的设备信息结构体中获取所述USB设备的位置信息;Obtaining location information of the USB device from a device information structure corresponding to the USB device selected in the USB device list;
    通过物理总线枚举集线器,获取各集线器创建的物理设备对象对应的位置信息;Enumerating a hub through a physical bus to obtain location information corresponding to a physical device object created by each hub;
    将位置信息与所述从USB设备列表中选择的USB设备的位置信息相匹配的物理设备对象对应的USB设备作为所述待重定向USB设备。A USB device corresponding to the physical device object that matches the location information with the location information of the USB device selected from the USB device list is used as the USB device to be redirected.
  8. 如权利要求7所述的USB设备重定向装置,其中,还包括设备信息结构体生成模块,所述设备信息结构体生成模块设置为:The USB device redirection device of claim 7, further comprising a device information structure generation module, wherein the device information structure generation module is configured to:
    通过从物理总线枚举集线器,获取集线器信息;Obtain hub information by enumerating hubs from the physical bus;
    根据所述集线器信息获取USB设备信息;Obtaining USB device information according to the hub information;
    根据所述集线器信息和所述USB设备信息生成设备信息结构体;所述设备信息结构体包括USB设备的位置信息。Generating a device information structure according to the hub information and the USB device information; the device information structure includes location information of the USB device.
  9. 如权利要求8所述的USB设备重定向装置,其中,所述设备信息结构体生成模块还设置为:The USB device redirection device of claim 8, wherein the device information structure generation module is further configured to:
    根据所述集线器信息确定集线器序号信息;Determining hub serial number information according to the hub information;
    根据所述USB设备信息确定USB设备端口信息;Determining USB device port information according to the USB device information;
    将所述USB设备端口信息和所述集线器序号信息进行拼接得到所述USB设备的位置信息。Splicing the USB device port information and the hub serial number information to obtain location information of the USB device.
  10. 如权利要求6-9任一项所述的USB设备重定向装置,其中,还包括统一设备驱动加载模块,所述统一设备驱动加载模块设置为:The USB device redirection device according to any one of claims 6 to 9, further comprising a unified device driver loading module, wherein the unified device driver loading module is configured to:
    在确定待重定向USB设备之后,使所述待重定向USB设备加载预设的统一设备 驱动。After determining the USB device to be redirected, the USB device to be redirected is loaded with a preset unified device. drive.
  11. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行的一个或多个程序,所述一个或多个程序被所述计算机执行时使所述计算机执行如根据权利要求1-5中任一项所述的USB设备重定向方法。 A computer storage medium having stored therein one or more programs executable by a computer, the one or more programs being executed by the computer to cause the computer to perform as in claims 1-5 The USB device redirection method of any of the above.
PCT/CN2017/099843 2016-09-05 2017-08-31 Method, device, and computer storage medium for usb device redirection WO2018041193A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610804901.5A CN107797947A (en) 2016-09-05 2016-09-05 A kind of USB device reorientation method and device
CN201610804901.5 2016-09-05

Publications (1)

Publication Number Publication Date
WO2018041193A1 true WO2018041193A1 (en) 2018-03-08

Family

ID=61300044

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/099843 WO2018041193A1 (en) 2016-09-05 2017-08-31 Method, device, and computer storage medium for usb device redirection

Country Status (2)

Country Link
CN (1) CN107797947A (en)
WO (1) WO2018041193A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109144903B (en) * 2018-08-15 2022-02-18 国云科技股份有限公司 Method for intelligently managing USB (universal serial bus) equipment by cloud terminal

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6895588B1 (en) * 1999-04-09 2005-05-17 Sun Microsystems, Inc. Remote device access over a network
CN101702143A (en) * 2009-12-02 2010-05-05 深圳华为通信技术有限公司 Method and device for modifying driving and matching information of USB device
CN102368231A (en) * 2011-10-14 2012-03-07 深圳市京华科讯科技有限公司 Method and system for redirecting USB (universal serial bus) devices
CN105183674A (en) * 2015-08-26 2015-12-23 深圳市深信服电子科技有限公司 USB virtualization network mapping method, USB virtualization network mapping device and USB hub

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8850082B2 (en) * 2010-08-30 2014-09-30 Qualcomm Incorporated Virtual USB compound device enumeration
CN101963950B (en) * 2010-09-30 2012-02-29 飞天诚信科技股份有限公司 Method for positioning USB port in connection of device
CN102789432B (en) * 2011-05-19 2016-02-17 中国电信股份有限公司 USB device driving method and system
US9804990B2 (en) * 2014-08-27 2017-10-31 Vmware, Inc. Sharing unclaimed USB devices as PCI devices

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6895588B1 (en) * 1999-04-09 2005-05-17 Sun Microsystems, Inc. Remote device access over a network
CN101702143A (en) * 2009-12-02 2010-05-05 深圳华为通信技术有限公司 Method and device for modifying driving and matching information of USB device
CN102368231A (en) * 2011-10-14 2012-03-07 深圳市京华科讯科技有限公司 Method and system for redirecting USB (universal serial bus) devices
CN105183674A (en) * 2015-08-26 2015-12-23 深圳市深信服电子科技有限公司 USB virtualization network mapping method, USB virtualization network mapping device and USB hub

Also Published As

Publication number Publication date
CN107797947A (en) 2018-03-13

Similar Documents

Publication Publication Date Title
US9386079B2 (en) Method and system of virtual desktop infrastructure deployment studio
US10127057B2 (en) Method and apparatus for dynamically implementing application function
WO2019237586A1 (en) Method and apparatus for managing scheduled tasks, computer device and storage medium
WO2020207454A1 (en) Information pushing method and device
US10924590B1 (en) Virtual workspace experience visualization and optimization
CN106557288B (en) Method and device for acquiring printing data
US10506400B2 (en) Data download method and apparatus
CN109218356B (en) Method and apparatus for managing stateful applications on a server
EP2863281A2 (en) System and method to configure a field device
WO2019019864A1 (en) Communication system, method and apparatus for embedded self-service terminal
US10404568B2 (en) Agent manager for distributed transaction monitoring system
US20220043898A1 (en) Methods and apparatuses for acquiring information
US9134887B2 (en) Multi-device visual correlation interaction
CN106027631B (en) Data transmission method and device
CN108733527B (en) System, method and apparatus for testing server functionality
CN110275787B (en) Online platform data transmission method, device, medium and electronic equipment
US11233853B1 (en) System and method for controlling remote sessions executing on other devices
WO2018041193A1 (en) Method, device, and computer storage medium for usb device redirection
CN111381965B (en) Method and apparatus for processing requests
US10956034B2 (en) Automatic virtual input device
US20140344427A1 (en) Device and method for automatic switching of communication protocol of network devices based on user action
JP6285579B2 (en) Long polling processing method and system, and recording medium
CN114138145A (en) Application virtualization file dragging method, device and equipment and readable storage medium
WO2019223759A1 (en) Method and device for displaying wireless access point information
JP2005149336A (en) Storage management method and device therefor

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: 17845495

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: 17845495

Country of ref document: EP

Kind code of ref document: A1