[go: up one dir, main page]

CN102567074A - USB (universal serial bus) device redirecting method facing virtual machines - Google Patents

USB (universal serial bus) device redirecting method facing virtual machines Download PDF

Info

Publication number
CN102567074A
CN102567074A CN2011103866676A CN201110386667A CN102567074A CN 102567074 A CN102567074 A CN 102567074A CN 2011103866676 A CN2011103866676 A CN 2011103866676A CN 201110386667 A CN201110386667 A CN 201110386667A CN 102567074 A CN102567074 A CN 102567074A
Authority
CN
China
Prior art keywords
usb
physical machine
usb device
machine
virtual machine
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
CN2011103866676A
Other languages
Chinese (zh)
Other versions
CN102567074B (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.)
E3cloud Information Technology Co ltd
Original Assignee
China Standard Software 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 China Standard Software Co Ltd filed Critical China Standard Software Co Ltd
Priority to CN201110386667.6A priority Critical patent/CN102567074B/en
Publication of CN102567074A publication Critical patent/CN102567074A/en
Application granted granted Critical
Publication of CN102567074B publication Critical patent/CN102567074B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

一种面向虚拟机的USB设备重定向方法。包括步骤:(1)由远程物理机B上的加入了USB设备重定向系统的模拟器QEMU创建虚拟机,本地物理机A通过远程桌面协议访问此虚拟机;(2)USB设备所在的物理机C利用USB重定向协议实现USB设备与远端物理机B上的虚拟机间的通信;(3)远端物理机B通过模拟器QEMU的命令行指令将物理机C上的USB设备重新定向到远端物理机B上的指定虚拟机中,从而使本地物理机A在远程桌面中可以使用该USB设备。本方法适用于所有利用加入了USB设备重定向系统的模拟器QEMU创建的虚拟机,通过USB重定向协议进行USB设备重定向的需求。

A virtual machine-oriented USB device redirection method. Including steps: (1) The virtual machine is created by the emulator QEMU on the remote physical machine B that has joined the USB device redirection system, and the local physical machine A accesses this virtual machine through the remote desktop protocol; (2) The physical machine where the USB device is located C uses the USB redirection protocol to realize the communication between the USB device and the virtual machine on the remote physical machine B; (3) The remote physical machine B redirects the USB device on the physical machine C to In the specified virtual machine on the remote physical machine B, so that the local physical machine A can use the USB device in the remote desktop. This method is applicable to all virtual machines created by using the emulator QEMU that has added the USB device redirection system to perform USB device redirection through the USB redirection protocol.

Description

一种面向虚拟机的USB设备重定向方法A virtual machine-oriented USB device redirection method

技术领域 technical field

本发明涉及一种由模拟器QEMU创建的虚拟机访问本地或远程物理机上的USB设备的方法,尤指一种通过传输控制协议套接字(TCP Socket)和USB重定向协议将指定物理机上的USB设备重新定向到指定虚拟机的方法。 The invention relates to a method for a virtual machine created by emulator QEMU to access a USB device on a local or remote physical machine, especially a method for specifying a USB device on a physical machine through a transmission control protocol socket (TCP Socket) and a USB redirection protocol. Method for redirecting USB devices to specified virtual machines.

背景技术 Background technique

虚拟化(Virtualization)技术最早出现在 20 世纪 60 年代的 IBM 大型机系统。随着近年多核系统、集群、网格甚至云计算的广泛部署,虚拟化技术在商业应用上的优势日益体现,不仅降低了 IT 成本,而且还增强了系统安全性和可靠性,虚拟化的概念也逐渐深入到人们日常的工作与生活中。然而在虚拟化技术的使用过程中也出现了诸多问题。 Virtualization (Virtualization) technology first appeared in the IBM mainframe system in the 1960s. With the widespread deployment of multi-core systems, clusters, grids, and even cloud computing in recent years, the advantages of virtualization technology in commercial applications have become increasingly evident, not only reducing IT costs, but also enhancing system security and reliability. The concept of virtualization It has also gradually penetrated into people's daily work and life. However, there are many problems in the process of using virtualization technology.

USB是一种新型串行接口,与传统接口相比,USB具有速度快、独立供电、即插即用、成本低等众多特点,有着非常广阔的应用范围。但由于其设备种类定义繁多、通信协议规范复杂,导致USB设备仿真软件设计工作繁琐,开发难度较大。众所周知,打印机,闪存,移动硬盘、数码相机等USB设备,对用户来说是非常重要的。而在现有的虚拟化技术中利用虚拟机访问本地物理机上的USB设备还存在很多问题,如很多开源的虚拟化技术尚不支持对USB设备的访问,或者仅支持对有限的几种USB设备的访问;而一些商业付费虚拟化软件对USB设备的支持虽然比开源虚拟化软件完善一些,但仍存在一些局限性。如当前微软的虚拟服务器(Hyper-V Server)与其自身的虚拟机(Virtual PC),尚不支持USB设备的访问,需要借助第三方付费软件如网络USB(USB Over Network)等,通过网络使用USB设备。VMWare公司的桌面虚拟机可以通过配置从桌面使用各种USB设备,使用此功能时,可以从客户菜单中访问大多数本地客户端系统连接的USB设备。但VMWare公司桌面虚拟机的USB重定向功能存在以下局限: USB is a new type of serial interface. Compared with traditional interfaces, USB has many characteristics such as fast speed, independent power supply, plug and play, and low cost, and has a very wide range of applications. However, due to the various types of devices and complex communication protocol specifications, the design of USB device simulation software is cumbersome and difficult to develop. As we all know, USB devices such as printers, flash memory, mobile hard disks, and digital cameras are very important to users. However, there are still many problems in using virtual machines to access USB devices on local physical machines in existing virtualization technologies. For example, many open source virtualization technologies do not yet support access to USB devices, or only support a limited number of USB devices. access; while some commercial paid virtualization software supports USB devices better than open source virtualization software, but there are still some limitations. For example, Microsoft's virtual server (Hyper-V Server) and its own virtual machine (Virtual PC) do not yet support the access of USB devices. It is necessary to use third-party paid software such as network USB (USB Over Network) to use USB devices through the network. equipment. VMWare's desktop virtual machine can be configured to use various USB devices from the desktop. When using this feature, you can access most of the USB devices connected to the local client system from the client menu. However, the USB redirection function of VMWare's desktop virtual machine has the following limitations:

