Detection screen hot plugging method and device
By using a screen hot-swapping detection method and device, changes in the display can be detected in real time, and the display can be dynamically inserted or removed. This solves the problem of the inability to detect changes in the display in a timely manner in the existing technology and improves the user experience.
Patent Information
- Application Number
- CN202511074367.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-11-28
AI Technical Summary
In existing technologies, Xcb cannot detect the insertion or removal of the display in real time, resulting in a poor user experience.
The patent provides a method for detecting hot-plugging of a screen. This method and device can actively detect the latest changes in the display in real time, dynamically support the insertion or removal of the display, and process the changes accordingly.
It enhances the user experience, promptly detects changes in the display, ensures correct image display, and dynamically supports the insertion or removal of the display, avoiding the problem of not being able to detect changes in a timely manner in existing technologies.
Smart Images

Figure CN121029660A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the field of data processing, and particularly relates to a screen hot plug detection method and device. BACKGROUND
[0002] Currently, cloud desktop systems are increasingly widely used. In existing technologies, most Linux systems are connected to Xcb objects through X servers to obtain a change area Delta and a desktop image. The X server is a core component of the X-Window system, adopts a client-server architecture mode, processes basic functions such as graphic display, input devices, and window management, and provides graphic interface support for UNIX and UNIX-like systems. The program follows the design principles of simplicity, extensibility, and compatibility, supports cross-platform operation, including operating systems such as Linux, and Xcb (X protocol C Bindings) is a bottom layer library for communicating with the X server, used for communicating with the X server.
[0003] However, in the above scheme, the user cannot perceive the change of the display and make corresponding processing, which affects the user experience. SUMMARY
[0004] The present disclosure provides a screen hot plug detection method and device, which can actively and in real time detect the latest change of the display, make corresponding processing measures, and improve the user experience. The technical solution is as follows:
[0005] According to a first aspect of the present disclosure, a screen hot plug detection method is provided, which includes: connecting a first interface through a first pointer object, the first interface being the current latest interface; obtaining information of a target screen through the first interface; in real time detecting a change of a target display through the information of the target screen; and processing according to the change of the target display.
[0006] Based on the above scheme, the xcb cannot passively obtain the latest display, that is, it cannot timely perceive the insertion or removal of the display. The present scheme dynamically supports the insertion or removal of the display (for example, virtual machine removal), when a display is newly inserted, the source end newly inserted display is set according to the remote display layout (such as left-right layout or top-bottom layout, etc.), and the picture is correctly zoomed out and displayed; if a display is removed, after the display is removed, the picture display is closed. Further, the latest change of the display can be actively and in real time detected, so that corresponding processing measures can be made in a timely manner according to the change of the display.
[0007] In some embodiments, the change of the target display is detected in real time by the information of the target screen, including: obtaining resources of a first screen and resources of a second screen, the first screen and the second screen belonging to the target screen; obtaining information of the target display, the target display being all displays in a display pool currently connected to the first xcb interface; detecting the change of the target display in real time by the number of displays contained in a first output result and the number of displays contained in a second output result, the first output result being obtained by the resources of the first screen, and the second output result being obtained by the resources of the second screen.
[0008] In some embodiments, the change of the target display is detected in real time by the number of displays contained in the first output result and the number of displays contained in the second output result, including: comparing whether the number of displays contained in the first output result and the number of displays contained in the second output result are the same; if not, the target display changes; if the same, comparing whether the target information of each display contained in the first output result and the target information of each display contained in the second output result are consistent; if consistent, the target display does not change; if not consistent, the target display changes.
[0009] In some embodiments, when the number of displays contained in the first output result and the number of displays contained in the second output result are different, the change of the target display is processed, including: sending reset collection information, resetting the first pointer object to obtain a second pointer object; suspending the sub-thread within a preset time, and replacing the first pointer object with the second pointer object, and cyclically executing the step of connecting the first interface through the first pointer object.
[0010] In some embodiments, when the target information of each display contained in the first output result and the target information of each display contained in the second output result are consistent, the change of the target display is processed, including: suspending the sub-thread within a preset time, and cyclically executing the step of connecting the first interface through the first pointer object.
[0011] In some embodiments, when the target information of each display contained in the first output result and the target information of each display contained in the second output result are inconsistent, the change of the target display is processed, including: sending reset collection information, resetting the first pointer object to obtain a third pointer object; suspending the sub-thread within a preset time, and replacing the first pointer object with the third pointer object, and cyclically executing the step of connecting the first interface through the first pointer object.
[0012] In some embodiments, the information of the target screen is obtained through the first interface, including: creating a pointer object of the target screen through the first interface; obtaining the information of the target screen through the pointer object of the target screen.
[0013] In some embodiments, the method further comprises: creating a sub-thread, the sub-thread being used for detecting hot plug of the display; and creating a first pointer object.
[0014] In some embodiments, the information of the target display comprises name information of the target display, display controller information.
[0015] According to a second aspect of the embodiments of the present disclosure, a device for detecting screen hot plug is provided, comprising a memory and a processor. The memory stores a program. When the program is executed in the processor, the processor is configured to execute the method of the first aspect and any one of the embodiments of the first aspect.
[0016] Based on the above device, the situation that xcb cannot be passively acquired to obtain the latest display, i.e., the insertion or removal of the display cannot be timely perceived, caused by the prior art, can be alleviated. The present scheme dynamically supports the insertion or removal of the display (for example, virtual machine removal). When a display is newly inserted, the source display newly inserted is set according to the remote display layout (such as left-right layout or top-bottom layout, etc.), and the picture is correctly zoomed out and displayed. If a display is removed, after the display is removed, the picture display of this path is closed. Further, the latest display change situation can be actively and timely detected, so that corresponding processing measures can be taken according to the display change situation.
[0017] According to a third aspect of the embodiments of the present disclosure, a device for detecting screen hot plug is provided, comprising: a connection module, configured to connect a first interface through a first pointer object, the first interface being a current latest interface; an acquisition module, configured to acquire information of a target screen through the first interface; a detection module, configured to detect a change situation of a target display in real time through the information of the target screen; and a processing module, configured to process according to the change situation of the target display.
[0018] In some embodiments, the detection module specifically comprises: a first acquisition sub-module, configured to acquire a resource of a first screen and a resource of a second screen, the first screen and the second screen belonging to the target screen; the first acquisition sub-module is further configured to acquire information of the target display, the target display being all displays in a display pool currently connected to the first xcb interface; and a detection sub-module, configured to detect the change situation of the target display in real time through a number of displays contained in a first output result and a number of displays contained in a second output result, the first output result being obtained through the resource of the first screen, and the second output result being obtained through the resource of the second screen.
[0019] In some embodiments, the detecting submodule specifically comprises a comparing submodule configured to compare whether the number of displays contained in the first output result is the same as the number of displays contained in the second output result; if not, the target display changes; if yes, the comparing submodule is further configured to compare whether the target information of each display contained in the first output result is consistent with the target information of each display contained in the second output result; if yes, the target display does not change; if not, the target display changes.
[0020] In some embodiments, when the number of displays contained in the first output result is not the same as the number of displays contained in the second output result, the processing module specifically comprises a first sending submodule configured to send reset collection information and reset the first pointer object to obtain the second pointer object; and a first executing submodule configured to suspend the sub-thread within a preset time and cyclically execute the step of connecting the first interface through the first pointer object by replacing the first pointer object with the second pointer object.
[0021] In some embodiments, when the target information of each display contained in the first output result is consistent with the target information of each display contained in the second output result, the processing module specifically comprises a second executing submodule configured to suspend the sub-thread within a preset time and cyclically execute the step of connecting the first interface through the first pointer object.
[0022] In some embodiments, when the target information of each display contained in the first output result is not consistent with the target information of each display contained in the second output result, the processing module specifically comprises a second sending submodule configured to send reset collection information and reset the first pointer object to obtain the third pointer object; and a third executing submodule configured to suspend the sub-thread within a preset time and cyclically execute the step of connecting the first interface through the first pointer object by replacing the first pointer object with the third pointer object.
[0023] In some embodiments, the obtaining module specifically comprises a creating submodule configured to create a pointer object of the target screen through the first interface; and a second obtaining submodule configured to obtain information of the target screen through the pointer object of the target screen.
[0024] In some embodiments, the detecting screen hot plug device further comprises a creating module configured to create a sub-thread, and the sub-thread is configured to detect the hot plug of the display; and the creating module is further configured to create the first pointer object.
[0025] In some embodiments, the information of the target display comprises name information and display controller information of the target display.
[0026] According to a fourth aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, and the computer program storage medium has program instructions, when the program instructions are executed by a processor, the processor executes the method of the first aspect and any one of the embodiments of the first aspect.
[0027] According to a fifth aspect of the embodiments of the present disclosure, a chip system is provided, and the chip system comprises at least one processor, when program instructions are executed in the at least one processor, the at least one processor executes the method of the first aspect and any one of the embodiments of the first aspect.
[0028] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0029] The accompanying drawings, which are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure.
[0030] Figure 1 is a schematic diagram of a cloud desktop acquisition display process 100 suitable for the embodiments of the present disclosure;
[0031] Figure 2 is a schematic diagram of a detective screen hot plug method 200 provided by the embodiments of the present disclosure;
[0032] Figure 3 is a flowchart of a detective screen hot plug method 200 provided by the embodiments of the present disclosure;
[0033] Figure 4 is a structural diagram of a detective screen hot plug device 400 provided by the embodiments of the present disclosure;
[0034] Figure 5 is a structural diagram of a detective screen hot plug device 500 provided by the embodiments of the present disclosure;
[0035] Figure 6 is another structural diagram of a detective screen hot plug device 500 provided by the embodiments of the present disclosure;
[0036] Figure 7 is another structural diagram of a detective screen hot plug device 500 provided by the embodiments of the present disclosure;
[0037] Figure 8 is another structural diagram of a detective screen hot plug device 500 provided by the embodiments of the present disclosure;
[0038] Figure 9 is another structural diagram of a detective screen hot plug device 500 provided by the embodiments of the present disclosure;
[0039] Figure 10 Fig. 6 is another structural diagram of the detective screen hot plug device 500 provided by the embodiment of the present disclosure;
[0040] Figure 11 Fig. 6 is another structural diagram of the detective screen hot plug device 500 provided by the embodiment of the present disclosure;
[0041] Figure 12 Fig. 6 is another structural diagram of the detective screen hot plug device 500 provided by the embodiment of the present disclosure. DETAILED DESCRIPTION
[0042] The exemplary embodiments will be described in detail herein with reference to the accompanying drawings. In the following description, well-known functions or constructions are not described in detail because they would obscure the application in unnecessary detail. The following description, given with reference to the attached drawings, is illustrative of the disclosure and is not intended to limit the scope of the disclosure as recited in the claims. Rather, the following description is intended to describe exemplary embodiments of devices and methods consistent with the principles of the disclosure as detailed in the appended claims.
[0043] Currently, the application of cloud desktop system is more and more widely, and the source end common environment is usually divided into two categories: one is Windows operating system, and the other is Linux operating system. And in the case of Linux system in the source end, it is divided into two scenes, one is bare metal (physical machine), and the other is virtual machine. No matter which scene, in the existing technology, most of the Linux system is connected with Xcb object through X server to obtain the change area Delta and desktop image. Among them, X server is the core component of X-Window system, adopts client-server architecture mode, and provides graphical interface support for UNIX and UNIX-like systems by processing basic functions such as graphic display, input device and window management. The program follows the design principles of simplicity, scalability and compatibility, supports cross-platform operation, including Linux and other operating systems; Xcb (X protocol CBindings) is a bottom layer library for communication with X server, which is used for communication with X server.
[0044] However, the Xcb object cannot automatically update the display list, so that the existing technology cannot dynamically support or detect the hot plug operation of the display of the source end, for example, inserting one more display or reducing one display, and the corresponding connection picture is increased or reduced.
[0045] Therefore, the present disclosure provides a detective screen hot plug method, which can improve the above problems and improve the user experience.
[0046] To better understand the embodiments of the present disclosure, first introduce the cloud desktop acquisition display image process. Among them, the source end is referred to as S end (Sender picture sending end), and the remote end is referred to as R end (Receive picture receiving end).
[0047] S110, the S end waits for the desktop rendering picture, and then acquires the desktop image in the BGRA format.
[0048] S120, the BGRA image is color converted into the YUV format (for example, YUV420, YUV444, etc.).
[0049] S130, the image is compressed and encoded in the H264 format, or the HEVC format, or the code stream of a self-defined format, etc.
[0050] S140, the image is transmitted over the network.
[0051] S150, the R end receives the code stream and decodes it to obtain the YUV format (YUV420, YUV444, etc.).
[0052] S160, the YUV data is copied to the video memory, and then is converted into the RGBA format.
[0053] S170, the RGBA image is rendered and displayed.
[0054] As an example, Figure 1 is a schematic diagram of a cloud desktop acquisition and display process 100 suitable for the embodiments of the present disclosure. As Figure 1 shown, the process 100 uses the xcb_connection_t* pointer object to connect xcb, obtains screen information, uses the screen information to obtain the number of currently used displays, and then obtains the current resolution of each display, which is used for subsequent acquisition of desktop images in a specified range.
[0055] The embodiments provided by the present disclosure add screen detection logic after obtaining the screen information in the above process. The principle is that in the case of normal acquisition and xcb connection, the latest screen information cannot be obtained passively. Therefore, the embodiments of the present disclosure create a sub-thread for cyclic detection.
[0056] The embodiments of the present disclosure provide a screen hot plug detection method 200, as Figure 2 shown, the screen hot plug detection method 200 includes the following steps:
[0057] S210, a first interface is connected through a first pointer object.
[0058] The first interface is the current latest interface.
[0059] For example, the latest xcb interface can be connected through an xcb connection object (such as xcb_connection_t *mConn) (e.g., mConn = xcb_connect (NULL, &sn)). That is, the xcb is connected through the xcb_connect interface. Wherein, xcb (X protocol C Bindings) is a low-level library for communicating with the X server, which is used for communication with the X server. It provides a more lightweight and efficient interface by directly mapping the requests and events of the X protocol, aiming to replace the traditional Xlib library.
[0060] S220, obtaining information of the target screen through the first interface.
[0061] Specifically, this step can be implemented in the following way:
[0062] creating a pointer object of the target screen through the first interface;
[0063] obtaining information of the target screen through the pointer object of the target screen.
[0064] For example, a screen pointer object (such as xcb_screen_t *mScreen) can be created through the first interface, and then the screen information (such as mScreen = xcb_get_screen (mConn, sn)) can be obtained through the screen pointer object (such as xcb_get_screen).
[0065] S230, real-time detecting changes of the target display through the information of the target screen.
[0066] Specifically, this step can be implemented in the following way:
[0067] Step 1: obtaining resources of the first screen and resources of the second screen.
[0068] Wherein, the first screen and the second screen belong to the target screen.
[0069] For example, the screen resource pointer object of the newly connected xcb (i.e., newRes) can be obtained through the interfaces such as xcbrandr_get_screen_resources_unchecked(), xcb_randr_get_screen_resources_reply(), and the screen resource of the xcb connection object being collected and used (i.e., oldRes) can be obtained, and the above two screens belong to the target screen.
[0070] Second step: obtaining information of target display.
[0071] Wherein, the target display is all displays in the display pool currently connected with the first xcb interface.
[0072] Optionally, the information of the target display can include name information and display controller (CRTC) information of the target display. Wherein, the CRTC is a display controller (such as a hardware component in a graphics processor) responsible for controlling the refresh, scanning and display output of the display.
[0073] For example, the name, CRTC code and other information of all displays recorded in the display pool currently connected with the xcb can be obtained according to the xcb_randr_get_screen_resources_outputs() interface.
[0074] Third step: detecting the change of the target display in real time by comparing the number of displays contained in the first output result with the number of displays contained in the second output result,
[0075] Wherein, the first output result is obtained by the resources of the first screen, and the second output result is obtained by the resources of the second screen.
[0076] For example, the total number of displays in newOutPuts can be compared with the total number of displays in oldOutputs. Wherein, OutPuts obtained by newRes in the sub-thread are called newOutPuts, and Outputs obtained by oldRes currently used for collection are called oldOutPuts.
[0077] Further, the step can specifically include:
[0078] Comparing whether the number of displays contained in the first output result is the same as the number of displays contained in the second output result;
[0079] If not, the target display changes;
[0080] If the same, comparing whether the target information of each display contained in the first output result is consistent with the target information of each display contained in the second output result;
[0081] If consistent, the target display does not change;
[0082] If not consistent, the target display changes.
[0083] S240, processing according to the change of the target display.
[0084] In a first aspect, when the number of displays contained in the first output result is different from the number of displays contained in the second output result, processing is performed according to the change in the target display, and specifically can include:
[0085] sending a reset collection message, resetting the first pointer object to obtain the second pointer object;
[0086] suspending the sub-thread within a preset time, and replacing the first pointer object with the second pointer object to cyclically execute the connection of the first interface through the first pointer object.
[0087] For example, when the total number of displays of newOutPuts is different from the total number of displays of oldOutputs, a reset collection message can be sent, the currently used xcb is reset, a new xcb is obtained, and the latest display pool is updated. The sub-thread is put to sleep (suspended) for 1-2 seconds, and the process jumps to S210 and continues to cyclically execute the subsequent steps through the newly obtained xcb.
[0088] It should be understood that in this case, the process of collecting and displaying the cloud desktop shown in FIG. 1 can be executed. Figure 1
[0089] In a second aspect, when the number of displays contained in the first output result is the same as the number of displays contained in the second output result, processing is performed according to the change in the target display, and specifically can include:
[0090] comparing whether the target information of each display contained in the first output result is consistent with the target information of each display contained in the second output result.
[0091] For example, a traversal can be written, and the two display pools are traversed simultaneously. The display names and display controller (CRTC) codes of newOutPuts and oldOutputs are compared in sequence to determine whether they are consistent.
[0092] In one aspect, when the target information of each display contained in the first output result is consistent with the target information of each display contained in the second output result, processing is performed according to the change in the target display, and specifically can include:
[0093] suspending the sub-thread within a preset time, and cyclically executing the connection of the first interface through the first pointer object.
[0094] For example, the sub-thread can be put to sleep (suspended) for 1-2 seconds, and the process jumps to S210 and continues to cyclically execute the subsequent steps.
[0095] On the other hand, when the target information of each display contained in the first output result is inconsistent with the target information of each display contained in the second output result, processing is performed according to the change of the target display, which can specifically include:
[0096] Send a reset collection message to reset the first pointer object to obtain a third pointer object;
[0097] Suspend the sub-thread within a preset time, and replace the first pointer object with the third pointer object to cyclically execute the connection of the first interface through the first pointer object.
[0098] For example, a reset collection message can be sent to reset the xcb in use, and a new xcb can be obtained to update the latest display pool. The sub-thread sleeps (suspends) for 1-2 seconds, and then jumps to S210 through the newly obtained xcb and continues the subsequent steps.
[0099] Optionally, the method 200 can further include:
[0100] Create a sub-thread, which is used to detect the hot plug of the display.
[0101] Create a first pointer object.
[0102] For example, before S210, the method can further include:
[0103] Create a sub-thread for detecting the hot plug of the display.
[0104] Create an xcb connection pointer object (such as xcb_connection_t*mConn).
[0105] As an example, Figure 3 is a flowchart of a method 200 for detecting the hot plug of a screen provided by an embodiment of the present disclosure.
[0106] Based on the above scheme, the situation that the xcb cannot be passively obtained to the latest display (i.e., the insertion or removal of the display cannot be sensed in time) caused by the prior art can be alleviated. This scheme dynamically supports the insertion or removal of the display (for example, virtual machine removal). When a display is newly inserted, the source display newly inserted is set according to the remote display layout (such as left-right layout or top-bottom layout, etc.), and the picture is correctly zoomed out and displayed. If a display is removed, after the display is removed, the picture display is closed. Furthermore, the latest change of the display can be actively and timely detected, so that corresponding processing measures can be taken according to the change of the display.
[0107] Based on the above Figure 2The hot-swap method for the detection screen described in the corresponding embodiments is described below as a device embodiment of this disclosure, which can be used to execute the method embodiment of this disclosure.
[0108] This disclosure provides an embodiment of a screen hot-swappable device 400, such as... Figure 4 As shown. The hot-swappable detection screen device 400 includes: a memory 401 and a processor 402.
[0109] Memory 401 is used to store programs.
[0110] When the program is executed in processor 402, processor 402 is used to execute the aforementioned screen hot-plugging method.
[0111] The processor 402 is configured to: connect to a first interface via a first pointer object, wherein the first interface is the latest interface; acquire information about the target screen via the first interface; detect changes in the target display in real time using the information about the target screen; and process the changes in the target display.
[0112] Optionally, the processor 402 is specifically configured to: acquire resources of a first screen and resources of a second screen, wherein the first screen and the second screen belong to the target screen; acquire information of a target display, wherein the target display is all displays in the display pool currently connected to the first xcb interface; and detect changes in the target display in real time through the number of displays included in a first output result and the number of displays included in a second output result, wherein the first output result is obtained through the resources of the first screen and the second output result is obtained through the resources of the second screen.
[0113] Optionally, the processor 402 is specifically configured to: compare whether the number of displays included in the first output result is the same as the number of displays included in the second output result; if they are different, the target display changes; if they are the same, compare whether the target information of each display included in the first output result is consistent with the target information of each display included in the second output result; if they are consistent, the target display does not change; if they are inconsistent, the target display changes.
[0114] Optionally, when the number of displays included in the first output result is different from the number of displays included in the second output result, the processor 402 is specifically configured to: send reset acquisition information, reset the first pointer object to obtain the second pointer object; suspend the sub-thread within a preset time, and replace the first pointer object with the second pointer object, and repeatedly execute the step of connecting the first interface through the first pointer object.
[0115] Optionally, when the target information of each display contained in the first output result is consistent with the target information of each display contained in the second output result, the processor 402 is specifically used to suspend the sub-thread for a preset time and repeatedly execute the step of connecting the first interface through the first pointer object.
[0116] Optionally, when the target information of each display contained in the first output result is inconsistent with the target information of each display contained in the second output result, the processor 402 is specifically configured to: send reset acquisition information, reset the first pointer object to obtain a third pointer object; suspend the sub-thread within a preset time, and replace the first pointer object with the third pointer object to repeatedly execute the connection to the first interface through the first pointer object.
[0117] Optionally, it is specifically used to create a pointer object of the target screen through the first interface; and to obtain information of the target screen through the pointer object of the target screen.
[0118] Optionally, the processor 402 is further configured to: create a sub-thread for detecting hot-plugging of the display; and create the first pointer object.
[0119] Optionally, the information of the target display includes the name of the target display and the display controller information.
[0120] The hot-swappable screen detection device provided in this disclosure can alleviate the problem of XCB being unable to passively obtain the latest display information due to existing technologies, i.e., it cannot detect the insertion or removal of a display in a timely manner. This solution dynamically supports the insertion or removal of displays (e.g., virtual machine removal). When a new display is inserted, based on the layout of the remote display (e.g., left-right or top-bottom layout), the newly inserted display at the source end is configured according to the remote layout, and the screen is correctly stretched and displayed. If a display is removed, the device dynamically detects the removal and then turns off the display of that display. Furthermore, it can proactively detect the latest display changes in real time, allowing for timely and appropriate actions based on these changes.
[0121] Based on the above Figure 2 The hot-swap method for the detection screen described in the corresponding embodiments is described below as a device embodiment of this disclosure, which can be used to execute the method embodiment of this disclosure.
[0122] Based on the above Figure 2 The corresponding embodiment describes a hot-swappable detection screen method. This disclosure also provides a hot-swappable detection screen device 500, such as... Figure 5 As shown.
[0123] The detection screen hot-swap device 500 includes:
[0124] Connection module 510 is used to connect to the first interface through the first pointer object, where the first interface is the latest interface.
[0125] The acquisition module 520 is used to acquire information about the target screen through the first interface;
[0126] The detection module 530 is used to detect changes in the target display in real time by using information from the target screen.
[0127] The processing module 540 is used to process changes based on the target display.
[0128] Optionally, such as Figure 6 As shown, the detection module 530 specifically includes:
[0129] The first acquisition submodule 5301 is used to acquire the resources of the first screen and the resources of the second screen, where the first screen and the second screen belong to the target screen.
[0130] The first acquisition submodule 5301 is also used to acquire information about the target display, which is all the displays in the display pool currently connected to the first xcb interface.
[0131] The detection submodule 5302 is used to detect changes in the number of displays of the target in real time by using the number of displays included in the first output result and the number of displays included in the second output result. The first output result is obtained from the resources of the first screen, and the second output result is obtained from the resources of the second screen.
[0132] Optionally, such as Figure 7 As shown, the detection submodule 5302 specifically includes:
[0133] The comparison submodule 53021 is used to compare whether the number of displays contained in the first output result is the same as the number of displays contained in the second output result;
[0134] If they are different, the target display will change;
[0135] If they are the same, the comparison submodule 53021 is also used to compare whether the target information of each display contained in the first output result is consistent with the target information of each display contained in the second output result.
[0136] If they are consistent, then the target display has not changed;
[0137] If there is a discrepancy, the target display will change.
[0138] Optionally, such as Figure 8As shown, when the number of displays included in the first output result is different from the number of displays included in the second output result, the processing module 540 specifically includes:
[0139] The first sending submodule 5401 is used to send reset acquisition information to reset the first pointer object and obtain the second pointer object;
[0140] The first execution submodule 5402 is used to suspend the sub-thread within a preset time and replace the first pointer object with a second pointer object to execute the first interface connected through the first pointer object in a loop.
[0141] Optionally, such as Figure 9 As shown, when the target information for each display contained in the first output result is consistent with the target information for each display contained in the second output result, the processing module 540 specifically includes:
[0142] The second execution submodule 5403 is used to suspend the child thread within a preset time and repeatedly execute the steps of connecting to the first interface through the first pointer object.
[0143] Optionally, such as Figure 10 As shown, when the target information for each display contained in the first output result is inconsistent with the target information for each display contained in the second output result, the processing module 540 specifically includes:
[0144] The second sending submodule 5404 is used to send reset acquisition information to reset the first pointer object to obtain the third pointer object;
[0145] The third execution submodule 5405 is used to suspend the child thread within a preset time and replace the first pointer object with a third pointer object to repeatedly execute the steps of connecting to the first interface through the first pointer object.
[0146] Optionally, such as Figure 11 As shown, module 520 specifically includes:
[0147] Create submodule 5201 to create a pointer object for the target screen through the first interface;
[0148] The second acquisition submodule 5202 is used to obtain information about the target screen through a pointer object of the target screen.
[0149] Optionally, such as Figure 12 As shown, the detection screen hot-swappable device 500 also includes:
[0150] Create module 550 to create a child thread, which is used to detect hot-plugging of the display.
[0151] Module 550 is created and also used to create the first pointer object.
[0152] Optionally, the target display information includes the target display's name and display controller information.
[0153] Based on the above Figure 2 In addition to the hot-swappable detection screen method described in the corresponding embodiments, this disclosure also provides a computer-readable storage medium. For example, a non-transitory computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, magnetic tape, a floppy disk, or an optical data storage device. This storage medium stores computer instructions for executing the above-described methods. Figure 2 The hot-swap method for the detection screen described in the corresponding embodiments will not be repeated here.
[0154] Based on the above Figure 2 The corresponding embodiment describes a hot-swappable detection screen method. This disclosure also provides a chip system including at least one processor. When program instructions are executed in the at least one processor, the at least one processor performs the above-described... Figure 2 The hot-swap method for the detection screen described in the corresponding embodiments will not be repeated here.
[0155] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0156] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for hot-swapping a detection screen, characterized in that, The method includes: The first interface is connected through the first pointer object, and the first interface is the latest interface at present. Information about the target screen is obtained through the first interface; The changes in the target display can be detected in real time using information from the target screen. Processing is performed based on changes in the target display.
2. The method according to claim 1, characterized in that, The real-time detection of changes in the target display through information from the target screen includes: Acquire the resources of the first screen and the second screen, wherein the first screen and the second screen belong to the target screen; Obtain information about the target display, wherein the target display is all displays in the display pool currently connected to the first xcb interface; The changes in the number of displays in the target display are detected in real time by comparing the number of displays in the first output result and the number of displays in the second output result. The first output result is obtained from the resources of the first screen, and the second output result is obtained from the resources of the second screen.
3. The method according to claim 2, characterized in that, The method of detecting changes in the number of displays in the target display in real time by comparing the number of displays included in the first output result and the number of displays included in the second output result includes: Compare whether the number of displays included in the first output result is the same as the number of displays included in the second output result; If they are different, then the target display changes; If they are the same, compare whether the target information of each display contained in the first output result is consistent with the target information of each display contained in the second output result. If they are consistent, then the target display has not changed; If there is a discrepancy, the target display changes.
4. The method according to claim 3, characterized in that, When the number of displays included in the first output result differs from the number of displays included in the second output result, the processing based on the change in the target display includes: Send a reset collection message to reset the first pointer object and obtain the second pointer object; The child thread is suspended within a preset time, and the second pointer object is used to replace the first pointer object to repeatedly execute the step of connecting to the first interface through the first pointer object.
5. The method according to claim 3, characterized in that, When the target information for each display contained in the first output result is consistent with the target information for each display contained in the second output result, the processing based on the changes in the target display includes: The child thread is suspended within a preset time, and the step of connecting to the first interface through the first pointer object is executed repeatedly.
6. The method according to claim 3, characterized in that, When the target information for each display contained in the first output result is inconsistent with the target information for each display contained in the second output result, the processing based on the changes in the target display includes: Send a reset acquisition message to reset the first pointer object and obtain the third pointer object; The child thread is suspended within a preset time, and the first pointer object is replaced by the third pointer object to repeatedly execute the process of connecting to the first interface through the first pointer object.
7. The method according to claim 1, characterized in that, The step of obtaining information about the target screen through the first interface includes: Create a pointer object to the target screen through the first interface; Information about the target screen is obtained through a pointer object to the target screen.
8. The method according to claim 1, characterized in that, The method further includes: Create a child thread that is used to detect hot-plugging of the display. Create the first pointer object.
9. The method according to claim 2, characterized in that, The information of the target display includes the name of the target display and the display controller information.
10. A hot-swappable device for a detection screen, characterized in that, include: The connection module is used to connect to the first interface through the first pointer object, where the first interface is the latest interface. The acquisition module is used to acquire information about the target screen through the first interface; The detection module is used to detect changes in the target display in real time using information from the target screen; The processing module is used to process changes based on the target display.
11. A hot-swappable device for a detection screen, characterized in that, Including memory and processor; The memory has a stored program; When the program is executed in the processor, the processor is used to perform the method of any one of claims 1-9.
12. A computer-readable storage medium, characterized in that, The computer program storage medium has program instructions that, when executed by a processor, cause the processor to perform the method of any one of claims 1-9.