Hot-swap device information transmission method, computer device, and readable medium

By detecting hot-swappable devices in the cloud system and establishing device nodes to directly report operation event information, the complexity of device redirection channels in the existing technology is solved, and more flexible device support and lower-latency information transmission are achieved.

CN114615527BActive Publication Date: 2025-09-16ZTE CORP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011339047.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-25
Publication Date
2025-09-16
Estimated Expiration
2040-11-25

AI Technical Summary

Technical Problem

When existing cloud systems support hot-swappable devices, especially non-standard USB input devices such as wireless Bluetooth controllers, there are difficulties in reporting information through the device redirection channel, which requires terminal-side permission upgrades and user settings, making implementation complex.

Method used

By detecting the action of hot-plugging devices, obtaining device information and loading drivers, creating device nodes, establishing a communication channel between the terminal device and the virtual machine, directly reporting operation event information, replacing the device redirection channel, and supporting more device types.

Benefits of technology

It improves the compatibility and flexibility of the cloud system for hot-swappable devices, simplifies the device support process, and reduces the delay of device operation event information and the risk of network congestion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114615527B_ABST
    Figure CN114615527B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method for transmitting hot-pluggable device information. In response to detecting that a hot-pluggable device is hot-plugged in a terminal device, the method obtains device information of the hot-pluggable device. In response to the hot-pluggable action being an insertion action, the method sends a first message carrying the device information to a hot-pluggable processing device, causing the hot-pluggable processing device to load a device driver and create a device node based on the device information. In response to receiving operation event information sent by the hot-pluggable device, the method sends a second message carrying at least the operation event information to the hot-pluggable processing device, causing the hot-pluggable processing device to write the operation event information to the device node, which then reports the operation event information to the operating system using the device driver. This method can expand the application scenarios of the spice client component, provide more flexible support for hot-pluggable devices, and improve the compatibility of cloud systems with hot-pluggable devices. The present disclosure also provides a computer device and a readable medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of communication technology, and in particular to a hot-swap device information transmission method, a computer device, and a readable medium. Background Art

[0002] With the rapid development of cloud computing and virtualization technologies, cloud-based set-top boxes (STBs) have gradually gained user acceptance and hold a promising future. Using cloud-based products, users can remotely access virtual desktops for entertainment and office work through physical STBs, thin clients, or dedicated PCs (personal computers). However, compared to traditional physical PCs, cloud-based products lack support for hot-swappable devices.

[0003] Existing cloud-based system solutions use spice (Simple Protocol for Independent Computing Environment) hot-swappable devices. For example, standard USB (Universal Serial Bus) input devices, such as keyboards and mice, can report operation event information through the standard input device channels defined by spice. Non-standard USB input devices, such as wireless Bluetooth controllers, can report operation event information through the spice device redirection channel. Under these two information reporting methods, the USB input device information reporting process is: USB input device - spice client (client) of the terminal device - spice server (server) - qemu (virtual operating system emulator) - virtual machine. The above information reporting process has the following deficiencies or limitations:

[0004] For USB devices that use the device redirection channel to report information, it is necessary to enable read and write permissions for the USB input device node file on the terminal side, for example, if a version upgrade is required. However, some third-party terminal devices (such as third-party set-top boxes) require user settings to achieve this, which is difficult to implement. Summary of the Invention

[0005] The present disclosure provides a hot-swap device information transmission method, a computer device, and a readable medium.

[0006] In a first aspect, an embodiment of the present disclosure provides a method for transmitting hot-swappable device information, comprising:

[0007] In response to detecting that a hot-plug device is hot-plugged in the terminal device, obtaining device information of the hot-plug device;

[0008] In response to the hot plug action being an insertion action, sending a first message carrying the device information to a hot plug processing device, so that the hot plug processing device loads a device driver and creates a device node according to the device information;

[0009] In response to receiving the operation event information sent by the hot plug device, a second message carrying at least the operation event information is sent to the hot plug processing device, so that the hot plug processing device writes the operation event information into the device node, and the device node uses the device driver to report the operation event information to the operating system.

[0010] In another aspect, an embodiment of the present disclosure provides a method for transmitting hot-swappable device information, comprising:

[0011] In response to receiving a first message sent by the terminal device, obtaining device information of the hot-swappable device carried therein;

[0012] Loading a device driver according to the device information, and creating a device node according to the device information;

[0013] In response to receiving the second message sent by the terminal device, obtaining the operation event information carried therein;

[0014] The operation event information is written into the device node, so that the device node reports the operation event information to the operating system using the device driver.

[0015] In another aspect, an embodiment of the present disclosure further provides a computer device, comprising:

[0016] one or more processors;

[0017] a storage device having one or more programs stored thereon;

[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the hot-plug device information transmission method as described above.

[0019] On the other hand, an embodiment of the present disclosure further provides a computer-readable medium having a computer program stored thereon, wherein when the program is executed, the hot-swappable device information transmission method as described above is implemented.

[0020] The hot-plug device information transmission method provided by the embodiment of the present disclosure obtains device information of the hot-plug device in response to detecting that the hot-plug device is hot-plugged in the terminal device; sends a first message carrying the device information to a hot-plug processing device in response to the hot-plugging action being an insertion action, so that the hot-plug processing device loads a device driver and creates a device node according to the device information; sends a second message carrying at least the operation event information to the hot-plug processing device in response to receiving operation event information sent by the hot-plug device, so that the hot-plug processing device writes the operation event information to the device node, and the device node reports the operation event information to the operating system using the device driver; after detecting the insertion action of the hot-plug device, the embodiment of the present disclosure establishes a device node to establish a communication channel between a spice client component of the terminal device and a virtual machine, thereby replacing the existing device redirection channel and implementing the reporting of hot-plug device operation event information. This can expand the application scenarios of the spice client component of the terminal device, provide more flexible support for external hot-plug devices, and improve the compatibility of the cloud system with hot-plug devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 A schematic diagram of the cloud system architecture provided by an embodiment of the present disclosure;

[0022] Figure 2 Schematic diagram of the process of the terminal side hot plug device information transmission method provided by the embodiment of the present disclosure Figure 1 ;

[0023] Figure 3 A schematic diagram of a process for filtering operation event information provided by an embodiment of the present disclosure;

[0024] Figure 4 Schematic diagram of the process of the terminal side hot plug device information transmission method provided by the embodiment of the present disclosure Figure 2 ;

[0025] Figure 5 A schematic diagram of the message structure of the second message provided in an embodiment of the present disclosure;

[0026] Figure 6 Schematic diagram of the process of the terminal side hot plug device information transmission method provided by the embodiment of the present disclosure Figure 3 ;

[0027] Figure 7 Schematic diagram of the process of the network side hot plug device information transmission method provided by the embodiment of the present disclosure Figure 1 ;

[0028] Figure 8 Schematic diagram of the process of deleting a device node provided in the embodiment of the present disclosure Figure 2 ;

[0029] Figure 9 Schematic diagram of the process of the network side hot plug device information transmission method provided by the embodiment of the present disclosure Figure 2 ;

[0030] Figure 10 A schematic diagram of the structure of the terminal device provided in the embodiment of the present disclosure Figure 1 ;

[0031] Figure 11 A schematic diagram of the structure of the terminal device provided in the embodiment of the present disclosure Figure 2 ;

[0032] Figure 12 A schematic diagram of the structure of the hot-swap processing device provided in the embodiment of the present disclosure Figure 1 ;

[0033] Figure 13 A schematic diagram of the structure of the hot-swap processing device provided in the embodiment of the present disclosure Figure 2 ;

[0034] Figure 14 A schematic diagram of the structure of the hot-swap processing device provided in the embodiment of the present disclosure Figure 3 . DETAILED DESCRIPTION

[0035] Example embodiments will be described more fully hereinafter with reference to the accompanying drawings, but the example embodiments may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the scope of this disclosure to those skilled in the art.

[0036] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0037] The terms used herein are used only to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a," "an," and "the" are also intended to include the plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "comprising" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements, and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or groups thereof is not excluded.

[0038] The embodiments described herein may be described with reference to plan views and / or cross-sectional views, with the aid of idealized schematic diagrams of the present disclosure. Thus, the example illustrations may be modified based on manufacturing techniques and / or tolerances. Therefore, the embodiments are not limited to the embodiments shown in the accompanying drawings, but include modifications of the configurations formed based on the manufacturing process. Therefore, the regions illustrated in the accompanying drawings are schematic in nature, and the shapes of the regions shown in the drawings illustrate specific shapes of the regions of the elements, but are not intended to be limiting.

[0039] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless expressly defined as such herein.

[0040] The embodiment of the present disclosure provides a method for transmitting hot-swappable device information, which is applied to a cloud system. Figure 1 As shown, the cloud system includes: a hot-swappable device, a terminal device, and a hot-swappable processing device (i.e., a virtual machine), wherein the hot-swappable processing device is a cloud device, the hot-swappable device and the terminal device are terminal-side devices, and the terminal device and the hot-swappable processing device communicate via a TCP (Transmission Control Protocol) network. The terminal device can be a physical set-top box, and the hot-swappable device can be a USB hot-swappable device, such as a USB wired or wireless Bluetooth controller. The hot-swappable processing device includes a vdagent (virtual daemon agent) module and a daemon module. The daemon module is used to create / delete device nodes corresponding to the hot-swappable device, and load / unload the corresponding device driver; the terminal device includes a spice client component, which is used to report the hot-swappable action and operation event information of the hot-swappable device to the vdagent module of the hot-swappable processing device.

[0041] like Figure 2 As shown, the hot-swappable device information transmission method provided by the embodiment of the present disclosure includes the following steps:

[0042] Step 11: In response to detecting that a hot-plug device is hot-plugged in the terminal device, device information of the hot-plug device is obtained.

[0043] In this step, the terminal device's spice client component uses the Netlink (socket) mechanism to detect whether a hot-plug device has been hot-plugged. Because the terminal device has pre-compiled the relevant USB hot-plug device driver into its kernel, the terminal device can directly support the USB hot-plug device after it is inserted. Therefore, when the terminal device's spice client component detects a hot-plug device being hot-plugged, it can obtain the USB hot-plug device's device information through the sysfs file system.

[0044] In some embodiments, the device information is part of the device descriptor information and may include VID (vendor ID) and PID (product ID) information of the USB hot plug device.

[0045] Step 12: In response to the hot plug action being an insert action, a first message carrying device information is sent to the hot plug processing device, so that the hot plug processing device loads a device driver according to the device information and creates a device node.

[0046] Hot-plugging actions include insertion and removal. In this step, the spice client component of the terminal device determines that the hot-plugging action is an insertion action and reports the device information of the hot-plugging device to the hot-plugging processing device (i.e., the virtual machine). The daemon module of the virtual machine then loads the device driver corresponding to the hot-plugging device and creates a device node corresponding to the hot-plugging device.

[0047] After the hot-plug device is inserted into the terminal device, the terminal device enumerates the inserted hot-plug device, loads the corresponding device driver, and initializes the hot-plug device. After the initialization is completed, the hot-plug device can work normally.

[0048] Step 13: Receive operation event information sent by the hot-swappable device.

[0049] In this step, once the user operates the hot-swappable device, for example, clicks a button of the hot-swappable device, the hot-swappable device will report the "button" operation event information to the spice client component of the terminal device.

[0050] Step 14: Send a second message carrying at least the operation event information to the hot plug processing device, so that the hot plug processing device writes the operation event information into the device node, and the device node reports the operation event information to the operating system using the device driver.

[0051] After receiving the operation event information sent by the hot-swappable device, the spice client component of the terminal device reports the operation event information to the vdagent module of the virtual machine. The vdagent module of the virtual machine writes the operation event information to the device node, and the device node reports the operation event information to the operating system through the device driver.

[0052] The hot-plug device information transmission method provided by the embodiment of the present disclosure obtains device information of the hot-plug device in response to detecting that the hot-plug device is hot-plugged in the terminal device; sends a first message carrying the device information to a hot-plug processing device in response to the hot-plugging action being an insertion action, so that the hot-plug processing device loads a device driver and creates a device node according to the device information; sends a second message carrying at least the operation event information to the hot-plug processing device in response to receiving operation event information sent by the hot-plug device, so that the hot-plug processing device writes the operation event information to the device node, and the device node reports the operation event information to the operating system using the device driver; after detecting the insertion action of the hot-plug device, the embodiment of the present disclosure establishes a device node to establish a communication channel between a spice client component of the terminal device and a virtual machine, thereby replacing the existing device redirection channel and implementing the reporting of hot-plug device operation event information. This can expand the application scenarios of the spice client component of the terminal device, provide more flexible support for external hot-plug devices, and improve the compatibility of the cloud system with hot-plug devices.

[0053] In some embodiments, after obtaining the device information of the hot-pluggable device (i.e., step 11), the hot-pluggable device information transmission method may further include the following steps: in response to the hot-plug action being a removal action, sending a third message carrying the device information to the hot-pluggable processing device, so that the hot-pluggable processing device uninstalls the device driver and deletes the device node based on the device information. In this step, after the spice client component of the terminal device determines that the hot-pluggable action is a removal action, it reports the device information of the hot-pluggable device to the vdagent module of the virtual machine. The vdagent module of the virtual machine then instructs the daemon module to uninstall the device driver of the hot-pluggable device and delete the device node corresponding to the hot-pluggable device.

[0054] In some embodiments, the sending of the third message carrying device information to the hot-plug processing device includes: in response to the network status not meeting the first preset condition, suspending the sending of the third message carrying device information to the hot-plug processing device until the network status meets the first preset condition, and then sending the third message carrying device information to the hot-plug processing device. In some embodiments, meeting the first preset condition means that the terminal device is connected to the TCP network, that is, the data transmission condition is met. Correspondingly, not meeting the first preset condition means that the terminal device is disconnected from the TCP network (that is, not connected to the TCP network), that is, the data transmission condition is not met. That is, before the terminal device sends the third message to the virtual machine, it first determines the network status and sends the third message after confirming that the current network status meets the data transmission condition. If the current network status does not meet the data transmission condition, the third message is not sent first, and is sent again after the network status meets the data transmission condition. That is, if the TCP network is unavailable, the terminal device waits in a loop until the TCP network is restored or the hot-plug device is unplugged from the terminal device.

[0055] In some embodiments, the sending of the first message carrying device information to the hot-plug processing device (i.e., step 12) includes the following steps: in response to the network status not satisfying the first preset condition, suspending the sending of the first message carrying device information to the hot-plug processing device until the network status satisfies the first preset condition, and then sending the first message carrying device information to the hot-plug processing device. In some embodiments, satisfying the first preset condition means that the terminal device is connected to the TCP network, that is, the data transmission condition is satisfied. Correspondingly, not satisfying the first preset condition means that the terminal device is disconnected from the TCP network (i.e., not connected to the TCP network), that is, the data transmission condition is not satisfied. That is to say, before the terminal device sends the first message to the virtual machine, it first judges the network status, and sends the first message after confirming that the current network status satisfies the data transmission condition. If the current network status does not satisfy the data transmission condition, the first message is not sent first, and it is sent after the network status satisfies the data transmission condition.

[0056] Typically, when a terminal device's spice client component sends data to a cloud-based virtual machine, the network environment can affect data transmission latency, making it uncontrollable. Furthermore, when using a device redirection channel for data transmission, the operational event information reported by the terminal device's spice client component is large, increasing the potential for TCP network congestion.

[0057] In order to solve the above problems, in some embodiments, as Figure 3 As shown, the sending of the second message carrying at least the operation event information to the hot plug processing device (i.e., step 14) includes the following steps:

[0058] Step 131 : In response to the network status satisfying a first preset condition and not satisfying a second preset condition, filtering operation event information.

[0059] In some embodiments, satisfying the first preset condition and not satisfying the second preset condition means that the TCP network is connected but the network condition is poor. It should be noted that the poor network condition can be judged by whether the network parameters reach a threshold, for example, excessive delay.

[0060] In this step, when the spice client component of the terminal device determines that the current network condition is poor, it filters the reported operation event information, for example, by removing time information, to obtain filtered operation event information. The filtered operation event information may include: event type, time code, and event value.

[0061] Step 132: Send a second message carrying at least the filtered operation event information to the hot-swap processing device.

[0062] In this step, the spice client component of the terminal device can send the second message to the virtual machine in a segmented transmission manner, that is, send the second message to the spice server, and the spice server sends the second message to the vdagent module of the virtual machine. The segmented transmission method can ensure the stability of the data transmission of the operation event information.

[0063] The spice client component of the terminal device reduces the size of the data packet sent to the virtual machine by filtering the operation event information, which can reduce the possibility of TCP network congestion, reduce data transmission delay, and improve data transmission efficiency.

[0064] In some embodiments, as Figure 4 As shown, after receiving the operation event information (i.e., step 13) sent by the hot plug device, before sending the second message (step 14) at least carrying the operation event information to the hot plug processing device, the hot plug device information transmission method can also include the following steps:

[0065] Step 13': Calculate first verification information according to the operation event information.

[0066] In this step, the spice client component of the terminal device calculates a checksum based on the operation event information, such as the event type, event code, and event value. This checksum is the first verification information used by the virtual machine to verify the operation event. In some embodiments, the first verification information can be calculated using a hash algorithm.

[0067] Correspondingly, the sending of the second message carrying at least the operation event information to the hot plug processing device (i.e., step 14) includes: sending the second message carrying the operation event information and the first verification information to the hot plug processing device, so that the hot plug processing device writes the operation event information into the device node after passing the verification according to the first verification information, and the device node uses the device driver to report the operation event information to the operating system.

[0068] By sending the first verification information to the virtual machine so that the virtual machine can perform data verification, the reliability of data transmission can be improved and the reliability of data reporting can be controlled.

[0069] In some embodiments, the message format of the second message is as follows: Figure 5 As shown, it includes: a packet header, a packet length, a packet type, data and a check field, wherein the data field is used to carry the operation event information, and the check field is used to carry the first check information.

[0070] In some embodiments, as Figure 6 As shown, after sending the second message carrying the operation event information and the first verification information to the hot plug processing device (i.e., step 14), the hot plug device information transmission method may further include the following steps:

[0071] Step 15: Receive a fourth message sent by the hot-swap processing device.

[0072] Step 16: Calculate first verification information according to the operation event information, and send a second message to the hot-swap processing device, where the second message carries the operation event information and the currently calculated first verification information.

[0073] It should be noted that after receiving the second message, the vdagent module of the virtual machine calculates second verification information based on the operation event information therein. If the second verification information is inconsistent with the first verification information, the fourth message is sent to the terminal device. Accordingly, the spice client component of the terminal device receives the fourth message sent by the vdagent module of the virtual machine, indicating that the data verification has failed. Therefore, the spice client component of the terminal device recalculates the first verification information and resends the second message.

[0074] The embodiment of the present disclosure also provides a method for transmitting hot-swappable device information. Figure 7 As shown, the method includes the following steps:

[0075] Step 21: In response to receiving a first message sent by a terminal device, obtaining device information of the hot-swappable device carried therein.

[0076] The first message is sent by the terminal device after detecting that a hot-plug device has been inserted into the terminal device. In this step, the vdagent module of the plug-in processing device (i.e., the virtual machine) receives the first message sent by the terminal device and parses it to obtain the device information of the hot-plug device. In some embodiments, the device information is part of the device descriptor information and may include the VID (vendor ID) and PID (product ID) information of the USB hot-plug device.

[0077] Step 22: Load the device driver according to the device information, and create a device node according to the device information.

[0078] After receiving the first message reported by the spice client module of the terminal device, the vdagent module of the virtual machine will instruct the daemon module of the virtual machine to identify, enumerate and load the corresponding device driver for the hot-plug device corresponding to the device information, and then the daemon module will create the device node.

[0079] After the device driver is loaded and the device node is created, the binding relationship between the device node and the device driver is established. At this point, the I / O (input / output) channel between the spice client component of the terminal device and the virtual machine has been established. During the use of the hot-swappable device, the hot-swappable device can send operation event information to the virtual machine through this I / O channel.

[0080] Step 23: In response to receiving the second message sent by the terminal device, obtain the operation event information carried therein.

[0081] Step 24: Write the operation event information into the device node, so that the device node reports the operation event information to the operating system using the device driver.

[0082] In this step, the virtual machine's vdagent module writes the operation event information to the device node corresponding to the device information through the sendevent interface. That is, it writes the information to the device node's node file. The device node then uses the corresponding device driver to report the operation event information to the operating system framework layer. The operating system framework layer uses the default processing method to report the operation event information reported by the device driver to the application layer, which then processes the operation event information.

[0083] The hot-plug device information transmission method provided by the embodiment of the present disclosure obtains device information of the hot-plug device in response to detecting that the hot-plug device is hot-plugged in the terminal device; sends a first message carrying the device information to a hot-plug processing device in response to the hot-plugging action being an insertion action, so that the hot-plug processing device loads a device driver and creates a device node according to the device information; sends a second message carrying at least the operation event information to the hot-plug processing device in response to receiving operation event information sent by the hot-plug device, so that the hot-plug processing device writes the operation event information to the device node, and the device node reports the operation event information to the operating system using the device driver; after detecting the insertion action of the hot-plug device, the embodiment of the present disclosure establishes a device node to establish a communication channel between a spice client component of the terminal device and a virtual machine, thereby replacing the existing device redirection channel and implementing the reporting of hot-plug device operation event information. This can expand the application scenarios of the spice client component of the terminal device, provide more flexible support for external hot-plug devices, and improve the compatibility of the cloud system with hot-plug devices.

[0084] In some embodiments, as Figure 8 As shown, further, the hot-swappable device information transmission method may further include the following steps:

[0085] Step 31: In response to receiving a third message sent by a terminal device, obtain device information of the hot-swappable device carried therein.

[0086] The third message is sent to the virtual machine by the spice client component of the terminal device after determining that a hot-plug device has been unplugged from the terminal device. In this step, the vdagent component of the virtual machine parses the third message sent by the terminal device to obtain device information of the hot-plug device. The device information may include the VID (vendor ID) and PID (product ID) information of the USB hot-plug device.

[0087] Step 32: Uninstall the device driver according to the device information, and delete the device node according to the device information.

[0088] In this step, the vdagent module of the virtual machine instructs the daemon module to uninstall the device driver and delete the corresponding device node according to the device information. At this point, the unplugging process of the hot-plug device is completed.

