CN111752659A - Asynchronous sharing method of USB (universal serial bus) equipment based on network - Google Patents

Asynchronous sharing method of USB (universal serial bus) equipment based on network Download PDF

Info

Publication number
CN111752659A
CN111752659A CN202010583813.3A CN202010583813A CN111752659A CN 111752659 A CN111752659 A CN 111752659A CN 202010583813 A CN202010583813 A CN 202010583813A CN 111752659 A CN111752659 A CN 111752659A
Authority
CN
China
Prior art keywords
usb
request
client
virtual
package
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202010583813.3A
Other languages
Chinese (zh)
Other versions
CN111752659B (en
Inventor
王浩
李广斌
蒋关平
罗光辉
毛兴龙
蔡翔
何俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Wulian Technology Co ltd
Original Assignee
Hangzhou Wulian Technology Co ltd
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 Hangzhou Wulian Technology Co ltd filed Critical Hangzhou Wulian Technology Co ltd
Priority to CN202010583813.3A priority Critical patent/CN111752659B/en
Publication of CN111752659A publication Critical patent/CN111752659A/en
Application granted granted Critical
Publication of CN111752659B publication Critical patent/CN111752659B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • G06F9/452Remote windowing, e.g. X-Window System, desktop virtualisation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a network-based asynchronous sharing method of USB equipment, which is characterized in that a client simulates a request to send to real USB equipment through an asynchronous transmission mechanism, and the request is sent to a host end after the USB equipment completes the request, so that the real USB equipment of the client is embodied in virtual equipment of the host end, and a transparent transmission function is realized. The asynchronous transmission mechanism of the invention is suitable for the following scenes: when network delay or network jitter occurs, the influence caused by the network delay or the network jitter can be greatly reduced because the request is transmitted on the network only once.

Description

Asynchronous sharing method of USB (universal serial bus) equipment based on network
Technical Field
The invention belongs to the technical field of Windows device driver development, and particularly relates to a network-based USB device asynchronous sharing method.
Background
With the continuous development of cloud technology, the traditional internet bar mode has higher hardware cost upgrading rate due to hardware maintenance, so the cloud host mode is mostly adopted in the existing internet bar; in such a mode of the cloud host, since the host end in the computer room is not inserted with any peripheral equipment, namely, a keyboard and a mouse are not inserted, and the client in the internet bar is a simple box, the box end is inserted with the keyboard and the mouse, in order to transmit the operation of the keyboard and the mouse at the box end to the host end, a method needs to be considered to realize the function, and the purpose that the keyboard and the mouse are operated at the box end just like the keyboard and the mouse are operated at the host end is achieved.
In order to achieve the purpose, at present, there are many ways, for example, the operations of the box-end keyboard mouse are extracted and sent to the host end through the network, and then the operations are sent to the system by using a message simulation way at the host end. In addition, another technique is not realized in a message mode, but a virtual device is established at a host end and is used for mapping the device of the client, namely the operation of the real device of the client is finally embodied by the virtual device at the host end.
The project technology is a synchronous mechanism, namely, a request of host-side virtual equipment is firstly sent to a client side, then the client side sends a result back to the host side after completing the request, the mode has serious pause phenomenon in a scene, for example, in a cloud computer scene, game pictures are processed on a cloud-side host, and after the cloud-side host completes the processing, the pictures are sent back to a box of a client machine of an internet bar for display; in this scenario, the keyboard and mouse operation at the box end needs to be transmitted to the cloud host in real time, and if the network has a delay and jitter, because the usb ip, which is a synchronous transmission mode, has two transmission times on the network, the response of the virtual device at the host end to the game is slow, which seriously affects the user experience.
The USB device transparent transmission technology like USBIP generally adopts a synchronization mode, the processing mode has an obvious characteristic, the request of the cloud host is transmitted back and forth on the network, when the network shakes, the operation of the device like a mouse and a keyboard of an internet bar client can not be transmitted to the cloud host in real time, and the experience of the internet bar user is reduced; there is a need to provide a solution that allows the transmission time of requests over the network to be short.
The invention relates to a program based on a Windows system, which comprises a user layer program and a kernel layer program, and not only relates to the development of Windows application programs but also the development of Windows kernel drivers, the technical key point is also the development of the kernel drivers, and the development of the kernel drivers is developed based on a WDM driving model framework of Windows.
Disclosure of Invention
In view of the above, the invention provides a network-based asynchronous sharing method for USB devices, which embodies real device operations of a client in virtual devices of a host through an asynchronous mechanism, realizes a transparent transmission function, and can reduce the delay influence of network delay and jitter on keyboard and mouse operations.
A network-based asynchronous sharing method for USB equipment specifically comprises the following steps: adopting an asynchronous mechanism for USB-HID (universal serial bus-human interface device) equipment (such as a keyboard, a mouse, a joystick and the like), namely simulating a request by a client and sending the request to real USB-HID equipment, sending a request result to a host end by the client after the USB-HID equipment completes the request, and further completing a pending request sent to virtual equipment by a system before the host end completes driving through a virtual bus; because the request data only has one-time transmission time on the network, the influence caused by network delay or jitter is greatly reduced; for devices such as a mouse and a keyboard with interrupt transmission, only one interrupt pipeline of one interface is usually used, so that a client can simulate a request to request data from the interrupt pipeline.
Further, for non-USB-HID devices, a synchronization mechanism is still employed, requesting a transmission time to and from the network twice.
Further, after the USB-HID device completes the request, the request result is read by the client application program, the client application program further transmits the request result to the host application program through the network, and the host application program sends the request result to the virtual bus driver through the writefile.
Further, the client installs and loads a corresponding device driver for the USB device according to the inserted USB device, where the driver is used to complete initialization of the USB device and obtain information of the USB device.
Further, each time the client takes over one device driver, the client sends a message for creating the virtual device to the host and attaches basic information of the corresponding USB device.
Further, the host end is loaded with a virtual bus driver, and the driver is used for reporting to the Windows system that various clients require virtual devices created by the host end.
Further, after receiving the message for creating the virtual device by the client, the host end may report a corresponding virtual device to the Windows system by using the virtual bus driver according to the attached basic information of the USB device, and the Windows system may load a corresponding function driver (e.g., common USB device function drivers such as hidusb and usbstor) for the virtual device.
Further, for the non-USB-HID device, after the function driver is loaded, an IRP (I/O RequestPackage) request is sent to the virtual device in an initialization stage, the virtual bus drives the virtual bus to package the IRP request into a package, the package is read by the host application and sent to the client application through the network, the client application receives the package and sends the package to the corresponding device driver, the device driver sends the IRP request in the package to the real non-USB-HID device, when the non-USB-HID device completes the IRP request, the request result is packaged into a package, the package is read by the client application and sent to the host application through the network, the host application sends the package to the virtual bus driver, and the virtual bus driver receives the IRP request which is sent before the package is completed.
Further, for the USB-HID device, after the function driver completes initialization, the virtual bus driver may send an IRP request pending to the virtual device, the client device driver may simulate an IRP request to send to the real USB-HID device, after the USB-HID device completes the IRP request, the request result may be encapsulated into a package, the package is read by the client application program and then sent to the host application program through the network, and then the host application program sends the package to the virtual bus driver, and the virtual bus driver receives the IRP request pending before the package is completed.
In the invention, the virtual bus driver at the host end can judge whether the virtual equipment corresponds to the USB-HID equipment, and only asynchronous transparent transmission is carried out on the USB-HID equipment after the function driver completes initialization.
In order to shorten the transmission time, the strategy of the invention is to simulate a request at a client and send the request to a host actively after the request is completed, so that the transmission of the request on the network is only from the client to the host, and the process that the host transmits the request to the client in a synchronous mode is not used, and the strategy is called as an asynchronous transmission sharing mechanism.
The asynchronous transmission sharing mechanism is in a client/host mode, real USB equipment is arranged at a client, the host virtualizes the USB equipment, and the real equipment operation of the client is embodied in the virtual equipment of the host, so that a transparent transmission function is realized. Generally, a function driver at a host end sends a request to a virtual device to acquire the operation of the virtual device, the host end sends the request of the virtual device to a USB real device at a client end through a network to enable the real device to complete the operation, the request is sent to the host end from the client end through the network after being completed, and the host end completes the request sent to the virtual device by the function driver; under the condition, the function driver of the host side sends a request to the virtual equipment to the client side through the network, the real equipment of the client side completes the request, and then the request is sent to the host side through the network, and the request has a back-and-forth process. Under the asynchronous condition of the invention, the client simulates a request to be sent to real equipment, and after the real equipment completes the request, the request is sent to the host end, and the suitable scene of the condition is as follows: when network delay or network jitter occurs, the influence caused by the network delay or the network jitter is greatly reduced because the request is transmitted on the network only once.
Drawings
FIG. 1 is a schematic diagram of HID device stack establishment in Windows kernel.
Fig. 2 is a schematic diagram of a request flow under synchronization of the network sharing device.
Fig. 3 is a schematic diagram of a request flow in the asynchronous network sharing device.
Detailed Description
In order to more specifically describe the present invention, the following detailed description is provided for the technical solution of the present invention with reference to the accompanying drawings and the specific embodiments.
The invention relates to a network-based asynchronous sharing method of USB equipment, which comprises the following concrete implementation processes:
firstly, installing a take-over driver at a client, wherein the take-over driver is a conventional USB device driver;
the matter of taking over the drive is to complete the initialization of the USB equipment and obtain the information of the USB equipment;
when the client takes over one device driver, the client sends a message for creating the virtual device to the host and attaches the basic information of the USB device.
Then, a virtual bus driver is installed at the host end for reporting various virtual devices to the system;
when the host receives the message of creating the virtual equipment by the client, reporting the virtual equipment to the Windows system according to the attached basic information of the USB equipment;
the Windows system loads a function driver, such as a common USB device function driver like hidusb, usbstor, for example, for the virtual device.
For the non-HID device, a synchronization strategy is still adopted, and the time for requesting transmission on the network is twice, and the specific flow is as follows:
after the function driver is loaded, an IRP request is sent to the virtual equipment in the initialization stage of the function driver;
the virtual bus driver encapsulates the IRP request pending into a package, and the package is read by the host application program and then sent to the client application program through the network;
after receiving the package, the client application program sends the package to the client to take over the drive;
the client-side pipe driver sends the IRP request in the package to the real device;
when the IRP request is completed, packaging the IRP request into a package, reading the package by the client application program and sending the package to the host application program through the network;
after receiving the package, the host application program sends the package to the virtual bus driver;
the virtual bus driver completes the previously pended IRP request.
For the HID, after the initialization stage of the functional device is completed, the device enters an asynchronous state and requests that the transmission time is only once on the network, and the specific flow is as follows:
when the function driver completes initialization, the virtual bus driver sends an IRP request pending to the virtual device;
the client takes over the drive and simulates an IRP request to be sent to real equipment;
when the IRP request is completed, packaging the IRP request into a package, reading the package by the client application program and sending the package to the host application program through the network;
after receiving the package, the host application program sends the package to the virtual bus driver;
the virtual bus driver completes the previous pending IRP request.
In the invention, the host side bus driver can judge whether the virtual device is the HID device, and only performs asynchronous transparent transmission on the HID device after the function driver completes initialization.
As shown in fig. 1, we briefly describe the setup process of the HID device stack and how the mouse and keyboard operations are transferred to the Windows system.
Windows loads hidusb for all HID devices, the hidusb creates a corresponding number of PDOs (physical Device objects) according to the number of collections in the HID report descriptor, and the operating system loads different drivers, such as a mouse and a keyboard, for each PDO.
Since the keyboard and the mouse have various interfaces, such as an HID interface, a serial port and a PS/2 interface, in order to provide a uniform access interface to an upper layer, a mouse class is arranged on the mouse driver mousehid.
Sys is initialized at win32k, two system threads are created, namely a mouse thread and a keyboard thread, an IRP request of current mouse operation is obtained from mousseclass continuously in the mouse thread, and if no operation is carried out, the mousseclass can request pending the IRP request.
The mouse driving mousehid sends an IRP request to hidusb continuously, the IRP request is sent to hub all the time, after the mouse is operated, the IRP request returns to the mousehid after being completed, and the mousehid puts the corresponding operation of the mouse in the mouseclass according to the completed IRP request.
For a device for interrupting transmission, such as a mouse and a keyboard, only one interrupt pipeline of one interface is usually used, so that an IRP request can be simulated to request data from the interrupt pipeline.
For non-HID devices, as shown in fig. 2, at the beginning stage, the host loads a virtual bus driver, and the client loads a takeover driver according to the accessed USB device;
after the client takes over the drive operation, a package is generated and read by the client application program and is sent to the host application program through the network;
the host-side application program sends the package to the virtual bus driver, and after receiving the package, the virtual bus driver creates a virtual device according to the device information in the package;
windows loads hidusb for the virtual device, for example, if the virtual device is a mouse;
hidusb creates PDO according to collection; windows loads the mousehid according to the PDO;
when the device stack is established, the virtual PDO receives an IRP request when the USB device is initialized, and the virtual bus driver requests the IRP request pending;
step s 1: this IRP request is read by the host AP;
step s 2: the host side AP transmits the request to the client side AP through the network;
step s 3: the client AP sends the request to the take-over drive through writefile;
step s 4: the takeover driver sends the request to the USB device; when this request is completed, the completed request is read by the client AP;
step s 5: the client AP transmits a completion request to the host AP through a network;
step s 6: the host side AP sends a completion request to the virtual bus driver through writefile;
the virtual bus driver completes the previously pending request.
The foregoing process is repeated at IRP request during device initialization.
For the HID device, as shown in fig. 3, after the initialization of the device is finished, the keyboard and mouse device will enter an asynchronous state, which is as follows:
the virtual bus driver will send a request pending to the virtual PDO;
the take-over driver simulates a request and sends the request to the USB equipment;
step s 11: when this request is completed, the completed request is read by the client AP;
step s 22: the client AP transmits a completion request to the host AP through a network;
step s 33: the host side AP sends a completion request to the virtual bus driver through writefile;
the virtual bus driver completes the previously pending request.
The embodiments described above are presented to enable a person having ordinary skill in the art to make and use the invention. It will be readily apparent to those skilled in the art that various modifications to the above-described embodiments may be made, and the generic principles defined herein may be applied to other embodiments without the use of inventive faculty. Therefore, the present invention is not limited to the above embodiments, and those skilled in the art should make improvements and modifications to the present invention based on the disclosure of the present invention within the protection scope of the present invention.

Claims (9)

1. A asynchronous sharing method of USB equipment based on network is characterized in that: the USB-HID device adopts an asynchronous mechanism, namely a client simulates a request to send to a real USB-HID device, the client sends the request result to a host after the USB-HID device completes the request, and the host completes the pending request sent to the virtual device by the system before the virtual bus drive.
2. The asynchronous sharing method of USB devices according to claim 1, wherein: for non-USB-HID devices, a synchronization mechanism is still employed, requesting a transmission time to and from the network.
3. The asynchronous sharing method of USB devices according to claim 1, wherein: after the USB-HID completes the request, the request result can be read by the client application program, the client application program further transmits the request result to the host application program through the network, and the host application program sends the request result to the virtual bus driver through the writefile.
4. The asynchronous sharing method of USB devices according to claim 1, wherein: and the client installs and loads a corresponding device driver for the USB device according to the inserted USB device, wherein the driver is used for finishing the initialization of the USB device and acquiring the information of the USB device.
5. The asynchronous sharing method of USB devices according to claim 4, wherein: and each time the client takes over one device driver, the client sends a message for creating the virtual device to the host and attaches basic information of the corresponding USB device.
6. The asynchronous sharing method of USB devices according to claim 1, wherein: and the host end is provided with a virtual bus driver which is used for reporting various virtual devices which are required to be created by the host end by the client to the Windows system.
7. The asynchronous sharing method of USB devices according to claim 5, wherein: after receiving the message of creating virtual equipment by the client, the host reports a corresponding virtual equipment to the Windows system by using the virtual bus driver according to the attached basic information of the USB equipment, and the Windows system loads a corresponding function driver for the virtual equipment.
8. The asynchronous sharing method of USB devices according to claim 7, wherein: for the non-USB-HID equipment, after being loaded, the function driver sends an IRP request to the virtual equipment in an initialization stage, the virtual bus drives the virtual bus to pend the IRP request and encapsulate the IRP request into a package, the package is read by the host application program and then sent to the client application program through the network, the client application program sends the package to the corresponding equipment driver after receiving the package, the equipment driver sends the IRP request in the package to the real non-USB-HID equipment, after the non-USB-HID equipment completes the IRP request, the request result is encapsulated into a package, the package is read by the client application program and then sent to the host application program through the network, the host application program sends the package to the virtual bus driver, and the virtual bus driver receives the IRP request which is pended before the package is completed.
9. The asynchronous sharing method of USB devices according to claim 7, wherein: for the USB-HID, after the function driver completes initialization, the virtual bus driver will send an IRP request pending to the virtual device, the client device driver will simulate an IRP request to send to the real USB-HID, after the USB-HID completes the IRP request, the request result will be packaged into a package, the package is read by the client application program and then sent to the host application program through the network, the host application program sends the package to the virtual bus driver, and the virtual bus driver receives the package and then completes the pending IRP request.
CN202010583813.3A 2020-06-23 2020-06-23 Asynchronous sharing method of USB equipment based on network Active CN111752659B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010583813.3A CN111752659B (en) 2020-06-23 2020-06-23 Asynchronous sharing method of USB equipment based on network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010583813.3A CN111752659B (en) 2020-06-23 2020-06-23 Asynchronous sharing method of USB equipment based on network

Publications (2)

Publication Number Publication Date
CN111752659A true CN111752659A (en) 2020-10-09
CN111752659B CN111752659B (en) 2024-07-19

Family

ID=72676649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010583813.3A Active CN111752659B (en) 2020-06-23 2020-06-23 Asynchronous sharing method of USB equipment based on network

Country Status (1)

Country Link
CN (1) CN111752659B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101035039A (en) * 2007-04-20 2007-09-12 福建升腾资讯有限公司 USB mapping method
US20120331202A1 (en) * 2011-06-27 2012-12-27 Cohen Daniel C Systems and methods for driverless operation of usb device
CN103873537A (en) * 2012-12-18 2014-06-18 无锡中科物联网基础软件研发中心有限公司 Remote sharing method and system for USB (Universal Serial Bus) device
CN104298631A (en) * 2013-12-29 2015-01-21 新疆信息产业有限责任公司 Method for terminal to be in communication with computer through USB
CN104407910A (en) * 2014-10-29 2015-03-11 华南理工大学 Virtualization server performance monitoring method and system
EP3079305A1 (en) * 2015-04-10 2016-10-12 Comcast Cable Communications, LLC Virtual gateway control and management
CN110825676A (en) * 2019-12-19 2020-02-21 小矩科技(深圳)有限公司 USB-HID data analysis converter

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101035039A (en) * 2007-04-20 2007-09-12 福建升腾资讯有限公司 USB mapping method
US20120331202A1 (en) * 2011-06-27 2012-12-27 Cohen Daniel C Systems and methods for driverless operation of usb device
CN103873537A (en) * 2012-12-18 2014-06-18 无锡中科物联网基础软件研发中心有限公司 Remote sharing method and system for USB (Universal Serial Bus) device
CN104298631A (en) * 2013-12-29 2015-01-21 新疆信息产业有限责任公司 Method for terminal to be in communication with computer through USB
CN104407910A (en) * 2014-10-29 2015-03-11 华南理工大学 Virtualization server performance monitoring method and system
EP3079305A1 (en) * 2015-04-10 2016-10-12 Comcast Cable Communications, LLC Virtual gateway control and management
CN110825676A (en) * 2019-12-19 2020-02-21 小矩科技(深圳)有限公司 USB-HID data analysis converter

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MAN KEI LEE等: "A reliable asynchronous RPC architecture for wireless networks", 《COMPUTER COMMUNICATIONS》, vol. 25, no. 17, 1 November 2002 (2002-11-01), pages 1631 - 1639, XP004383806, DOI: 10.1016/S0140-3664(02)00088-9 *
崔阳: "Windows环境下HID设备通讯接口的设计", 《计算机与现代化》, no. 7, 31 July 2013 (2013-07-31), pages 172 - 175 *

Also Published As

Publication number Publication date
CN111752659B (en) 2024-07-19

Similar Documents

Publication Publication Date Title
CN101685431B (en) Remote desktop control system using usb interface and method thereof
US20170323418A1 (en) Virtualized gpu in a virtual machine environment
US8762544B2 (en) Selectively communicating data of a peripheral device to plural sending computers
US7260624B2 (en) Systems and methods for establishing interaction between a local computer and a remote computer
US9063793B2 (en) Virtual server and virtual machine management method for supporting zero client by providing host interfaces from classified resource pools through emulation or direct connection modes
CN111240631A (en) Method and system for virtually transmitting Linux virtual machine screen picture based on AMD display card
CN106020929A (en) System and method for supporting 3D application in virtual environment
CN104735123B (en) Massive store for cloud computing virtualizes
JP5646518B2 (en) Remote desktop protocol (RDP) display without tearing
CN105391652A (en) USB equipment network sharing system and method based on USB redirection
WO2022143714A1 (en) Server system, and virtual machine creation method and apparatus
JP2010020757A (en) Remote desktop control system using usb cable and method thereof
CN103685539A (en) Method for running Windows system on home-made processor platform
CN103324532A (en) Dynamic migration method and system of virtual machine
US10810024B2 (en) Redirection method and apparatus, and system
CN103092676A (en) Analog input output method, device and system of virtual machine cluster
CN113254129B (en) Cloud desktop GPU direct-connection virtualization redirection management system and method
US10733689B2 (en) Data processing
EP3113015B1 (en) Method and apparatus for data communication in virtualized environment
CN111752659B (en) Asynchronous sharing method of USB equipment based on network
KR20170105317A (en) Method for transmitting screen of virtual machine using graphic procedding unit based on hardware and apparatus using the same
CN104504000A (en) Remote transmission method, device and system for mirror image file
CN115357340A (en) Device and method for improving performance of virtual equipment
CN112274916B (en) Key mouse input method, device, equipment and medium
CN113835816A (en) Virtual machine desktop display method, device, equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant