Data processing method and device

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

阅读说明:本技术 数据处理方法及装置 (Data processing method and device ) 是由 蔡显志 于 2021-08-03 设计创作,主要内容包括:本公开提供一种数据处理方法、装置、电子设备及存储介质,涉及云桌面领域,能够解决现有技术当有多个USB设备同时重定向时,多个USB设备的数据传输请求会按顺序依次到达数据传输请求队列中,然后依次处理会导致用户体验较差的问题。具体技术方案为:接收服务器发送的至少一个数据传输请求,所述数据传输请求包括所述数据传输请求待发送至的USB设备的标识信息;根据所述标识信息对所述至少一个数据传输请求进行分组,得到至少一个数据传输请求队列,每个数据传输请求队列包括至少一个数据传输请求;根据预设方式交替将所述至少一个数据传输请求队列中的数据传输请求发送至与该数据传输请求对应的USB设备。本发明用于提高用户体验。(The disclosure provides a data processing method and device, electronic equipment and a storage medium, relates to the field of cloud desktops, and can solve the problem that in the prior art, when a plurality of USB devices are simultaneously redirected, data transmission requests of the USB devices sequentially arrive at a data transmission request queue, and then the data transmission requests are sequentially processed to cause poor user experience. The specific technical scheme is as follows: receiving at least one data transmission request sent by a server, wherein the data transmission request comprises identification information of USB equipment to which the data transmission request is to be sent; grouping the at least one data transmission request according to the identification information to obtain at least one data transmission request queue, wherein each data transmission request queue comprises at least one data transmission request; and alternately sending the data transmission request in the at least one data transmission request queue to the USB equipment corresponding to the data transmission request according to a preset mode. The invention is used for improving the user experience.)

1. A data processing method, comprising:

receiving at least one data transmission request sent by a server, wherein the data transmission request comprises identification information of a Universal Serial Bus (USB) device to which the data transmission request is to be sent;

grouping the at least one data transmission request according to the identification information to obtain at least one data transmission request queue, wherein each data transmission request queue comprises at least one data transmission request;

and alternately sending the data transmission request in the at least one data transmission request queue to the USB equipment corresponding to the data transmission request according to a preset mode.

2. The method of claim 1, wherein the grouping the at least one USB device data transfer request according to the identification information comprises:

grouping the at least one data transmission request with the identification information consistent.

3. The method according to claim 1, wherein the identification information of the USB device includes a priority of the USB device, and the alternately sending the data transmission requests in the at least one data transmission request queue to the USB device corresponding to the data transmission request according to a preset manner includes:

and alternately sending the data transmission request in the at least one data transmission request queue to the USB equipment corresponding to the data transmission request according to the priority.

4. The method of claim 1, wherein before receiving at least one data transmission request sent by the server, the method further comprises:

receiving an admission USB equipment list sent by a server, wherein the admission USB equipment list comprises identification information of at least one USB equipment which can be connected to the server;

when the target USB equipment is determined to be inserted, acquiring identification information of the target USB equipment, wherein the target USB equipment is any one USB equipment;

when the identification information of the target USB equipment exists in the admittance USB equipment list, an indication message inserted by the target USB equipment is sent to a server, and the indication message comprises the identification information of the target USB equipment.

5. The method according to claim 4, wherein after sending the indication message of the target USB device insertion to the server, the method further comprises:

receiving a request descriptor command sent by a server, and sending the request descriptor command to the target USB equipment;

receiving a device descriptor returned by the target USB device according to the request descriptor command;

receiving a configuration request command sent by a server, and sending the configuration request command to the target USB equipment;

receiving configuration information returned by the target USB equipment according to the request configuration command;

and sending the configuration information and the device descriptor to a server so that the server distributes USB device drivers for the target USB device.

6. The method of claim 5, wherein the receiving at least one data transmission request sent by a server comprises:

and receiving at least one data transmission request sent by the server through the USB bus driver.

7. A data processing apparatus, comprising:

the data transmission request receiving module is used for receiving at least one data transmission request sent by a server, wherein the data transmission request comprises identification information of the USB equipment to which the data transmission request is to be sent;

a data transmission request grouping module, configured to group the at least one data transmission request according to the identification information to obtain at least one data transmission request queue, where each data transmission request queue includes at least one data transmission request;

and the data transmission request sending module is used for alternately sending the data transmission request in the at least one data transmission request queue to the USB equipment corresponding to the data transmission request according to a preset mode.

8. The apparatus of claim 7, wherein the data transmission request packet module is configured to:

grouping the at least one data transmission request with the identification information consistent.

9. An electronic device, comprising a processor and a memory, wherein at least one computer instruction is stored in the memory, and wherein the instruction is loaded and executed by the processor to implement the steps performed in the data processing method according to any one of claims 1 to 6.

10. A computer-readable storage medium having stored thereon at least one computer instruction, which is loaded and executed by a processor to perform the steps performed in the data processing method of any one of claims 1 to 6.

Technical Field

The disclosure relates to the field of cloud desktops, and in particular, to a data processing method and device.

Background

With the development of cloud computing technology application, in recent years, cloud desktops are applied more and more in various industries, and the use requirement for redirection of Universal Serial Bus (USB) devices is also more and more.

When a plurality of USB devices are redirected simultaneously, data transmission requests of the USB devices sequentially arrive at a data transmission request queue in sequence and then are processed sequentially. For example, if the device 1 is inserted into the computer and redirection is completed, and data interaction with the server is started, all data transmission requests of the device 1 will be in the data transmission request queue, and at this time, if the USB device 2 is inserted into the computer, the data transmission request of the device 2 will be queued in the data transmission request queue and be queued after the data transmission request of the device 1. Then when the data transmission request of device 2 is responded, it has already been separated by a long time from its insertion, which may cause the user to feel that the recognition time of device 2 is long and the user experience is poor.

Disclosure of Invention

The embodiment of the disclosure provides a data transmission method and device, which can solve the problem that in the prior art, when a plurality of USB devices are simultaneously redirected, data transmission requests of the USB devices sequentially arrive in a data transmission request queue, and then the data transmission requests are sequentially processed, so that user experience is poor. The technical scheme is as follows:

according to a first aspect of the embodiments of the present disclosure, there is provided a data processing method, including:

receiving at least one data transmission request sent by a server, wherein the data transmission request comprises identification information of USB equipment to which the data transmission request is to be sent;

grouping the at least one data transmission request according to the identification information to obtain at least one data transmission request queue, wherein each data transmission request queue comprises at least one data transmission request;

and alternately sending each data transmission request in the at least one data transmission request queue to the USB equipment corresponding to the data transmission request according to a preset mode.

The data processing method provided by the embodiment of the disclosure can receive at least one data transmission request sent by a server, wherein the data transmission request comprises identification information of a USB device to which the data transmission request is to be sent; grouping the at least one data transmission request according to the identification information to obtain at least one data transmission request queue, wherein each data transmission request queue comprises at least one data transmission request; the data transmission requests in the at least one data transmission request queue are alternately sent to the USB equipment corresponding to the data transmission requests according to a preset mode, so that the problem that in the prior art, when a plurality of USB equipment are redirected simultaneously, the data transmission requests of the plurality of USB equipment sequentially arrive in the data transmission request queue, and then are sequentially processed to cause poor user experience can be solved, and the user experience is improved.

In one embodiment, said grouping said at least one USB device data transfer request according to said identification information comprises:

grouping the at least one data transmission request with the identification information consistent.

In one embodiment, the identification information of the USB device includes a priority of the USB device, and the alternately sending the data transmission requests in the at least one data transmission request queue to the USB device corresponding to the data transmission request according to a preset manner includes:

and alternately sending the data transmission request in the at least one data transmission request queue to the USB equipment corresponding to the data transmission request according to the priority.

In one embodiment, before the receiving at least one data transmission request sent by the server, the method further includes:

receiving an admission USB equipment list sent by a server, wherein the admission USB equipment list comprises identification information of at least one USB equipment which can be connected to the server;

when the target USB equipment is determined to be inserted, acquiring identification information of the target USB equipment, wherein the target USB equipment is any one USB equipment;

when the identification information of the target USB equipment exists in the admittance USB equipment list, an indication message inserted by the target USB equipment is sent to a server, and the indication message comprises the identification information of the target USB equipment.

In one embodiment, after sending the indication message of the target USB device insertion to the server, the method further includes:

receiving a request descriptor command sent by a server, and sending the request descriptor command to the target USB equipment;

receiving a device descriptor returned by the target USB device according to the request descriptor command;

receiving a configuration request command sent by a server, and sending the configuration request command to the target USB equipment;

receiving configuration information returned by the target USB equipment according to the request configuration command;

and sending the configuration information and the device descriptor to a server so that the server distributes USB device drivers for the target USB device.

In one embodiment, the receiving at least one data transmission request sent by the server includes:

and receiving at least one data transmission request sent by the server through the USB bus driver.

According to a second aspect of the embodiments of the present disclosure, there is provided a data processing apparatus including:

the data transmission request receiving module is used for receiving at least one data transmission request sent by a server, wherein the data transmission request comprises identification information of the USB equipment to which the data transmission request is to be sent;

a data transmission request grouping module, configured to group the at least one data transmission request according to the identification information to obtain at least one data transmission request queue, where each data transmission request queue includes at least one data transmission request;

and the data transmission request sending module is used for alternately sending the data transmission request in the at least one data transmission request queue to the USB equipment corresponding to the data transmission request according to a preset mode.

In one embodiment, the data transmission request packet module is to:

grouping the at least one data transmission request with the identification information consistent.

In one embodiment, the identification information of the USB device includes a priority of the USB device, and the data transmission request sending module 303 is configured to:

and alternately sending the data transmission request in the at least one data transmission request queue to the USB equipment corresponding to the data transmission request according to the priority.

In one embodiment, the apparatus further comprises:

an indication message sending module, configured to:

receiving an admission USB equipment list sent by a server, wherein the admission USB equipment list comprises identification information of at least one USB equipment which can be connected to the server;

when the target USB equipment is determined to be inserted, acquiring identification information of the target USB equipment, wherein the target USB equipment is any one USB equipment;

when the identification information of the target USB equipment exists in the admittance USB equipment list, an indication message inserted by the target USB equipment is sent to a server, and the indication message comprises the identification information of the target USB equipment.

In one embodiment, the apparatus further comprises:

a configuration information transmitting module for

Receiving a request descriptor command sent by a server, and sending the request descriptor command to the target USB equipment;

receiving a device descriptor returned by the target USB device according to the request descriptor command;

receiving a configuration request command sent by a server, and sending the configuration request command to the target USB equipment;

receiving configuration information returned by the target USB equipment according to the request configuration command;

and sending the configuration information and the device descriptor to a server so that the server distributes USB device drivers for the target USB device.

In one embodiment, the data transmission request receiving module is configured to:

and receiving at least one data transmission request sent by the server through the USB bus driver.

According to a third aspect of embodiments of the present disclosure, there is provided an electronic device, which includes a processor and a memory, where at least one computer instruction is stored, and the instruction is loaded and executed by the processor to implement the steps executed in the data processing method according to any one of the first aspect.

According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium having stored therein at least one computer instruction, which is loaded and executed by a processor to implement the steps performed in the data processing method of any one of the first aspect.

It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.

Fig. 1 is a flowchart of a data processing method provided by an embodiment of the present disclosure;

FIG. 2 is a schematic diagram of a USB redirection provided by an embodiment of the present disclosure;

FIG. 3 is a block diagram of a data processing apparatus according to an embodiment of the present disclosure;

fig. 4 is a second structural diagram of a data processing apparatus according to an embodiment of the present disclosure;

fig. 5 is a block diagram of an electronic device provided in an embodiment of the present disclosure.

Detailed Description

Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.

Fig. 1 is a flowchart of a data processing method according to an embodiment of the present disclosure. As shown in fig. 1, the method includes:

s101, at least one data transmission request sent by a server is received, and the data transmission request comprises identification information of USB equipment to which the data transmission request is to be sent.

In this embodiment, before receiving at least one data transmission request sent by the server, the method further includes:

receiving an admission USB equipment list sent by a server, wherein the admission USB equipment list comprises identification information of at least one USB equipment which can be connected to the server; when the target USB equipment is determined to be inserted, acquiring identification information of the target USB equipment, wherein the target USB equipment is any one USB equipment; when the identification information of the target USB equipment exists in the admittance USB equipment list, an indication message inserted by the target USB equipment is sent to a server, and the indication message comprises the identification information of the target USB equipment.

Further, after the server sends an indication message inserted by the target USB device, receiving a request descriptor command sent by the server, and sending the request descriptor command to the target USB device; receiving a device descriptor returned by the target USB device according to the request descriptor command; receiving a configuration request command sent by a server, and sending the configuration request command to the target USB equipment; receiving configuration information returned by the target USB equipment according to the request configuration command; and sending the configuration information and the device descriptor to a server so that the server distributes USB device drivers for the target USB device.

This is explained below with reference to fig. 2. Fig. 2 is a schematic diagram of USB port redirection provided in an embodiment of the present disclosure. In this embodiment, the terminal device is a terminal device that can be plugged into a USB device, for example, a PC, a desktop, or the like, and serves as a client. As shown in fig. 2, the server sets a virtual USB bus driver in the virtual machine allocated to the terminal device, and sets a virtual USB driver in the terminal device, so as to implement zooming of the USB bus driver. The data of the USB equipment inserted into the terminal equipment is transmitted to the virtual machine USB driver through the USB bus of the terminal equipment, and the virtual USB driver is responsible for bidirectional data transmission between the USB bus driver of the terminal equipment and the USB client, so that all data of the USB equipment is transmitted really. The USB device driver is installed and operated in the virtual machine and interacts with the virtual machine USB bus driver, so that the USB device driver in the virtual machine does not sense that the controlled USB device is actually on the terminal device, and the application program does not sense the difference. The USB port redirection is irrelevant to specific USB equipment and application, and the USB port can be directly redirected to a virtual machine which is distributed by a server for the terminal equipment, so that the terminal equipment can transmit the data of the USB equipment to the virtual machine.

Illustratively, a virtual machine allocated by the server for the terminal device sends an allowed USB device list to the terminal device, where the allowed USB device list includes identification information of at least one USB device that can be connected to the server, i.e., the virtual machine; after receiving the access USB equipment list, the terminal equipment acquires the identification information of the target USB equipment when the target USB equipment is determined to be inserted, wherein the target USB equipment is any one USB equipment;

and when determining that the identification information of the target USB equipment exists in the access USB equipment list, the terminal equipment sends an indication message inserted by the target USB equipment to the virtual machine, wherein the indication message comprises the identification information of the target USB equipment.

Further, after the terminal device sends an indication message inserted by the target USB device to the virtual machine, the virtual machine requests a descriptor command from the terminal device according to the indication message, and after receiving the descriptor command, the terminal device sends the descriptor command to the target USB device; and the target USB equipment sends the equipment descriptor to the virtual machine according to the equipment descriptor returned by the request descriptor command to the terminal equipment. Exemplarily, after the terminal device sends the indication message inserted by the target USB device to the virtual machine, the virtual machine further sends a configuration request command to the terminal device, and the terminal device receives the configuration request command sent by the virtual machine and sends the configuration request command to the target USB device; the target USB equipment returns configuration information to the terminal equipment according to the request configuration command; the terminal device sends the configuration information to the virtual machine, the virtual machine acquires information such as manufacturer, product description and model of the target USB device according to the configuration information, and then the virtual machine allocates USB device drive for the target USB device according to the information such as manufacturer, product description and model of the target USB device and the device descriptor of the USB device. The process of allocating the USB device driver to the other USB device by the virtual machine is similar to that of the target USB device, and details are not repeated here.

For example, after the virtual machine allocates a USB device driver to each USB device of at least one USB device that can be connected to the virtual machine and is inserted into the terminal device, the virtual machine may send a data transmission request of each USB device to the terminal device through the USB device driver, where the data transmission request includes identification information of the USB device, that is, the terminal device receives at least one data transmission request sent by the virtual machine that is allocated to the terminal device through the USB bus driver by the server, and the at least one data transmission request is a data transmission request sent by the virtual machine to the terminal device through the USB device driver by the virtual machine.

S102, grouping the at least one data transmission request according to the identification information to obtain at least one data transmission request queue, wherein each data transmission request queue comprises at least one data transmission request.

In this embodiment, at least one data transmission request with consistent identification information is grouped into one group.

For example, the identification information in the data transmission request is at least one data transmission request of the usb disk and is grouped into one group, that is, all data transmission requests of the usb disk are in queue 1, and the identification information in the data transmission request is all data transmission requests of the camera and is grouped into 1 group and is in queue 2. It should be noted that, for example, as shown in fig. 2, all data transmission requests of the USB disk are transmitted from the USB device driver of the USB disk to the USB virtual bus driver, then transmitted from the USB virtual bus driver to the USB server, then transmitted from the USB server to the USB client of the terminal device through the protocol channel, then transmitted from the USB client to the virtual USB driver, then transmitted from the virtual USB driver to the USB bus driver of the terminal device, and then transmitted to the USB bus of the terminal device, and then transmitted from the USB bus of the terminal device to the USB disk. All data transmission request processes of the camera are similar to those of the usb disk, and this embodiment is not described herein again.

S103, alternately sending the data transmission request in the at least one data transmission request queue to the USB equipment corresponding to the data transmission request according to a preset mode.

Exemplarily, the sending of the data transmission request in the at least one data transmission request queue to the USB device corresponding to the data transmission request alternately according to a preset manner by the identification information of the USB device, including the priority of the USB device, includes:

and alternately sending the data transmission requests in the at least one data transmission request queue to the USB equipment corresponding to the data transmission requests according to the priority.

For example, the priority of the camera is 1 level, the priority of the usb disk is 2 level, and the priority of the camera is higher than that of the usb disk, in this embodiment, the data transmission requests in the queue 2 in the preset number may be sent to the camera in sequence, and then the data transmission requests in the queue 1 in the preset number may be sent to the usb disk in sequence, so that the data transmission requests in the queue 1 and the data transmission requests in the queue 2 are sent alternately. The data transmission requests in the queue 2 can be sent to the camera in sequence within a preset time length, and then the data transmission requests in the queue 1 can be sent to the USB flash disk in sequence within the preset time length, so that the data transmission requests in the queue 1 and the data transmission requests in the queue 2 can be sent alternately. Therefore, the data transmission requests in each queue are processed alternately according to the priority, the problem that the user feels that the identification time of the camera is long due to the fact that the USB flash disk is inserted into the USB flash disk and the data transmission requests of the USB flash disk are processed all the time is solved, and user experience is improved.

It should be noted here that after sending a data transmission request, the terminal device may send the next data transmission request without waiting for the data returned by the USB device according to the data transmission request. And when receiving the data returned by the USB equipment, sending the data to the virtual machine. For example, as shown in fig. 2, data returned by the USB disk according to the data transmission request is transmitted to the USB bus driver via the USB bus of the terminal device, then transmitted to the USB client by the USB bus driver, then transmitted to the USB server of the virtual machine by the USB client, then transmitted to the USB virtual bus driver by the USB server, and finally transmitted to the USB device driver of the USB disk by the USB virtual bus driver. The transmission process of the data returned by the camera according to the data transmission request is similar to that of the usb flash disk, and details are not described here in this embodiment.