[0089] In some embodiments, further, the second message may also carry the first verification information, and accordingly, Figure 9As shown, after obtaining the operation event information carried in the second message (i.e., step 23) and before writing the operation event information into the device node (i.e., step 24), the hot-swappable device information transmission method may further include the following steps:

[0090] Step 23 ′: obtain the first verification information in the second message, and calculate the second verification information according to the operation event information.

[0091] In this step, the vdagent component of the virtual machine calculates a checksum based on the operation event information such as the event type, event code, and event value. The checksum is the second verification information. In some embodiments, the second verification information can be calculated using a hash algorithm.

[0092] Accordingly, the step of writing the operation event information into the device node (i.e., step 24) includes the following steps:

[0093] Step 24 ′: in response to the second verification information being consistent with the first verification information, write the operation event information into the device node, so that the device node reports the operation event information to the operating system using the device driver.

[0094] In this step, the vdagent module of the virtual machine compares the second verification information with the first verification information. If the two are consistent, it means that the data verification is passed. The vdagent module then writes the operation event information obtained in step 23 into the corresponding device node through the sendevent interface, and the device node uses the corresponding device driver to report the operation event information to the operating system framework layer.

[0095] In some embodiments, the hot-swappable device information transmission method further includes the following steps: in response to the second verification information being inconsistent with the first verification information, sending a fourth message to the terminal device to cause the terminal device to recalculate the first verification information. In this step, if the virtual machine's vdagent module determines that the second verification information is inconsistent with the first verification information, indicating that the data verification has failed, a fourth message is sent to the terminal device to request the terminal device to retransmit the data. The disclosed embodiments utilize a verification mechanism to improve the reliability of data transmission and achieve controllable reliability of data reporting.

[0096] In some embodiments, the loading of the device driver according to the device information and the creation of the device node according to the device information include the following steps: in response to determining that the device driver matches the device information, loading the device driver; obtaining node parameters according to the device information, and creating the device node according to the node parameters. In this step, the daemon module of the virtual machine enumerates the hot-plug devices and loads the corresponding device drivers. This enumeration process is the device driver matching process. If the daemon module of the virtual machine matches the corresponding device driver according to the device information of the hot-plug device, the matched device driver is loaded and the device node is created. In some embodiments, the daemon module of the virtual machine calls the mknod (create node) command, obtains node parameters according to the device information of the hot-plug device, and creates the device node according to the node parameters. Creating a device node includes creating a node file. The node parameters may include the node name, node type, major device number, and minor device number. The node name includes the storage path and file name of the node file, for example, represented as / dev / input / eventX, where dev / input / is the storage path and eventX is the file name of the node file. The node type is a character device node. The major device number value is determined by the device driver type. Currently, for standard handle devices, the major device number value is 13. The minor device number value can be obtained by adding one to the minor device number value of an existing device node of the same type.

[0097] The disclosed embodiment proposes a processing solution that supports the normal reporting of operation event messages of USB hot-plug devices without modifying the USB hot-plug device permissions on the device terminal. It can not only remove the restrictions on the use of USB hot-plug devices in cloud solutions, but also improve the transmission efficiency of hot-plug devices; the solution of the disclosed embodiment implements message reporting through the upper-layer application interface and provides a verification mechanism to ensure the reliability of message reporting; the solution of the disclosed embodiment adopts a method of filtering and reporting the key data of the operation event to improve transmission efficiency and reduce the possibility of delay and TCP network congestion. The solution of the disclosed embodiment can significantly improve the compatibility of hot-plug device support in cloud solutions and reduce the delay in reporting operation event information of hot-plug devices.

[0098] Based on the same technical concept, the embodiment of the present disclosure also provides a terminal device, such as Figure 10 As shown, it includes an acquisition module 101, a receiving module 102, a first processing module 103, and a sending module 104. The acquisition module 101 is used to obtain device information of the hot-plug device in response to detecting that the hot-plug device occurs in the terminal device.

[0099] The receiving module 102 is configured to receive operation event information sent by the hot-swappable device.

[0100] The first processing module 103 is used to, in response to the hot plug action being an insertion action, instruct the sending module 104 to send a first message carrying the device information to the hot plug processing device, so that the hot plug processing device loads the device driver and creates a device node according to the device information; in response to the receiving module 102 receiving the operation event information sent by the hot plug device, instruct the sending module 104 to send a second message carrying at least the operation event information to the hot plug processing device, so that the hot plug processing device writes the operation event information into the device node, and the device node uses the device driver to report the operation event information to the operating system.