1、从客户菜单中访问USB设备并在桌面中使用该设备时,将无法在本地计算机上访问该设备(同时只能有1个访问); 1. When you access the USB device from the client menu and use the device in the desktop, you will not be able to access the device on the local computer (only 1 access at the same time);

2、如果从浏览入口访问桌面,则只能在Windows客户端上使用此功能,并且还需要事先已经在本地Windows系统上安装了带有可选USB重定向的组件; 2. If you access the desktop from the browser portal, you can only use this function on the Windows client, and you need to have installed the component with optional USB redirection on the local Windows system in advance;

3、要在桌面中使用USB 打印机,用户必须在桌面中安装所需的打印驱动程序。 3. To use a USB printer on the desktop, the user must install the required print driver on the desktop.

而VMware公司免费的虚拟机现在仍缺乏USB重定向的支持。 VMware's free virtual machine still lacks support for USB redirection.

对于利用虚拟机访问远程物理机上的USB设备,无论是开源的虚拟化软件还是商业付费的虚拟化软件,到目前为止还是一项空白。 For using a virtual machine to access a USB device on a remote physical machine, whether it is an open source virtualization software or a commercial paid virtualization software, it is still a blank so far.

要想降低虚拟机的开发难度,减少系统消耗,提高通用性,充分利用现有的驱动程序,使虚拟机能够访问本地或远程物理机上的USB设备,研究通过传输控制协议套接字和USB重定向协议相结合的方法是最好的方式,同时也具有重要的实践意义。 In order to reduce the development difficulty of the virtual machine, reduce system consumption, improve versatility, make full use of the existing driver, so that the virtual machine can access the USB device on the local or remote physical machine, research through the transfer control protocol socket and USB reload The method of combining targeted protocols is the best way, and it also has important practical significance.

发明内容 Contents of the invention

针对开源和商业付费虚拟化软件对访问本地USB设备的局限性,以及还未实现访问远程物理机上的USB设备的问题,本发明提出了一种面向虚拟机的USB设备重定向方法。 Aiming at the limitations of open source and commercial paid virtualization software for accessing local USB devices, and the problem that accessing USB devices on remote physical machines has not yet been realized, the present invention proposes a virtual machine-oriented USB device redirection method.

模拟器QEMU是一个平台虚拟化解决方案,允许对一个完整的 PC 环境进行虚拟化(包括磁盘、图形适配器和网络设备)。客户操作系统所生成的任何 I/O 请求都会被中途截获,并重新发送到 QEMU 进程模拟的用户模式中。本方法就是在模拟器QEMU的基础上加入了USB设备的重定向功能,并与本地或远程物理机进行通信,从而实现由模拟器QEMU创建的虚拟机对本地或远程物理机上的USB设备的访问。 Emulator QEMU is a platform virtualization solution that allows virtualization of a complete PC environment (including disks, graphics adapters and network devices). Any I/O requests generated by the guest operating system are intercepted and resent to user mode emulated by the QEMU process. This method is to add the redirection function of the USB device on the basis of the emulator QEMU, and communicate with the local or remote physical machine, so that the virtual machine created by the emulator QEMU can access the USB device on the local or remote physical machine .

为了实现上述功能,本发明提供的虚拟机USB重定向方法包括以下步骤: In order to realize above-mentioned function, virtual machine USB redirection method provided by the present invention comprises the following steps:

1) 修改模拟器QEMU,加入USB重定向功能。利用此模拟器QEMU创建QEMU虚拟机,局域网内的任一物理机通过远程桌面协议访问此物理机上的QEMU虚拟机; 1) Modify the emulator QEMU and add USB redirection function. Use this emulator QEMU to create a QEMU virtual machine, and any physical machine in the LAN can access the QEMU virtual machine on this physical machine through the remote desktop protocol;

2) 利用USB设备所在物理机上的USB重定向协议实现USB设备与远端QEMU虚拟机间的通信; 2) Use the USB redirection protocol on the physical machine where the USB device is located to realize the communication between the USB device and the remote QEMU virtual machine;

3) 远端QEMU虚拟机通过命令行指令将步骤2)中的USB设备重定向到虚拟机中。 3) The remote QEMU virtual machine redirects the USB device in step 2) to the virtual machine through command line commands.

其中步骤1)包含如下具体步骤: Step 1) includes the following specific steps:

11)定义用于表示一个需要重定向的USB设备的结构体; 11) Define a structure used to represent a USB device that needs to be redirected;

12)实现用以操作该结构的读、写、查询等函数功能; 12) Implement functions such as reading, writing, and querying to operate the structure;

13)实现与USB设备所在的远程主机进行通信的模块; 13) A module for communicating with the remote host where the USB device is located;

14)利用加入USB重定向功能的模拟器QEMU创建虚拟机,并进行远程连接。 14) Use the emulator QEMU with the USB redirection function to create a virtual machine and make a remote connection.

其中步骤12)的具体过程是先判断数据操作的具体类型,然后根据数据操作类型执行相应的操作函数。 The specific process of step 12) is to first judge the specific type of data operation, and then execute the corresponding operation function according to the type of data operation.

其中步骤2)中利用命令行相应指令获得需要进行重定向的USB设备的供应商ID与产品识别码,并在USB设备所在的物理机上启动一个USB设备重定向协议的服务器端进程,然后将一个端口号分配给此USB设备的供应商ID与产品识别码,并对这个端口进行监听。 In step 2), use the corresponding command line command to obtain the vendor ID and product identification code of the USB device that needs to be redirected, and start a server-side process of the USB device redirection protocol on the physical machine where the USB device is located, and then transfer a The port number is assigned to the vendor ID and product identification code of the USB device, and the port is monitored.

其中步骤3)中首先获得USB设备的供应商ID与产品识别码及其所在物理机的IP地址;然后在远端QEMU虚拟机的监视器中通过命令行指令将此USB设备重定向到远端QEMU虚拟机中。 In step 3), first obtain the vendor ID and product identification code of the USB device and the IP address of the physical machine where it is located; then redirect the USB device to the remote end through command line commands in the monitor of the remote QEMU virtual machine In the QEMU virtual machine.

然后利用步骤2)、步骤3)中建立好的传输控制协议套接字进行数据传输。 Then use the transmission control protocol socket established in step 2) and step 3) for data transmission.

本发明主要包括USB重定向协议和基于模拟器QEMU的USB设备重定向系统两个部分。其中USB重定向协议为物理机上的USB设备分配一个监听端口,并开始监听此端口;同时与远端QEMU虚拟机建立起传输控制协议套接字连接;然后接收远端的QEMU虚拟机对USB设备的操作类型,根据不同的操作类型在物理机上对USB设备进行相应的操作。而基于模拟器QEMU的USB设备重定向系统将给定IP地址的主机上的USB设备重定向到QEMU虚拟机中,然后接收通过远程桌面对虚拟机中USB设备的操作,并将此操作反馈给USB设备所在的物理机;待USB设备所在物理机对指定操作处理完后将结果传送回虚拟机,虚拟机重新模拟USB设备所在物理机处理后的数据,并在虚拟机中进行重现。 The invention mainly includes two parts: USB redirection protocol and USB device redirection system based on emulator QEMU. Among them, the USB redirection protocol allocates a listening port for the USB device on the physical machine, and starts to listen to this port; at the same time, a transmission control protocol socket connection is established with the remote QEMU virtual machine; and then the remote QEMU virtual machine receives the USB device According to different operation types, perform corresponding operations on the USB device on the physical machine. The USB device redirection system based on the emulator QEMU redirects the USB device on the host with a given IP address to the QEMU virtual machine, then receives the operation of the USB device in the virtual machine through the remote desktop, and feeds back this operation to The physical machine where the USB device is located; after the physical machine where the USB device is located has processed the specified operation, the result is sent back to the virtual machine, and the virtual machine re-simulates the data processed by the physical machine where the USB device is located, and reproduces it in the virtual machine.

本发明的技术效果是,解决了开源和商业付费虚拟化软件对访问本地USB设备的局限性,填补了开源和商业付费虚拟化软件无法访问远程物理机上的USB设备的空白。 The technical effect of the present invention is that it solves the limitation of open source and commercial paid virtualization software on accessing local USB devices, and fills the gap that open source and commercial paid virtualization software cannot access USB devices on remote physical machines.

附图说明 Description of drawings

图1为USB设备重定向的架构示意图; Figure 1 is a schematic diagram of the architecture of USB device redirection;

图2为USB设备重定向协议的处理流程图。 FIG. 2 is a flow chart of the processing of the USB device redirection protocol.

具体实施方式 Detailed ways

为使本发明的特征及优点得到更清楚的了解,以下结合附图,作详细说明如下:如图1所示,描述了本发明的架构,通过物理主机A上的远程桌面协议访问物理主机B上的虚拟机,此时物理主机B上的虚拟机需要访问物理主机C上的USB设备(物理主机C上的USB设备与USB重定向协议也可位于物理主机A上),于本实施例中的具体执行步骤是: In order to make the features and advantages of the present invention more clearly understood, below in conjunction with accompanying drawings, describe in detail as follows: As shown in Figure 1, described framework of the present invention, access physical host B through the remote desktop protocol on physical host A At this time, the virtual machine on physical host B needs to access the USB device on physical host C (the USB device and USB redirection protocol on physical host C can also be located on physical host A), in this embodiment The specific execution steps are:

1) 利用加入USB重定向功能的模拟器QEMU创建虚拟机,物理机A通过远程桌面协议访问物理机B上的虚拟机; 1) Use the emulator QEMU with the USB redirection function to create a virtual machine, and the physical machine A accesses the virtual machine on the physical machine B through the remote desktop protocol;

2) 利用物理机C上的USB设备重定向协议实现物理机C上的USB设备与物理机B上的虚拟机间的通信; 2) Use the USB device redirection protocol on physical machine C to realize the communication between the USB device on physical machine C and the virtual machine on physical machine B;

3) 物理机B上的虚拟机通过命令行指令将物理机C上的USB设备重定向到物理机B上的虚拟机中。 3) The virtual machine on physical machine B redirects the USB device on physical machine C to the virtual machine on physical machine B through command line commands.

4)通过物理机A上的远程桌面操作物理机B上的虚拟机中的USB设备。 4) Operate the USB device in the virtual machine on physical machine B through the remote desktop on physical machine A.

其中步骤1)在模拟器QEMU中加入了USB重定向功能,利用一个结构体表示一个需要重定向的USB设备;利用此QEMU创建的虚拟机,QEMU会确定当前的虚拟机配置状态以及对USB设备不同数据类型如控制流数据、文件流数据、中断流数据等的操作类型,并将这些信息床送给USB设备所在的物理主机C。 Step 1) The USB redirection function is added to the emulator QEMU, and a structure is used to represent a USB device that needs to be redirected; using the virtual machine created by this QEMU, QEMU will determine the current virtual machine configuration status and the USB device Operation types of different data types such as control stream data, file stream data, interrupt stream data, etc., and send these information beds to the physical host C where the USB device is located.

其中步骤2)在命令行需要利用指令获得需要进行重定向的USB设备的供应商ID与产品识别码,并在物理机C上启动一个USB设备重定向协议的服务器端进程,然后将一个端口号分配给此USB设备的供应商ID与产品识别码,并对这个端口进行监听。步骤1)中的模拟器QEMU获得虚拟机对重定向到其中的USB设备所进行的操作信息后,通过USB重定向协议将其发送给物理主机C。物理主机C处理完后将结果反馈给物理主机B上的模拟器QEMU;而呈现在虚拟机中的也就是处理后的结果。 Step 2) In the command line, you need to use commands to obtain the vendor ID and product identification code of the USB device that needs to be redirected, and start a server-side process of the USB device redirection protocol on the physical machine C, and then set a port number The vendor ID and product identification code assigned to this USB device, and monitor this port. After the emulator QEMU in step 1) obtains the operation information of the virtual machine on the USB device redirected to it, it sends it to the physical host C through the USB redirection protocol. After processing, the physical host C feeds back the result to the emulator QEMU on the physical host B; and what is presented in the virtual machine is the processed result.

其中步骤3)首先获得USB设备的供应商ID与产品识别码以及所在物理机的IP地址;然后在远端虚拟机的监视器中通过命令行指令将本地主机的USB设备重定向到远端虚拟机中。 Step 3) First obtain the vendor ID and product identification code of the USB device and the IP address of the physical machine where it resides; then redirect the USB device of the local host to the remote virtual in the plane.

其中步骤4)在本地物理机A上利用远程桌面访问远程物理机B上的虚拟机,并对被重定向到此虚拟机中的物理机C上的USB设计进行读、写、删除等操作,操作类型通过远程桌面协议反馈给物理机B上的虚拟机,物理机B再通过步骤2)中建立起的连接将相应操作发送给USB设备所在的物理机C,物理机C做出相应的处理后将结果发送给物理机B上的虚拟机,通过物理机A上的远程桌面也呈现出了相应的结果。 Step 4) Use the remote desktop on the local physical machine A to access the virtual machine on the remote physical machine B, and perform operations such as reading, writing, and deleting the USB design on the physical machine C redirected to this virtual machine, The operation type is fed back to the virtual machine on the physical machine B through the remote desktop protocol, and the physical machine B sends the corresponding operation to the physical machine C where the USB device is located through the connection established in step 2), and the physical machine C makes corresponding processing Finally, the results are sent to the virtual machine on physical machine B, and the corresponding results are also presented through the remote desktop on physical machine A.

本发明中的USB重定向协议:该协议由以下三部分组成: USB redirection protocol among the present invention: this agreement is made up of following three parts:

1)  USB设备模块usb-device:代表需要重定向的USB设备; 1) USB device module usb-device: represents the USB device that needs to be redirected;

2)  USB客户端模块usb-guest:连接usb-device,并对usb-device进行指定操作; 2) USB client module usb-guest: connect usb-device, and perform specified operations on usb-device;

3)  USB服务器端模块usb-host:通过网络将usb-device呈献给远程虚拟机,并使usb-device对usb-guest可用。 3) USB server-side module usb-host: present usb-device to the remote virtual machine through the network, and make usb-device available to usb-guest.

该协议在物理机C上运行一个服务器端USB重定向usbredirserver进程,并为需要重定向的USB设备分配一个监听端口,并开始监听此端口;同时与远端物理机B上的由模拟器QEMU创建的虚拟机建立起传输控制协议套接字连接;然后接收虚拟机传送过来的对USB设备的各种操作请求,待物理机C对这些请求进行完相应的处理后将结果反馈给远端物理机B上的虚拟机。 This protocol runs a server-side USB redirection usbredirserver process on the physical machine C, and allocates a listening port for the USB device that needs to be redirected, and starts to listen to this port; at the same time, it is created by the emulator QEMU on the remote physical machine B The virtual machine establishes a transmission control protocol socket connection; then receives various operation requests for the USB device sent by the virtual machine, and after the physical machine C completes the corresponding processing of these requests, the result is fed back to the remote physical machine Virtual machine on B.

