USB sharing device based on virtual control

文档序号:1952530 发布日期:2021-12-10 浏览:13次 中文

阅读说明:本技术 一种基于虚拟控制的usb共享装置 (USB sharing device based on virtual control ) 是由 孟祥成 纪成 李�杰 沈玉权 于 2021-09-10 设计创作,主要内容包括:本发明涉及计算机外设共享技术领域,具体为一种基于虚拟控制的USB共享装置,包括若干个USB输入接口,用于与客户端连接,实现数据的传输;选择模块,用于选择任意一个USB输入接口与USB输出接口连接;控制模块,用于接收客户端通过USB输入接口传输的USB数据请求,并控制选择模块连接对应所述USB输入接口与USB输出接口;USB输出接口,用于与驱动设备连接,实现客户端数据的传输。本发明在使用的过程中避免反复拔插USB输出接口的需求,避免插拔USB设备的时间浪费,提高USB设备的接口使用寿命。(The invention relates to the technical field of computer peripheral sharing, in particular to a USB sharing device based on virtual control, which comprises a plurality of USB input interfaces, a plurality of USB input interfaces and a plurality of USB output interfaces, wherein the USB input interfaces are used for being connected with a client to realize data transmission; the selection module is used for selecting any one USB input interface to be connected with the USB output interface; the control module is used for receiving a USB data request transmitted by a client through a USB input interface and controlling the selection module to connect the corresponding USB input interface and the corresponding USB output interface; and the USB output interface is used for being connected with the driving equipment to realize the transmission of client data. The invention avoids the requirement of repeatedly plugging and unplugging the USB output interface in the using process, avoids the time waste of plugging and unplugging the USB equipment and prolongs the service life of the interface of the USB equipment.)

1. A USB sharing device based on virtual control is characterized in that: comprises that

The USB input interfaces are used for being connected with the client to realize data transmission;

the selection module is used for selecting any one USB input interface to be connected with the USB output interface;

the control module is used for receiving a USB data request transmitted by a client through a USB input interface and controlling the selection module to connect the corresponding USB input interface and the corresponding USB output interface;

and the USB output interface is used for being connected with the driving equipment to realize the transmission of client data.

2. The virtual control-based USB sharing device according to claim 1, wherein: the control module includes:

the client application program module is used for transmitting the USB data request and providing the USB data request to the virtual bus driver program module;

the virtual bus driver module is used for collecting USB data requests and providing the USB data requests to the server application program module;

the server application program module is used for processing the USB data request and transmitting the request to the virtual equipment driver program module;

and the virtual device driver module is used for reconstructing the USB data request and transmitting the request to the selection module.

3. The virtual control-based USB sharing device according to claim 2, wherein: the control method of the control module comprises the following steps:

firstly, a client application program module initiates a request for establishing connection with a server application program module, a virtual bus driver module is formed after the connection is successfully established, and USB hardware information is acquired from a virtual equipment driver module by calling a WIN32 API function;

step two, the obtained USB hardware information is transmitted to a server side application program module through an established channel, namely a virtual bus driver module;

and step three, the server side application program module transmits the USB data request to the virtual equipment driver program module, the virtual equipment driver program module reconstructs the USB data request and transmits the request to the selection module, and the corresponding USB input interface is connected with the USB output interface.

4. The virtual control-based USB sharing device according to claim 2, wherein: the client application program module and the server application program module adopt a C/S communication model and are realized by Socket programming based on a TCP mode.

5. The virtual control-based USB sharing device according to claim 1, wherein: the sharing device further comprises a power supply module, wherein the power supply module is connected with the client through the USB input interface and used for supplying power to the control module through the client.

6. The virtual control-based USB sharing device according to claim 1, wherein: the USB input interface and the USB output interface are both connected with the input end of the short circuit detection unit, and the output end of the short circuit detection unit is connected with the display alarm unit.

7. The virtual control-based USB sharing device according to claim 1, wherein: the short circuit detection unit comprises at least three optical couplers, the three optical couplers are connected in series in the same direction and then connected in series between a main power supply and a ground end through a current-limiting resistor, each optical coupler is provided with a positive end and a ground end of a light-emitting diode as input ends of the short circuit detection unit, a collector of a triode is connected with the main power supply through a resistor respectively, and an emission set is used as an output end of the short circuit detection unit.

Technical Field

The invention relates to the technical field of computer peripheral sharing, in particular to a USB sharing device based on virtual control.

Background

USB is becoming increasingly popular as a universal bus. USB has been developed to USB version 4.0 today, and among the most commonly used USB devices, USB storage class devices have been widely used. U disks, mobile hard disks, extended hard disks based on USB and hard disk cartridges based on USB on the market are very common.