[0101] In some embodiments, the first processing module 103 is further used to, in response to the hot plug action being a pull-out action, instruct the sending module 104 to send a third message carrying the device information to the hot plug processing device, so that the hot plug processing device uninstalls the device driver and deletes the device node according to the device information.

[0102] In some embodiments, the first processing module 103 is used to, in response to the network status not satisfying the first preset condition, suspend sending the first message carrying the device information to the hot plug processing device, until the network status satisfies the first preset condition, instruct the sending module 104 to send the first message carrying the device information to the hot plug processing device; and / or, in response to the network status not satisfying the first preset condition, suspend sending the third message carrying the device information to the hot plug processing device, until the network status satisfies the first preset condition, instruct the sending module 104 to send the third message carrying the device information to the hot plug processing device.

[0103] In some embodiments, the first processing module 103 is used to filter the operation event information in response to the network status satisfying the first preset condition and not satisfying the second preset condition; and instruct the sending module 104 to send a second message carrying at least the filtered operation event information to the hot plug processing device.

[0104] In some embodiments, as Figure 11 As shown, the terminal device also includes a second processing module 105, which is used to calculate first verification information based on the operation event information and instruct the sending module 104 to send a second message carrying the operation event information and the first verification information to the hot plug processing device.

[0105] In some embodiments, the receiving module 102 is further configured to receive a fourth message sent by the hot plug processing device.

[0106] The second processing module 105 is used to, in response to the receiving module 102 receiving the fourth message sent by the hot plug processing device, calculate the first verification information based on the operation event information, and instruct the sending module 104 to send a second message to the hot plug processing device, where the second message carries the operation event information and the currently calculated first verification information.

[0107] It should be noted that the fetching module 101, the receiving module 102, the first processing module 103, the sending module 104, and the second processing module are all submodules of the spice client component.

[0108] Based on the same technical concept, the embodiment of the present disclosure also provides a hot plug processing device, such as Figure 12 As shown, it includes a receiving module 201, an acquisition module 202, a first processing module 203 and a second processing module 204. The receiving module 201 is used to receive a first message sent by a terminal device; and receive a second message sent by the terminal device.

[0109] The acquisition module 202 is configured to acquire device information of the hot-swappable device carried in the first message; and acquire operation event information carried in the second message.

[0110] The first processing module 203 is configured to load a device driver according to the device information and create a device node according to the device information.

[0111] The second processing module 204 is configured to write the operation event information into the device node, so that the device node reports the operation event information to the operating system using the device driver.

[0112] In some embodiments, the receiving module 201 is further used to receive a third message sent by the terminal device.

[0113] The acquisition module 202 is further configured to acquire device information of the hot-plug device carried in the third message.

[0114] The first processing module 203 is further configured to uninstall the device driver according to the device information and delete the device node according to the device information.

[0115] In some embodiments, the second message also carries first verification information, such as Figure 13 As shown, the hot-swap processing device further includes a verification module 205, and the acquisition module 202 is further configured to acquire first verification information in the second message.

[0116] The verification module 205 is configured to calculate second verification information according to the operation event information, and determine whether the second verification information is consistent with the first verification information.

[0117] The second processing module 204 is configured to, in response to the second verification information being consistent with the first verification information, write the operation event information into the device node.

[0118] In some embodiments, as Figure 14 As shown, the hot plug processing device further includes a sending module 206, which is used to, in response to the second verification information being inconsistent with the first verification information, send a fourth message to the terminal device so that the terminal device recalculates the first verification information.

[0119] In some embodiments, the first processing module 203 is configured to, in response to determining a device driver matching the device information, load the device driver; obtain node parameters according to the device information; and create a device node according to the node parameters.

[0120] It should be noted that the receiving module 201 , the acquiring module 202 , the second processing module 204 , the checking module 205 , and the sending module 206 are submodules of the vdagent module, and the first processing module 203 is a submodule of the daemon module.

[0121] An embodiment of the present disclosure also provides a computer device, which includes: one or more processors and a storage device; wherein one or more programs are stored on the storage device, and when the one or more programs are executed by the one or more processors, the one or more processors implement the hot-swappable device information transmission method provided in the aforementioned embodiments.

[0122] An embodiment of the present disclosure further provides a computer-readable medium having a computer program stored thereon, wherein when the computer program is executed, the hot-plug device information transmission method provided in the aforementioned embodiments is implemented.

[0123] It will be appreciated by those skilled in the art that all or some of the steps in the method disclosed above, and the functional modules / units in the device can be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As is well known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media generally embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0124] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for purposes of limitation. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly indicated, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, it will be understood by those skilled in the art that various changes in form and detail may be made without departing from the scope of the invention as set forth in the appended claims.