基于模拟器QEMU的USB设备重定向系统:修改模拟器QEMU,加入USB重定向连接usbredir-tcp模块,负责与USB重定向协议启动的usbredirserver进程进行连接,部分处理从虚拟机或usbredirserver进程获得的信息后,将结果发送给相应的部分。通过获得的USB设备信息、USB设备所在物理机的IP地址,利用命令行指令将物理机C上的USB设备重新定向到物理机B上的由模拟器QEMU创建的虚拟机中,在物理机A上利用远程桌面访问物理机B上的虚拟机,并对重定向到此虚拟机上的USB设备进行操作;这些操作回传给物理机B上的虚拟机后,物理机B利用USB设备重定向系统再将其发送给USB设备所在的物理机C进行相应的处理。 USB device redirection system based on emulator QEMU: modify emulator QEMU, add USB redirection connection usbredir-tcp module, responsible for connecting with usbredirserver process started by USB redirection protocol, and partially process information obtained from virtual machine or usbredirserver process , send the results to the appropriate section. Through the obtained USB device information and the IP address of the physical machine where the USB device is located, use the command line command to redirect the USB device on the physical machine C to the virtual machine created by the emulator QEMU on the physical machine B. On the physical machine A Use remote desktop to access the virtual machine on physical machine B, and perform operations on the USB device redirected to this virtual machine; after these operations are sent back to the virtual machine on physical machine B, physical machine B uses the USB device to redirect The system then sends it to the physical machine C where the USB device is located for corresponding processing.

本发明的技术效果是,解决了开源和商业付费虚拟化软件对访问本地USB设备的局限性,填补了开源和商业付费虚拟化软件无法访问远程物理机上的USB设备的空白。 The technical effect of the present invention is that it solves the limitation of open source and commercial paid virtualization software on accessing local USB devices, and fills the gap that open source and commercial paid virtualization software cannot access USB devices on remote physical machines.

Claims (7)