In the prior art, part of USB equipment such as a USB flash disk, an external mobile hard disk, an earphone (if only one pair is provided) and a printer need to be switched over with a computer, so that the USB flash disk can be plugged and pulled out for many times, time is wasted, and the service life of a USB interface of the equipment is influenced.

In view of the above, it is an urgent need in the art to provide a USB sharing device based on virtual control.

Disclosure of Invention

The invention aims to overcome the defects of the prior art, and provides a USB sharing device based on virtual control, which can avoid the requirement of repeatedly plugging and unplugging a USB output interface in the using process, avoid the time waste of plugging and unplugging USB equipment and prolong the service life of the interface of the USB equipment.

In order to solve the technical problems, the technical scheme of the invention is as follows: a virtual control-based USB sharing device, comprising: the USB input interfaces are used for being connected with the client to realize data transmission;

the selection module is used for selecting any one USB input interface to be connected with the USB output interface;

the control module is used for receiving a USB data request transmitted by a client through a USB input interface and controlling the selection module to connect the corresponding USB input interface and the corresponding USB output interface;

and the USB output interface is used for being connected with the driving equipment to realize the transmission of client data.

Preferably, the control module includes:

the client application program module is used for transmitting the USB data request and providing the USB data request to the virtual bus driver program module;

the virtual bus driver module is used for collecting USB data requests and providing the USB data requests to the server application program module;

the server application program module is used for processing the USB data request and transmitting the request to the virtual equipment driver program module;

and the virtual device driver module is used for reconstructing the USB data request and transmitting the request to the selection module.

Preferably, the control method of the control module includes the following steps:

firstly, a client application program module initiates a request for establishing connection with a server application program module, a virtual bus driver module is formed after the connection is successfully established, and USB hardware information is acquired from a virtual equipment driver module by calling a WIN32 API function;

step two, the obtained USB hardware information is transmitted to a server side application program module through an established channel, namely a virtual bus driver module;

and step three, the server side application program module transmits the USB data request to the virtual equipment driver program module, the virtual equipment driver program module reconstructs the USB data request and transmits the request to the selection module, and the corresponding USB input interface is connected with the USB output interface.

Preferably, a C/S communication model is adopted between the client application program module and the server application program module, and the C/S communication model is realized by Socket programming based on a TCP mode.

Preferably, the sharing device further comprises a power supply module, wherein the power supply module is connected with the client through a USB input interface and is used for supplying power to the control module through the client.

Preferably, the USB input interface and the USB output interface are both connected with the input end of the short circuit detection unit, and the output end of the short circuit detection unit is connected with the display alarm unit.

Preferably, the short circuit detection unit includes at least three optical couplers, the three optical couplers are connected in series in the same direction and then connected in series between the main power supply and the ground through a current-limiting resistor, each optical coupler has a positive terminal and a ground terminal of a light emitting diode as the input terminals of the short circuit detection unit, wherein a collector of a triode is connected to the main power supply through a resistor, and an emission set is used as the output terminal of the short circuit detection unit.

The invention has the beneficial effects that:

1. according to the USB hardware information connection method, the selection module and the control module, the connection between the corresponding USB input interface and the corresponding USB output interface is realized according to the acquired USB hardware information, the requirement of repeatedly plugging and unplugging the USB output interface can be avoided in the using process, the waste of time for plugging and unplugging the USB equipment is avoided, and the service life of the interface of the USB equipment is prolonged;

2. when no short circuit condition exists between the input ends of the short circuit detection unit, the output ends of the short circuit detection unit are all low levels, when any input end of the short circuit detection unit is in short circuit, at least one output end of the short circuit detection unit is high level, the display alarm unit can give alarm display, and operation personnel is prompted to process the alarm display.

Drawings

FIG. 1 is a schematic block diagram of the overall structure of a first embodiment of the present invention;

FIG. 2 is a block diagram illustrating a control module according to a first embodiment;

FIG. 3 is a schematic diagram illustrating the connection of the USB input interface, the short-circuit detection unit, and the display alarm unit according to the second embodiment;

FIG. 4 is a schematic structural diagram of a short-circuit detection unit according to a second embodiment;

fig. 5 is a schematic circuit diagram of the optical coupler according to the second embodiment.

Reference numerals: 1. a USB input interface; 2. a selection module; 3. a control module; 4. a USB output interface; 5. a client application module; 6. a virtual bus driver module; 7. a server application module; 8. a virtual device driver module; 9. a short circuit detection unit; 10. and displaying an alarm unit.

Detailed Description

The technical scheme of the invention is clearly and completely described in the following with reference to the accompanying drawings. In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance.

Example one

Referring to fig. 1 and 2, the present invention is a USB sharing device based on virtual control, including:

the USB input interfaces 1 are used for being connected with the client to realize data transmission;

the selection module 2 is connected with the plurality of USB input interfaces 1 and the USB output interfaces 4 and is used for realizing the connection of any one USB input interface 1 and any one USB output interface 4;

the control module 3 is connected to the selection module 2, and is used for receiving a USB data request transmitted by the client through the USB input interface 1, controlling the selection module 2, realizing the connection of the corresponding selection module 2, and connecting the corresponding USB input interface 1 and the corresponding USB output interface 4;

and the USB output interface 4 is used for being connected with the driving equipment to realize the transmission of client data.

Referring to fig. 2, the control module 3 includes a client application module 5, a virtual bus driver module 6, a server application module 7, and a virtual device driver module 8; the client application program module 5 is used for transmitting USB data requests and providing the USB data requests to the virtual bus driver program module 6; the virtual bus driver module 6 is used for collecting USB data requests and providing the USB data requests to the server application module 7; the server application program module 7 is used for processing the USB data request and transmitting the request to the virtual device driver program module 8; the virtual device driver module 8 is configured to reconstruct the USB data request and pass the request to the selection module 2. The client application module 5 and the server application module 7 adopt a C/S communication model and are realized by Socket programming based on a TCP mode.

The control method of the control module 3 is as follows:

firstly, a client application program module 5 initiates a request for establishing connection with a server application program module 7, after the connection is successfully established, a virtual bus driver module 6 is formed, and USB hardware information is obtained from a virtual equipment driver module 8 by calling a WIN32 API function;

step two, the obtained USB hardware information is transmitted to a server side application program module 7 through an established channel, namely a virtual bus driver program module 6;

and step three, the server application program module 7 transmits the USB data request to the virtual device driver program module 8, the virtual device driver program module 8 reconstructs the USB data request, transmits the request to the selection module 2, and performs connection corresponding to the USB input interface 1 and the USB output interface 4.

In the embodiment, the USB interface 1 is connected with the output interfaces of a plurality of clients, the USB output interface 4 is connected with the driving device, when one client needs to use the driving device, a request for establishing connection with the server application module 7 is firstly initiated through the client application module 5 corresponding to the client, after the connection is successfully established, USB hardware information is obtained from the virtual device driving program module 8 by calling a WIN32 API function, and the selection module 2 is controlled to work through the control module 3 according to the obtained USB hardware information, so that the connection between the corresponding USB input interface 1 and the USB output interface 4 is realized; the invention has novel structure and ingenious conception, can avoid the requirement of repeatedly plugging and unplugging the USB output interface 4 in the using process, avoids the time waste of plugging and unplugging the USB equipment and prolongs the service life of the interface of the USB equipment.

The sharing device further comprises a power supply module, wherein the power supply module is connected with the client through the USB input interface 1 and used for supplying power to the control module 3 through the client, and the purpose of supplying power to the control module 3 is achieved.

Example two:

the difference between this embodiment and the first embodiment is: a short circuit detection unit 9 and a display alarm unit 10 are added; the rest is the same as the first embodiment, and is not described herein.

With reference to fig. 3 to 5, the USB input interface 1 and the USB output interface 4 are both connected to the input end of the short-circuit detection unit 9, and the output end of the short-circuit detection unit 9 is connected to the display alarm unit 10; the connection relationship between the USB output interface 4 and the short-circuit detection unit 9 is not shown in fig. 3, and is the same as the connection relationship between the USB output interface 4 and the short-circuit detection unit 9.

Referring to fig. 4 and 5, the short circuit detection unit 9 includes at least three optical couplers, the three optical couplers are connected in series in the same direction and then connected in series between the main power supply and the ground through a current limiting resistor, each optical coupler has a light emitting diode with a positive end and a ground end as the input ends of the short circuit detection unit 9, a collector of a triode is connected to the main power supply through a resistor, and an emission set is used as the output end of the short circuit detection unit 9, when there is no short circuit between the input ends of the short circuit detection unit 9, the output end of the short circuit detection unit 9 is at a low level, when there is a short circuit between any input ends of the short circuit detection unit 9, at least one output end of the short circuit detection unit 9 is at a high level, and the display and alarm unit gives an alarm display to prompt an operator to process.

The parts not involved in the present invention are the same as or implemented using the prior art.

The foregoing is a more detailed description of the present invention that is presented in conjunction with specific embodiments, and the practice of the invention is not to be considered limited to those descriptions. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.

8页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种嵌入式处理器串口通信方法和软件开发工具包

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!