Claims

1. A method for transmitting hot-swappable device information, characterized in that: Applied to a terminal device, the method includes: In response to detecting that a hot-plug device is hot-plugged in the terminal device, obtaining device information of the hot-plug device; In response to the hot plug action being an insertion action, sending a first message carrying the device information to a hot plug processing device, so that the hot plug processing device loads a device driver and creates a device node according to the device information, thereby establishing a communication channel between a spice client component of the terminal device and the hot plug processing device; the hot plug processing device is a virtual machine that performs network communication via a transmission control protocol; In response to receiving the operation event information sent by the hot plug device, a second message carrying at least the operation event information is sent to the hot plug processing device, so that the hot plug processing device writes the operation event information into the device node, and the device node uses the device driver to report the operation event information to the operating system.

2. The method according to claim 1, wherein After obtaining the device information of the hot-swappable device, the method further includes: In response to the hot plug action being a pull-out action, a third message carrying the device information is sent to the hot plug processing apparatus, so that the hot plug processing apparatus uninstalls the device driver and deletes the device node according to the device information.

3. The method according to claim 2, wherein The sending of the first message carrying the device information to the hot plug processing device includes: in response to the network status not satisfying a first preset condition, suspending the sending of the first message carrying the device information to the hot plug processing device until the network status satisfies the first preset condition, and then sending the first message carrying the device information to the hot plug processing device; and / or The sending of the third message carrying the device information to the hot plug processing device includes: in response to the network status not satisfying the first preset condition, suspending the sending of the third message carrying the device information to the hot plug processing device until the network status satisfies the first preset condition, and then sending the third message carrying the device information to the hot plug processing device.

4. The method according to claim 3, wherein The sending a second message carrying at least the operation event information to the hot plug processing device includes: In response to the network status satisfying the first preset condition and not satisfying the second preset condition, filtering the operation event information; A second message carrying at least the filtered operation event information is sent to the hot plug processing device.

5. The method according to any one of claims 1 to 4, characterized in that Before sending the second message carrying at least the operation event information to the hot-swap processing device, the method further includes: calculating first verification information according to the operation event information; The sending of the second message carrying at least the operation event information to the hot plug processing device includes: sending the second message carrying the operation event information and the first verification information to the hot plug processing device.

6. The method according to claim 5, wherein After sending the second message carrying the operation event information and the first verification information to the hot plug processing device, the method further includes: In response to receiving the fourth message sent by the hot plug processing device, first verification information is calculated according to the operation event information, and a second message is sent to the hot plug processing device, where the second message carries the operation event information and the currently calculated first verification information.

7. A method for transmitting hot-swappable device information, characterized in that: Applied to a hot-swap processing device, where the hot-swap processing device is a virtual machine, the method includes: In response to receiving a first message sent by a terminal device, obtaining device information of a hot-swappable device carried therein; the terminal device and the hot-swappable processing device perform network communication via a transmission control protocol; Loading a device driver according to the device information, creating a device node according to the device information, and establishing a communication channel between the spice client component of the terminal device and the hot plug processing device; In response to receiving the second message sent by the terminal device, obtaining the operation event information carried therein; The operation event information is written into the device node, so that the device node reports the operation event information to the operating system using the device driver.

8. The method according to claim 7, wherein The method further comprises: In response to receiving the third message sent by the terminal device, obtaining device information of the hot-swappable device carried therein; The device driver is uninstalled according to the device information, and the device node is deleted according to the device information.

9. The method according to claim 7, wherein The second message also carries the first verification information. After obtaining the operation event information carried in the second message and before writing the operation event information into the device node, the method further includes: Obtaining first verification information in the second message, and calculating second verification information according to the operation event information; Writing the operation event information into the device node includes: In response to the second verification information being consistent with the first verification information, the operation event information is written into the device node.

10. The method according to claim 9, wherein Also includes: In response to the second verification information being inconsistent with the first verification information, a fourth message is sent to the terminal device, so that the terminal device recalculates the first verification information.

11. The method according to any one of claims 7 to 10, wherein: The step of loading a device driver according to the device information and creating a device node according to the device information includes: In response to determining a device driver that matches the device information, loading the device driver; Node parameters are acquired according to the device information, and a device node is created according to the node parameters.

12. A computer device comprising: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the hot-swap device information transmission method according to any one of claims 1 to 11.

13. A computer-readable medium having a computer program stored thereon, wherein: When the program is executed, the hot-swap device information transmission method according to any one of claims 1 to 11 is implemented.

Citation Information

Patent Citations

  • Hot-plug hardware and software implementation

    CN108139924A