1.一种面向虚拟机的USB设备重定向方法,其特征在于:其包括以 1. a virtual machine-oriented USB device redirection method, characterized in that: it includes 下步骤: Next steps: 1) 本地物理机A通过远程桌面协议访问远端物理机B上由加入了USB设备重定向系统的模拟器创建的虚拟机; 1) The local physical machine A accesses the virtual machine on the remote physical machine B through the remote desktop protocol created by the emulator that has added the USB device redirection system; 2) 利用USB设备所在的物理机C上的USB重定向协议实现USB设备与远端物理机B上的虚拟机间的通信; 2) Use the USB redirection protocol on the physical machine C where the USB device is located to realize the communication between the USB device and the virtual machine on the remote physical machine B; 3) 远端物理机B通过模拟器的命令行指令将物理机C上的USB设备重新定向到远端物理机B上的指定虚拟机中; 3) The remote physical machine B redirects the USB device on the physical machine C to the specified virtual machine on the remote physical machine B through the command line command of the emulator; 4) 本地物理机A通过远程桌面访问远端物理机B上的指定虚拟机,并操作被重新定向到此虚拟机中的物理机C上的USB设备。 4) The local physical machine A accesses the specified virtual machine on the remote physical machine B through the remote desktop, and the operation is redirected to the USB device on the physical machine C in this virtual machine. 2.如权利要求1所述的方法,其特征在于:在所述步骤1)中,利用加入了USB设备重定向系统的模拟器QEMU创建虚拟机。 2. The method according to claim 1, characterized in that: in the step 1), the virtual machine is created by using the emulator QEMU added with the USB device redirection system. 3.如权利要求1所述的方法,其特征在于:在所述步骤1)的具体改变是加入了连接USB设备所在物理机的方法,以及操作USB设备时所涉及的数据类别的判断和处理方法。 3. The method according to claim 1, characterized in that: the specific change in the step 1) is to add the method of connecting the physical machine where the USB device is located, and the judgment and processing of the data types involved in operating the USB device method. 4.如权利要求2所述的方法,其特征在于:在所述步骤2)中,首先 4. The method according to claim 2, characterized in that: in said step 2), first 在USB设备所在的物理机C上获得USB设备的供应商ID与产品识别码;然后在物理机C上利用USB重定向协议为此USB设备分配一个监听端口,并运行一个服务器端USB重定向usbredirserver进程开始监听此端口;远端物理机B上的由模拟器QEMU创建的虚拟机与物理机C上的usbredirserver进程建立起传输控制协议套接字连接。 Obtain the vendor ID and product identification code of the USB device on the physical machine C where the USB device is located; then use the USB redirection protocol to allocate a listening port for this USB device on the physical machine C, and run a server-side USB redirection usbredirserver The process starts to listen to this port; the virtual machine created by the emulator QEMU on the remote physical machine B establishes a transmission control protocol socket connection with the usbredirserver process on the physical machine C. 5.    如权利要求2所述的方法,其特征在于:在所述步骤3)中,首先获得物理机C上的USB设备的供应商ID与产品识别码以及物理机C的IP地址;然后在远端物理机B上由模拟器QEMU创建的虚拟机的监视器中通过命令行指令将物理机C上的USB设备重定向到远端物理机B上的指定虚拟机中。 5. The method according to claim 2, characterized in that: in the step 3), first obtain the vendor ID and product identification code of the USB device on the physical machine C and the IP address of the physical machine C; In the monitor of the virtual machine created by the emulator QEMU on the remote physical machine B, the USB device on the physical machine C is redirected to the specified virtual machine on the remote physical machine B through command line commands. 6.如权利要求2所述的方法,其特征在于:在所述步骤4)中,在本地物理机A上利用远程桌面访问远程物理机B上的虚拟机,并对被重定向到此虚拟机中的物理机C上的USB设计进行读、写、删除操作,操作类型通过远程桌面协议反馈给物理机B上的虚拟机,物理机B再通过步骤2)中建立起的连接将相应操作发送给USB设备所在的物理机C,物理机C做出相应的处理后将结果发送给物理机B上的虚拟机,通过物理机A上的远程桌面也呈现出了相应的结果。 6. The method according to claim 2, characterized in that: in the step 4), use remote desktop on the local physical machine A to access the virtual machine on the remote physical machine B, and redirect to this virtual machine The USB on the physical machine C in the machine is designed to perform read, write, and delete operations. The operation type is fed back to the virtual machine on the physical machine B through the remote desktop protocol, and the physical machine B will perform corresponding operations through the connection established in step 2). It is sent to the physical machine C where the USB device is located, and the physical machine C performs corresponding processing and sends the result to the virtual machine on the physical machine B, and the corresponding result is also presented through the remote desktop on the physical machine A. 7.权利要求1-6任一项所述面向虚拟机的USB设备重定向方法,其特征在于:所述的应用系统包括以下部分: 7. The virtual machine-oriented USB device redirection method according to any one of claims 1-6, characterized in that: the application system comprises the following parts: USB重定向协议,该协议由以下三部分组成: USB redirection protocol, which consists of the following three parts: 1) USB设备usb-device模块:代表需要重定向的USB设备; 1) USB device usb-device module: represents the USB device that needs to be redirected; 2) USB客户端usb-guest模块:连接usb-device,并对usb-device进行指定操作; 2) USB client usb-guest module: connect usb-device, and perform specified operations on usb-device; 3) USB服务器端usb-host模块:通过网络将usb-device呈献给远程虚拟机,并使usb-device对usb-guest可用; 3) USB server-side usb-host module: present the usb-device to the remote virtual machine through the network, and make the usb-device available to the usb-guest; 该协议在物理机C上运行一个usbredirserver进程,并为需要重定向的USB设备分配一个监听端口,并开始监听此端口;同时与远端物理机B上的由模拟器QEMU创建的虚拟机建立起传输控制协议套接字连接;然后接收虚拟机传送过来的对USB设备的各种操作请求,待物理机C对这些请求进行完相应的处理后将结果反馈给远端物理机B上的虚拟机; This protocol runs a usbredirserver process on the physical machine C, and allocates a listening port for the USB device that needs to be redirected, and starts to listen to this port; at the same time, it establishes a virtual machine with the virtual machine created by the emulator QEMU on the remote physical machine B Transmission control protocol socket connection; then receive various operation requests for the USB device sent by the virtual machine, and after the physical machine C completes the corresponding processing of these requests, the result will be fed back to the virtual machine on the remote physical machine B ; 基于模拟器QEMU的USB设备重定向系统:修改模拟器QEMU,加入USB重定向连接usbredir-tcp模块,负责与USB重定向协议启动的usbredirserver进程进行连接,部分处理从虚拟机或usbredirserver进程获得的信息后,将结果发送给相应的部分;通过获得的USB设备信息、USB设备所在物理机的IP地址,利用命令行指令将物理机C上的USB设备重新定向到物理机B上的由模拟器QEMU创建的虚拟机中,在物理机A上利用远程桌面访问物理机B上的虚拟机,并对重定向到此虚拟机上的USB设备进行操作;这些操作回传给物理机B上的虚拟机后,物理机B利用USB设备重定向系统再将其发送给USB设备所在的物理机C进行相应的处理。 USB device redirection system based on emulator QEMU: modify emulator QEMU, add USB redirection connection usbredir-tcp module, responsible for connecting with usbredirserver process started by USB redirection protocol, and partially process information obtained from virtual machine or usbredirserver process Finally, send the result to the corresponding part; through the obtained USB device information and the IP address of the physical machine where the USB device is located, use the command line command to redirect the USB device on the physical machine C to the emulator QEMU on the physical machine B. In the created virtual machine, use remote desktop on physical machine A to access the virtual machine on physical machine B, and perform operations on the USB device redirected to this virtual machine; these operations are sent back to the virtual machine on physical machine B Finally, the physical machine B uses the USB device redirection system to send it to the physical machine C where the USB device is located for corresponding processing.
CN201110386667.6A 2011-11-29 2011-11-29 USB (universal serial bus) device redirecting method facing virtual machines Expired - Fee Related CN102567074B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110386667.6A CN102567074B (en) 2011-11-29 2011-11-29 USB (universal serial bus) device redirecting method facing virtual machines

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110386667.6A CN102567074B (en) 2011-11-29 2011-11-29 USB (universal serial bus) device redirecting method facing virtual machines

Publications (2)

Publication Number Publication Date
CN102567074A true CN102567074A (en) 2012-07-11
CN102567074B CN102567074B (en) 2015-01-21

Family

ID=46412572

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110386667.6A Expired - Fee Related CN102567074B (en) 2011-11-29 2011-11-29 USB (universal serial bus) device redirecting method facing virtual machines

