Hot plug management method, cash register and electronic equipment

By monitoring the hot-swap signal and sending a virtual presence signal, the problem of hot-swappable devices being unable to be uninstalled is solved, ensuring that the device can be uninstalled normally when unplugged and avoiding system crashes.

CN118331647BActive Publication Date: 2024-09-20FUJIAN LANDI COMMERCIAL EQUIPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410748757.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-09-20
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

In the existing technology, a hot-swappable device cannot be uninstalled during the unplugging process, resulting in the device being unable to be uninstalled normally and causing a system crash.

Method used

By monitoring the hot-plug signal of the second device, when the second device is hot-plugged, the control bus driver enters sleep and sends a virtual in-position signal, indicating that the interface conversion controller is in place, ensuring that the device driver and host driver can be uninstalled normally. , to avoid the problem that the bus driver is uninstalled first and then cannot be uninstalled because the interface conversion controller is not in place.

Benefits of technology

It realizes the normal uninstallation of the device during the hot plug process, avoids the problem that the bus driver is uninstalled first and then the device driver and host driver cannot be uninstalled, solves the problem of the device being unable to be uninstalled, and ensures system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118331647B
    Figure CN118331647B
Patent Text Reader

Abstract

The present invention provides a hot-plug management method, a cash register and an electronic device, which are applied to electronic devices. The method includes: monitoring the hot-plug signal of the second device; when the second device is hot-plugged, controlling the bus driver to enter sleep mode and sending a virtual in-place signal, the virtual in-place signal is used to indicate that the interface conversion controller is in place; sequentially unloading the device driver and the host driver; waking up the bus driver and unloading the bus driver. By controlling the bus driver to enter sleep mode, the unloading of the bus driver is postponed, and the virtual in-place signal is sent at the same time, that is, although the second device has been unplugged at the physical layer, the first device can normally unload the device driver due to the existence of the virtual in-place signal, so that the first device can first complete the unloading of the device driver and the host driver, and then wake up the bus driver for unloading, thereby solving the problem that the hot-plug device cannot be effectively loaded and cannot be unloaded.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hot-plug device management, and in particular to a hot-plug management method, a cash register and electronic equipment. Background Art

[0002] In the related art, the multi-interface design of the device is usually implemented in a modular way. For example, the USB bus is used to simulate other interfaces such as i2c (Inter-Integrated Circuit), spi (Serial Peripheral Interface), gpio (General Purpose Input Output). At the same time, the modular implementation can also support the hot-swap function.

[0003] However, in the related art, since other interfaces are simulated, when the device is unplugged during hot plugging, there are problems such as the device cannot be uninstalled. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a hot-plug management method, a cash register and an electronic device, which solves the problem in the related art that the hot-plug device cannot be uninstalled.

[0005] In order to solve the above technical problems, a technical solution adopted by the present invention is:

[0006] A hot-plug management method is characterized in that it is applied to an electronic device, the electronic device comprises a first device and a second device, the first device is configured with a bus interface, the second device is hot-plugged and connected to the first device through the bus interface, and the second device is configured with an interface conversion controller; the method comprises:

[0007] monitoring a hot plug signal of the second device;

[0008] When the second device is hot-plugged, the bus driver is controlled to enter sleep mode and a virtual presence signal is sent, where the virtual presence signal is used to indicate that the interface conversion controller is in place;

[0009] Uninstall the device driver and the host driver in sequence; wake up the bus driver, and uninstall the bus driver.

[0010] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0011] A cash register, comprising a host device and a secondary screen device;

[0012] The host device is configured with a bus interface, and the secondary screen device is hot-plugged with the host device through the bus interface. The host device is configured with a main controller, the secondary screen device is configured with a secondary screen controller, and the secondary screen device is also configured with an interface conversion controller; the secondary screen device is used to connect to a second peripheral device, and the interface conversion controller is used to convert the bus interface into a target interface of the second peripheral device; the main controller is used to implement a hot-plug management method as described above.

[0013] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0014] An electronic device comprises a memory, a processor and a computer program stored in the memory and running on the processor, wherein the processor implements the above-mentioned hot-plug management method when executing the computer program.

[0015] The beneficial effects of the present invention are as follows: by creating a monitoring program for hot plugging of a second device, when it is detected that the second device is hot plugged out, the bus driver is controlled to enter sleep mode, and the unloading of the bus driver is postponed; at the same time, a virtual presence signal is sent, and the virtual presence signal is used to indicate that the interface conversion controller is in place. Therefore, although the second device has been hot plugged out at the physical level, due to the existence of the virtual presence signal, the electronic device believes that the interface conversion controller is still in place, so the device driver can be normally unloaded, so that the electronic device can first complete the unloading of the device driver and the host driver, and then wake up the bus driver and unload the bus driver, thereby avoiding the problem that the bus driver is first unloaded, and the device driver and the host driver cannot be unloaded because the interface conversion controller is not in place, thereby solving the problem that the device cannot be unloaded during the hot plugging process of the device. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A schematic diagram of matching a host driver and a device driver for a non-hot-pluggable device in the related art;

[0017] Figure 2 A flowchart of loading and unloading a non-hot-swappable device in the related art;

[0018] Figure 3 A schematic diagram of matching a host driver and a device driver for a hot-swappable device in the related art;

[0019] Figure 4 A flowchart of loading and unloading a hot-swappable device in the related art;

[0020] Figure 5 A flowchart of a hot-plug management method according to an embodiment of the present invention;

[0021] Figure 6 Another step flow chart of a hot plug management method according to an embodiment of the present invention;

[0022] Figure 7 It is a structural schematic diagram of a cash register in an embodiment of the present invention;

[0023] Figure 8 FIG. 4 is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0025] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0026] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0027] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0028] In the related art, the multi-interface design of the device is usually implemented in a modular way. For example, the USB bus is used to simulate other interfaces such as I2C (Inter-Integrated Circuit), SPI (Serial Peripheral Interface), and GPIO (General Purpose Input Output). At the same time, the modular implementation can also support the hot-swap function. Among them, hot-swap refers to plugging and unplugging without powering off, which can make the connection of the device more convenient, without the need to turn off the power to achieve plugging and unplugging like the device connection in the related art.

[0029] However, in the related art, since other interfaces are simulated, when the device is hot-plugged, there are problems such as the device cannot be uninstalled.

[0030] Specifically, with the development of technology, more and more devices begin to implement modular design. In the past, many interfaces were integrated on a motherboard, such as I2C, SPI, UART, GPIO interfaces, etc., and I2C, SPI, UART, GPIO controllers needed to be configured accordingly. However, when there are many devices, these interfaces are implemented by bus simulation. For example, the USB bus is used to simulate I2C, SPI, GPIO, etc. In this way, a modular design can be implemented, and hot plugging of devices is supported. However, this also raises a problem, because many devices are simulated. When the device is uninstalled, the problem of not being able to uninstall may occur. The present invention adds some management methods for this problem.

[0031] For example, our cash registers are generally equipped with USB interfaces, through which a control chip is physically connected, and various controllers are simulated using this control chip and the USB bus. When this control chip is plugged into the USB interface of the cash register, the entire system of the cash register integrates i2c, spi, uart, and gpio controllers. However, when the user removes the control chip, there is a big problem because some content on the system cannot be uninstalled. Among them, the control chip can be set in the secondary screen device of the cash register.

[0032] Please refer to Figure 1 , Figure 1 This is the loading process of a non-hot-swappable device of Linux or Android in the related technology. Figure 1As shown in the figure, in Linux or Android systems, non-hot-swappable devices are divided into host drivers and device drivers. Host drivers and device drivers are matched through device trees or names, such as i2c host controllers and i2c devices. When the host driver and device driver are matched, the corresponding device will be loaded through the corresponding device driver. Similarly, when the device is disconnected, it will be unloaded.

[0033] Please refer to Figure 2 , Figure 2 This is the loading and unloading process of non-hot-plug devices. When loading, first load the host driver, then load the device driver. When unloading, first unload the device driver, while its host side still exists, and then unload the host driver. Figure 2 The loading and unloading process is designed for non-hot-swappable devices.

[0034] Please refer to Figure 3 For hot-plug devices, different host devices need to be simulated through the bus. For example, taking the USB bus as an example, the system will simulate it into various host devices and then match them with the device driver. Figure 3 As shown, host devices such as i2c and spi are simulated through the USB bus combined with i2c host controller, spi host controller, etc.

[0035] Therefore, compared with the loading process of non-hot-plug devices in the related art, the loading process of hot-plug devices needs to add a bus simulation process. Figure 4 , which is the loading and unloading process of hot-plug devices in related technologies. During the loading process, after loading the host driver first and then the device driver, matching is performed based on DTS (Device Tree Source, device number file) or board-level information. When the device is unplugged, that is, after the control chip of the USB interface is unplugged, or, when the control chip is set in the secondary screen device of the cash register, the secondary screen device is disconnected from the USB interface. The USB bus is unloaded, and the host driver is unloaded before the device driver, resulting in the device driver resources cannot be released in time and a null pointer appears, resulting in the hot unplugging process of the device in the hot plugging process. Although the device has been hot unplugged, due to electronic devices such as cash registers, after determining that a null pointer has appeared, the unplugged device cannot be unloaded, resulting in a system crash. Taking the cash register as an example, when the secondary screen of the cash register is hot-plugged, the main screen receives the information that the secondary screen has been unplugged and uninstalls the host driver accordingly. However, since the secondary screen has been unplugged, the control chip required for the corresponding NFC module, speaker or LED and other modules connected to the secondary screen is disconnected. As a result, when the main screen needs to uninstall the NFC module, speaker or LED and other module information connected to the secondary screen, the device driver resources cannot be released in time, resulting in a null pointer, causing the main screen system to crash.

[0036] In order to solve the above problems, the present application provides a hot-plug management method, a cash register and an electronic device, which solve the problem in the related art that the hot-plug device cannot be uninstalled.

[0037] The following is a detailed introduction to a hot plug management method of the present application.

[0038] Please refer to Figure 5 The embodiment of the present application provides a hot-swap management method, which is applied to electronic devices, and is specifically applied to the main control module of the electronic device. The electronic device includes a first device and a second device. The first device is configured with a bus interface. The second device is hot-swapped with the first device through the bus interface. The second device is configured with an interface conversion controller. The interface conversion controller is used to convert the bus interface into a target interface required by the second device. For example, Figure 3 As shown, when the second device needs to use interfaces such as i2c, spi, uart and gpio, the interface conversion controller can be a control module or a control chip that integrates i2c, spi, uart and gpio functions.

[0039] Among them, the electronic device of the present application can be a financial terminal device equipped with multiple terminal devices, for example, it can be a cash register, on which a secondary screen and a main screen are set. At this time, the main screen can be used as the first device and the secondary screen can be used as the second device.

[0040] When the first device is the main screen and the second device is the secondary screen, the secondary screen on the second device will be configured with modules such as NFC module, speaker or LED, and the specific interfaces required by these modules are different. For example, it can be one of the interfaces such as i2c, spi, uart and gpio. Therefore, the interface conversion controller of the present application can correspond to the control module or control chip that integrates i2c, spi, uart and gpio functions according to the requirements of the second device.

[0041] In one embodiment of the present application, the second device is hot-plugged and connected to the first device via a bus interface. For example, a USB bus interface is provided on the main screen, and a USB interface is also provided on the secondary screen. The two interfaces are connected via a USB data cable to achieve data transmission. Among them, the main screen and the secondary screen can transmit data and instructions via a USB data cable. For example, when the main screen and the secondary screen are connected via a USB data cable, the main control module of the cash register (set on the main screen) can transmit the payment screen to be displayed to the secondary screen via the USB data cable. At this time, the secondary screen can be regarded as a display module of the cash register.

[0042] The main control module of the present application can be arranged in the first device and can send instructions to the second device through the bus interface to realize the control of the second device.

[0043] The first device and the second device of the present application may also be other devices, which is not limited in the present application. The method of the present application includes steps S110-S130.

[0044] S110: Monitor a hot plug signal of a second device.

[0045] The main control module of the electronic device is used to manage all hot-plug devices by creating a hot-plug monitoring program and a management program. When a hot-plug device is hot-plugged, the system can monitor the corresponding unplugging signal; that is, when the secondary screen as the second device is unplugged, the financial terminal device as the first device can monitor the hot-plugging signal of the secondary screen.

[0046] S120: When the second device is hot-plugged, the bus driver is controlled to enter sleep mode and a virtual presence signal is sent, where the virtual presence signal is used to indicate that the interface conversion controller is in place.

[0047] Among them, the host driver is used to realize the connection between the first device and the bus; the bus driver is used to realize the connection between the first device and the second device; the device driver is used to realize the connection between the second device and other devices that need to use the interface on the second device, such as the NFC module, speaker or LED and other modules configured on the secondary screen of the second device.

[0048] If the main screen detects that the secondary screen is unplugged, the management program will control the process of uninstalling the USB bus driver to enter sleep mode, and send a virtual presence signal to indicate that the interface conversion controller is still in place. At this time, the main screen can first uninstall the device connected to the secondary screen. For example, because the main screen believes that the interface conversion controller is in place, it can normally uninstall the NFC module, speaker or LED module connected to the secondary screen (different devices are controlled through the interface conversion controller, so the interface conversion controller must be in place to uninstall the device), avoiding the interface conversion controller from being uninstalled prematurely.

[0049] S130, sequentially uninstalling the device driver and the host driver; waking up the bus driver, and uninstalling the bus driver. Since the host controller has not been uninstalled, the device driver and the host driver can be uninstalled sequentially through the management program, and then the process of uninstalling the bus driver can be awakened and the bus driver can be uninstalled.

[0050] The method of this embodiment creates a monitoring program for hot plugging of the second device. When it is detected that the second device is hot plugged out, the bus driver is controlled to enter sleep mode and the uninstallation of the bus driver is postponed. At the same time, a virtual presence signal is sent, and the virtual presence signal is used to indicate that the interface conversion controller is in place. Therefore, although the second device has been hot plugged out at the physical level, the existence of the virtual presence signal makes the electronic device believe that the interface conversion controller is still in place, so the device driver can be uninstalled normally, so that the electronic device can first complete the uninstallation of the device driver and the host driver, and then wake up the bus driver and uninstall the bus driver, thereby avoiding the problem that the bus driver is uninstalled first, and the device driver and the host driver cannot be uninstalled because the interface conversion controller is not in place, thereby solving the problem that the device cannot be uninstalled during the hot plugging process of the device.

[0051] In a specific implementation, an LED light is provided on the secondary screen of the financial terminal device, and the LED light is implemented by converting the USB to the gpio controller and writing the gpio device driver. That is, in this embodiment, the LED light is set to on and off using the general linux or android gpio interface, such as controlling the LED light on and off by operating the high and low levels of the gpio. In the control process, it is necessary to apply for gpio resources, and the common application methods are the gpio_request function, and the release method is the gpio_free function.

[0052] In non-hot-plug scenarios, since the gpio controller is integrated into the system, it can be released normally. However, in hot-plug scenarios, such as in this application, the gpio controller is integrated into the secondary screen. If the gpio controller is unplugged, the gpio controller will be uninstalled in advance, causing the gpio_free function to be unable to be released. Therefore, when the gpio_free function is executed, the resources cannot be recovered, resulting in a null pointer. Similarly, in other application scenarios of hot-plug adapter devices, this problem will also occur if the host controller is uninstalled.

[0053] This embodiment uses the above method to enable the first device to first complete the uninstallation of the gpio_free function and the gpio controller, and then wake up the USB bus driver to uninstall, thereby avoiding the problem that the gpio_free function resources cannot be recovered and the gpio_free function cannot be released after the USB bus driver is uninstalled first.

[0054] In one embodiment of the present application, after the bus driver is unloaded in step 130, the method includes: sending a virtual off-position signal, where the virtual off-position signal is used to indicate that the interface conversion controller is off-position.

[0055] For example, when the program monitors that all drivers related to the gpio controller have been uninstalled, it sends a virtual off-position signal to inform the system that all drivers related to the gpio controller have been uninstalled. At this time, the gpio controllers on the physical layer and the virtual layer have been unplugged. By setting the virtual off-position signal, it is avoided that the virtual on-position signal is still online after the bus driver is uninstalled, causing abnormal electronic equipment.

[0056] In one embodiment of the present application, step S100 is also included:

[0057] When the second device is hot-plugged, step S100 is executed: a bus driver, a host driver, and a device driver are loaded in sequence to achieve connection between the second device and the first device.

[0058] By sequentially loading the bus driver, the host driver, and the device driver, the first device can effectively control the second device. For example, a picture can be transmitted to the second device for display.

[0059] Moreover, since the interface conversion controller is configured on the second device of the present application, when the first device and the second device are connected, the first device can also indirectly control the NFC module, speaker or LED and other modules connected to the second device.

[0060] In one embodiment of the present application, a secondary screen controller is configured on the second device of the present application, and the main control module on the first device can indirectly control the NFC module, speaker or LED and other modules connected to the second device through the secondary screen controller.

[0061] In one embodiment of the present application, before the second device is hot-plugged, the method further includes: pre-installing a bus driver, a host driver and a device driver on the first device (specifically, on a main control module of the electronic device; since the main control module can be provided on the first device, the first device is used herein); the host driver is used to connect the first device to the bus and a first peripheral device, such as a camera; the bus driver is used to connect the first device to the second device; the device driver is used to connect the second device to the second peripheral device, for example, the second peripheral device may be the above-mentioned peripheral modules such as the NFC module, speaker or LED connected to the second device.

[0062] Among them, in the related art, since the host controller is generated by bus simulation, the host controller may exist but not be fully loaded, which causes the device to be unable to form a communication connection, or the communication is unstable, resulting in the problem that the device cannot be used. To solve the above technical problems, in one embodiment of the present application, in step S100, the method for loading the device driver includes steps S210-S220;

[0063] S210, create an interface node to simulate a device driver in combination with the bus interface and the interface conversion controller. For example, when the financial terminal device detects that a USB interface controller device is inserted, it detects whether the inserted controller is initialized, and creates a corresponding device node in the system. If the node exists, the host controller is complete.

[0064] S220, loading device drivers. That is, after completing the loading of the bus driver, the management program starts to load the host driver and the device driver.

[0065] That is, the host driver and device driver are loaded only after it is confirmed that the bus driver has been loaded, thereby avoiding the problem that the host controller cannot be used due to incomplete loading.

[0066] In one embodiment of the present application, step S210 includes:

[0067] S310: Send an interface acquisition instruction to the second device, where the interface acquisition instruction is used to instruct the second device to acquire a target interface to be used by a second peripheral device.

[0068] For example, the secondary screen of a financial terminal device is currently connected to a speaker and an LED light, and only the i2c interface and the spi interface need to be used, that is, the target interfaces to be used are the i2c interface and the spi interface.

[0069] S320: Send an interface conversion instruction to the second device, where the interface conversion instruction is used to instruct the second device to call an interface conversion controller to convert the bus interface into a target interface.

[0070] At this time, it is detected that the target interface is the i2c interface and the spi interface, and the USB bus interface is converted into the i2c interface and the spi interface.

[0071] S330, create an interface node, the interface node is used to implement interface management of the target interface and the bus interface, that is, only create an i2c interface node and a spi interface node.

[0072] The interface conversion controller can simulate interfaces such as i2c, spi, uart, gpio, etc., but creating corresponding interface nodes according to the target interface to be used reduces unnecessary interface creation and improves the efficiency of initialization of the interface conversion controller.

[0073] S340: Utilize the interface node to simulate a device driver.

[0074] In one embodiment of the present application, before step S220, it also includes: after detecting that all interface nodes have been created, loading the host driver and the device driver in sequence. At the same time, it is necessary to detect that all interface nodes have been created, and then load the host driver and the device driver in sequence. If it is necessary to create four interface nodes of i2c, spi, uart, and gpio, it is necessary to load the corresponding host driver and device driver in sequence after all four interface nodes have been created, so as to ensure that each interface node can achieve stable communication.

[0075] In one embodiment of the present application, before step S130, the process further includes: uninstalling the application programs and services related to the device driver. For example, a financial terminal device is provided with an LED light, which is controlled by a USB to GPIO controller. When uninstalling, the application programs and services related to the control of the LED light are first uninstalled, and then the corresponding device driver, host driver and bus driver of the GPIO are uninstalled in sequence. If the application program and service are not exited, the device driver cannot be uninstalled successfully.

[0076] Please refer to Figure 6 In one embodiment of the present application, the hot-plug listening program and the management program are not only used to monitor and control the unplugging action of the hot-plugging device, but also used to monitor and control the plugging action of the hot-plugging device. The loading and unloading of the hot-plugging device are managed by a custom application instead of the system management. The loading and unloading of the hot-plugging device are controlled by the notification chain method. That is, when the second device is hot-plugged, step S100 is executed. When the second device is hot-unplugged, steps S110-S130 are executed.

[0077] Please refer to Figure 7 Another embodiment of the present invention provides a cash register 200, including a host device 201 and a sub-screen device 202; the host device 201 is configured with a bus interface, and the sub-screen device 202 is hot-plugged and connected to the host device 201 through the bus interface. The host device 201 is configured with a main controller, and the sub-screen device 202 is configured with a sub-screen controller, and the sub-screen device 202 is also configured with an interface conversion controller; the sub-screen device 202 is used to connect to a second peripheral device, and the interface conversion controller is used to convert the bus interface into a target interface of the second peripheral device; the main controller is used to implement the above-mentioned hot-plug management method.

[0078] For example, the interface conversion controller is configured with i2c, spi, uart, gpio and other interfaces, which are used to convert the USB interface into the corresponding type of interface. Since the secondary screen device 202 is configured with an interface conversion controller, when the secondary screen device 202 is removed from the host device 201, the peripherals connected to the secondary screen device 202 can be used normally. For example, the peripherals on the secondary screen device 202 include NFC, camera and LED lights. When the secondary screen device 202 is removed, the peripherals such as NFC, camera and LED lights can also be used normally. When the secondary screen device 202 is connected to the host device 201, the host device 201 can control the peripherals such as NFC, camera and LED lights connected to the secondary screen device 202 through the interface conversion controller on the secondary screen device 202, that is, at this time, the entire system of the cash register integrates i2c, spi, uart, gpio controllers.

[0079] In one embodiment of the present application, the secondary screen controller is connected to the second peripheral device via a pending interface, and the interface conversion controller is further used to convert the pending interface into a target interface of the second peripheral device.

[0080] That is, when the secondary screen device is removed from the host device, the secondary screen device can be used independently as a separate device. For example, the host device is a cash register, and the secondary screen device is a tablet. The tablet is connected to the cash register through a bus in a hot-pluggable manner; when the tablet is unplugged, the tablet can be used independently. At the same time, the tablet can also use the interface conversion controller to realize the conversion of different interfaces. For example, only a USB interface is set on the tablet. After other devices are connected to the USB, the secondary screen controller can independently control the second peripheral device through the interface conversion controller.

[0081] Please refer to Figure 8 Another embodiment of the present invention provides an electronic device 300, including a memory 301, a processor 302, and a computer program stored in the memory 301 and running on the processor 302, and the processor 320 implements the various steps in the above-mentioned hot plug management method when executing the computer program. Among them, the hot plug management method has been disclosed in the above part and will not be repeated here. The hot plug management method is implemented based on the electronic device 300, which avoids the problem that the bus driver is first uninstalled, and the device driver and the host driver cannot be uninstalled because the interface conversion controller is not in place, thereby solving the problem that the device cannot be uninstalled during the hot unplugging process of the device in the hot plug.

[0082] In summary, the present invention discloses a hot-plug management method, a cash register and an electronic device. By creating a monitoring program for hot-plugging the second device, when the second device is detected to be unplugged, the bus driver is controlled to enter sleep mode to post-place the unloading of the bus driver, and a virtual in-place signal is sent at the same time, that is, although the second device has been unplugged on the physical layer, the first device can normally unload the device driver due to the existence of the virtual in-place signal, so that the first device can first complete the unloading of the device driver and the host driver, and then wake up the bus driver for unloading, thereby avoiding the problem that the bus driver is first unloaded and the device driver and the host driver cannot be unloaded, and then solving the problem that the hot-plug device cannot be effectively loaded and unloaded. At the same time, the loading and unloading of the device is placed in the user space, and the use of related applications and services can be well managed in the form of device nodes, and the resource release of applications and services is done well. The unloading of the driver can be managed in an orderly manner to avoid the problem of causing null pointers and system crashes.

[0083] The above are only embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the specification and drawings of the present invention, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A hot plug management method, characterized in that: Applied to an electronic device, the electronic device comprises a first device and a second device, the first device is configured with a bus interface, the second device is hot-plugged with the first device via the bus interface, the second device is configured with an interface conversion controller, the interface conversion controller is used to convert the bus interface into a target interface required by the second device; the method comprises: monitoring a hot plug signal of the second device; When the second device is hot-plugged, the bus driver is controlled to enter sleep mode and a virtual presence signal is sent, where the virtual presence signal is used to indicate that the interface conversion controller is in place; Uninstall the device driver and the host driver in sequence; wake up the bus driver and uninstall the bus driver; preinstall the bus driver, host driver and device driver on the first device; the host driver is used to connect the first device with the bus and the first peripheral device; the bus driver is used to connect the first device with the second device; the device driver is used to connect the second device with the second peripheral device.

2. A hot-swap management method according to claim 1, characterized in that: The step of uninstalling the bus driver comprises: A virtual out-of-position signal is sent, where the virtual out-of-position signal is used to indicate that the interface conversion controller is out of position.

3. A hot-swap management method according to claim 1, characterized in that: Also includes: When the second device is hot-plugged, the bus driver, the host driver and the device driver are loaded in sequence to achieve connection between the second device and the first device.

4. A hot-swap management method according to claim 1, characterized in that: The method for loading the device driver includes: Create an interface node to combine the bus interface and the interface conversion controller to simulate a device driver; Load the device driver.

5. A hot-swap management method according to claim 4, characterized in that: The creating interface node combines the bus interface and the interface conversion controller to simulate the device driver comprises: Sending an interface acquisition instruction to the second device, where the interface acquisition instruction is used to instruct the second device to acquire a target interface to be used by the second peripheral device; Sending an interface conversion instruction to the second device, wherein the interface conversion instruction is used to instruct the second device to call the interface conversion controller to convert the bus interface into a target interface; Creating an interface node, wherein the interface node is used to implement interface management of the target interface and the bus interface; The device driver is simulated using the interface node.

6. A hot-swap management method according to claim 1, characterized in that: Before uninstalling the device driver and the host driver in sequence, the method further includes: Uninstall applications and services related to the device driver.

7. A cash register, characterized in that: Including host device and secondary screen device; The host device is configured with a bus interface, and the secondary screen device is hot-plugged with the host device through the bus interface. The host device is configured with a main controller, the secondary screen device is configured with a secondary screen controller, and the secondary screen device is also configured with an interface conversion controller; the secondary screen device is used to connect to a second peripheral device, and the interface conversion controller is used to convert the bus interface into a target interface of the second peripheral device; the main controller is used to implement a hot-plug management method as described in any one of claims 1-6.

8. A cash register according to claim 7, characterized in that: The secondary screen controller is connected to the second peripheral device via a pending interface, and the interface conversion controller is further used to convert the pending interface into a target interface of the second peripheral device.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the hot plug management method according to any one of claims 1 to 6 is implemented.