The data processing method provided by the embodiment of the disclosure can receive at least one data transmission request sent by a server, wherein the data transmission request comprises identification information of a USB device to which the data transmission request is to be sent; grouping the at least one data transmission request according to the identification information to obtain at least one data transmission request queue, wherein each data transmission request queue comprises at least one data transmission request; the data transmission requests in the at least one data transmission request queue are alternately sent to the USB equipment corresponding to the data transmission requests according to a preset mode, so that the problem that in the prior art, when a plurality of USB equipment are redirected simultaneously, the data transmission requests of the plurality of USB equipment sequentially arrive in the data transmission request queue, and then are sequentially processed to cause poor user experience can be solved, and the user experience is improved.

Based on the data processing method described in the embodiment corresponding to fig. 1, the following is an embodiment of the apparatus of the present disclosure, which can be used to execute an embodiment of the method of the present disclosure.

Fig. 3 is a first schematic structural diagram of a data processing apparatus according to an embodiment of the present disclosure. As shown in fig. 3, the data transmission device 30 includes:

a data transmission request receiving module 301, configured to receive at least one data transmission request sent by a server, where the data transmission request includes identification information of a USB device to which the data transmission request is to be sent;

a data transmission request grouping module 302, configured to group the at least one data transmission request according to the identification information to obtain at least one data transmission request queue, where each data transmission request queue includes at least one data transmission request;

a data transmission request sending module 303, configured to send the data transmission request in the at least one data transmission request queue to the USB device corresponding to the data transmission request alternately according to a preset manner.

In one embodiment, the data transmission request packet module 302 is configured to:

grouping the at least one data transmission request with the identification information consistent.

In one embodiment, the identification information of the USB device includes a priority of the USB device, and the data transmission request sending module 303 is configured to:

and alternately sending the data transmission request in the at least one data transmission request queue to the USB equipment corresponding to the data transmission request according to the priority.

In one embodiment, the apparatus 30 further comprises:

an indication message sending module 304, configured to:

receiving an admission USB equipment list sent by a server, wherein the admission USB equipment list comprises identification information of at least one USB equipment which can be connected to the server;

when the target USB equipment is determined to be inserted, acquiring identification information of the target USB equipment, wherein the target USB equipment is any one USB equipment;

when the identification information of the target USB equipment exists in the admittance USB equipment list, an indication message inserted by the target USB equipment is sent to a server, and the indication message comprises the identification information of the target USB equipment.

In one embodiment, the apparatus 30 further comprises:

a configuration information transmitting module 305 for

Receiving a request descriptor command sent by a server, and sending the request descriptor command to the target USB equipment;

receiving a device descriptor returned by the target USB device according to the request descriptor command;

receiving a configuration request command sent by a server, and sending the configuration request command to the target USB equipment;

receiving configuration information returned by the target USB equipment according to the request configuration command;

and sending the configuration information and the device descriptor to a server so that the server distributes USB device drivers for the target USB device.

In one embodiment, the data transmission request receiving module 301 is configured to:

and receiving at least one data transmission request sent by the server through the USB bus driver.

For the data processing apparatus provided in the embodiment of the present disclosure, the implementation process and the technical effect thereof may refer to the embodiment of fig. 1, and are not described herein again.

Fig. 5 is a structural diagram of an electronic device according to an embodiment of the disclosure, and as shown in fig. 5, the electronic device 50 includes:

a processor 501 and a memory 502, the memory 502 having stored therein at least one computer instruction, which is loaded and executed by the processor 501 to implement the data processing method described in the above method embodiments.

Based on the data processing method described in the embodiment corresponding to fig. 1, an embodiment of the present disclosure further provides a computer-readable storage medium, for example, the non-transitory computer-readable storage medium may be a Read Only Memory (ROM), a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like. The storage medium stores computer instructions for executing the data processing method described in the embodiment corresponding to fig. 1, which is not described herein again.

It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.

Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:USB设备重定向方法及装置

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!