Country Status (1)

Country Link
CN (1) CN102567074B (en)

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103984590A (en) * 2014-06-03 2014-08-13 浪潮电子信息产业股份有限公司 Virtual machine USB-equipment sharing method
CN104092747A (en) * 2014-06-30 2014-10-08 杭州华三通信技术有限公司 USB dynamic linking method and device in virtualization environment
CN104991871A (en) * 2015-06-15 2015-10-21 湖南昇云科技有限公司 Method and system for redirecting cloud terminal USB
CN105100157A (en) * 2014-05-15 2015-11-25 中兴通讯股份有限公司 USB equipment mapping and interaction methods, apparatuses, cloud terminal, and cloud server
CN105183675A (en) * 2015-09-30 2015-12-23 华为技术有限公司 USB equipment access method, device and system, terminal and server
CN105391652A (en) * 2015-12-03 2016-03-09 武汉噢易云计算有限公司 USB equipment network sharing system and method based on USB redirection
CN105740180A (en) * 2014-12-10 2016-07-06 中国移动通信集团重庆有限公司 Virtual machine access method and apparatus for USB device
CN105843612A (en) * 2016-03-21 2016-08-10 深圳市京华科讯科技有限公司 Method for switching virtual machines by terminal device and terminal device
CN106445847A (en) * 2016-09-12 2017-02-22 天脉聚源(北京)传媒科技有限公司 U disk SN code obtaining method and device
CN107643936A (en) * 2017-10-26 2018-01-30 上海金途信息科技有限公司 An image peripheral data redirection system based on QEMU camera device
CN108108201A (en) * 2017-12-26 2018-06-01 合肥中科云巢科技有限公司 USB storage device reorientation method and virtual machine based on RDP agreements
CN108304247A (en) * 2017-12-19 2018-07-20 华为技术有限公司 The method and apparatus of access camera, server, readable storage medium storing program for executing
CN109857465A (en) * 2018-11-23 2019-06-07 广东微云科技股份有限公司 Automatic installation method and system of cloud desktop usb driver
CN110109623A (en) * 2019-04-30 2019-08-09 广州长图量传电子科技有限公司 A kind of implementation method of the USB flash disk remote operation of kvm system
CN112231004A (en) * 2020-10-19 2021-01-15 北京京航计算通讯研究所 Cloud desktop terminal USB redirection system
CN112596793A (en) * 2020-11-26 2021-04-02 新华三大数据技术有限公司 Redirection method and device for composite equipment
CN113687910A (en) * 2021-07-29 2021-11-23 广东浪潮智慧计算技术有限公司 Method, device, equipment and storage medium for managing USB (universal serial bus) equipment in cluster
CN114153552A (en) * 2021-10-26 2022-03-08 新华三大数据技术有限公司 USB device management method and device
CN116955236A (en) * 2023-09-20 2023-10-27 元内核(北京)科技有限公司 USB device sharing method and system based on virtualization

Citations (4)

* 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
US20070294457A1 (en) * 2006-06-16 2007-12-20 Alexander Gantman USB wireless network drive
CN101493786A (en) * 2008-01-22 2009-07-29 联想(北京)有限公司 Computer and equipment accessing method
CN102023960A (en) * 2009-09-14 2011-04-20 联想(北京)有限公司 Computer network system, computer and hardware equipment remote management method thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070294457A1 (en) * 2006-06-16 2007-12-20 Alexander Gantman USB wireless network drive
CN101035039A (en) * 2007-04-20 2007-09-12 福建升腾资讯有限公司 USB mapping method
CN101493786A (en) * 2008-01-22 2009-07-29 联想(北京)有限公司 Computer and equipment accessing method
CN102023960A (en) * 2009-09-14 2011-04-20 联想(北京)有限公司 Computer network system, computer and hardware equipment remote management method thereof

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105100157B (en) * 2014-05-15 2019-08-27 中兴通讯股份有限公司 A USB device mapping, interaction method, device, cloud terminal and cloud server
CN105100157A (en) * 2014-05-15 2015-11-25 中兴通讯股份有限公司 USB equipment mapping and interaction methods, apparatuses, cloud terminal, and cloud server
CN103984590A (en) * 2014-06-03 2014-08-13 浪潮电子信息产业股份有限公司 Virtual machine USB-equipment sharing method
CN104092747A (en) * 2014-06-30 2014-10-08 杭州华三通信技术有限公司 USB dynamic linking method and device in virtualization environment
CN105740180A (en) * 2014-12-10 2016-07-06 中国移动通信集团重庆有限公司 Virtual machine access method and apparatus for USB device
CN105740180B (en) * 2014-12-10 2019-08-02 中国移动通信集团重庆有限公司 The virtual machine cut-in method and device of USB device
CN104991871A (en) * 2015-06-15 2015-10-21 湖南昇云科技有限公司 Method and system for redirecting cloud terminal USB
CN105183675B (en) * 2015-09-30 2018-03-27 华为技术有限公司 To the access method of USB device, device, terminal, server and system
US10552348B2 (en) 2015-09-30 2020-02-04 Huawei Technologies Co., Ltd. USB device access method, apparatus and system, a terminal, and a server
CN105183675A (en) * 2015-09-30 2015-12-23 华为技术有限公司 USB equipment access method, device and system, terminal and server
CN105391652A (en) * 2015-12-03 2016-03-09 武汉噢易云计算有限公司 USB equipment network sharing system and method based on USB redirection
CN105843612A (en) * 2016-03-21 2016-08-10 深圳市京华科讯科技有限公司 Method for switching virtual machines by terminal device and terminal device
CN106445847A (en) * 2016-09-12 2017-02-22 天脉聚源(北京)传媒科技有限公司 U disk SN code obtaining method and device
CN107643936A (en) * 2017-10-26 2018-01-30 上海金途信息科技有限公司 An image peripheral data redirection system based on QEMU camera device
CN108304247A (en) * 2017-12-19 2018-07-20 华为技术有限公司 The method and apparatus of access camera, server, readable storage medium storing program for executing
CN108108201A (en) * 2017-12-26 2018-06-01 合肥中科云巢科技有限公司 USB storage device reorientation method and virtual machine based on RDP agreements
CN109857465A (en) * 2018-11-23 2019-06-07 广东微云科技股份有限公司 Automatic installation method and system of cloud desktop usb driver
CN110109623A (en) * 2019-04-30 2019-08-09 广州长图量传电子科技有限公司 A kind of implementation method of the USB flash disk remote operation of kvm system
CN112231004A (en) * 2020-10-19 2021-01-15 北京京航计算通讯研究所 Cloud desktop terminal USB redirection system
CN112231004B (en) * 2020-10-19 2022-06-17 北京京航计算通讯研究所 Cloud desktop terminal USB redirection system
CN112596793A (en) * 2020-11-26 2021-04-02 新华三大数据技术有限公司 Redirection method and device for composite equipment
CN113687910A (en) * 2021-07-29 2021-11-23 广东浪潮智慧计算技术有限公司 Method, device, equipment and storage medium for managing USB (universal serial bus) equipment in cluster
CN114153552A (en) * 2021-10-26 2022-03-08 新华三大数据技术有限公司 USB device management method and device
CN116955236A (en) * 2023-09-20 2023-10-27 元内核(北京)科技有限公司 USB device sharing method and system based on virtualization
CN116955236B (en) * 2023-09-20 2023-12-12 元内核(北京)科技有限公司 USB device sharing method and system based on virtualization

Also Published As

Publication number Publication date
CN102567074B (en) 2015-01-21

Similar Documents

Publication Publication Date Title
CN102567074B (en) USB (universal serial bus) device redirecting method facing virtual machines
CN103677858B (en) Method, system and the equipment of software virtual machine management in a kind of cloud environment
CN102523264B (en) USB (Universal Serial Bus) equipment remote sharing method and system for virtual machine
TWI588751B (en) Computer host with a baseboard management controller to manage virtual machines and method thereof
CN102917095B (en) A kind of method of the terminal test based on android system and device
CN103605562B (en) Method for migrating kernel-based virtual machine (KVM) between physical hosts
US20130219090A1 (en) System and method for virtualizing the peripherals in a terminal device to enable remote management via removable portable media with processing capability
JP2007172586A (en) Method, apparatus and computer program for sharing computer data among computers
US9122793B2 (en) Distributed debugging of an application in a distributed computing environment
CN107580011B (en) A data sharing method and desktop cloud server
CN108768730A (en) Method and apparatus for operating intelligent network adapter
JP2016095830A (en) Serial output redirection by HTTP
WO2022143717A1 (en) Method, apparatus, and system for migrating virtual machine
US9892074B2 (en) System and method to support USB devices in an unsupported operating system in VDI environments
CN109388475A (en) A kind of dispositions method, device, electronic equipment and the storage medium of physics bare machine
CN102884515B (en) Serial port redirection processing method, device and system
CN106095528A (en) A method for detecting virtual machine drive letter
CN106020795A (en) Realization method and device of VDI desktop personal data disk
US20200326998A1 (en) Two-way clipboard exchange in virtual console
CN112099916B (en) Virtual machine data migration method and device, computer equipment and storage medium
CN115442083B (en) Device access method, data exchange method, device and storage medium
CN100473070C (en) A mapping method of USB device with storage function on network computer
CN109308288B (en) Data processing method and device
Yang A research on usb device remote sharing methods in virtual desktop environment
CN110955880A (en) USB safety dog mounting method in cloud environment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20170213

Address after: 430079 Hubei Province, East Lake New Technology Development Zone, Optics Valley Avenue, No. nine cable expansion (phase five) cable factory building (building 101), room 388

Patentee after: WUHAN XINGANG CLOUD INFORMATION TECHNOLOGY CO.,LTD.

Address before: 200030 room 1006-1010, Panyu Road, Shanghai, 1028

Patentee before: CHINA STANDARD SOFTWARE Co.,Ltd.

CP01 Change in the name or title of a patent holder

Address after: 430079 Hubei Province, East Lake New Technology Development Zone, Optics Valley Avenue, No. nine cable expansion (phase five) cable factory building (building 101), room 388

Patentee after: E3CLOUD INFORMATION TECHNOLOGY CO.,LTD.

Address before: 430079 Hubei Province, East Lake New Technology Development Zone, Optics Valley Avenue, No. nine cable expansion (phase five) cable factory building (building 101), room 388

Patentee before: WUHAN XINGANG CLOUD INFORMATION TECHNOLOGY CO.,LTD.

CP01 Change in the name or title of a patent holder
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150121

CF01 Termination of patent right due to non-payment of annual fee