A method and system for recovering firmware of an internet of things terminal

By storing backup firmware in IoT terminals and using a bootloader to detect anomalies, and automatically downloading upgrade packages from the server, the problem of embedded devices being unable to automatically restore firmware is solved, achieving automatic recovery and improving user experience.

CN112214233BActive Publication Date: 2025-12-16SHANGHAI SUMI TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011124081.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-20
Publication Date
2025-12-16
Estimated Expiration
2040-10-20

AI Technical Summary

Technical Problem

Existing technologies cannot effectively recover the firmware of embedded IoT terminals, especially in situations where there is a lack of human-machine interface and limited resources, resulting in the inability to automatically recover from firmware anomalies.

Method used

The system stores backup firmware in IoT terminals, detects firmware anomalies through a bootloader, publishes anomaly information to the server using the IoT communication module, subscribes to upgrade topics, receives and downloads firmware upgrade packages, and achieves automatic recovery.

Benefits of technology

It implements an automatic recovery function in case of firmware malfunction, which simplifies the recovery process, avoids factory repairs, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112214233B_ABST
    Figure CN112214233B_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to a method and system for restoring firmware of an Internet of Things terminal. The method first stores backup firmware in the Internet of Things terminal for its firmware; then after the Internet of Things terminal is powered on, the boot program detects whether the firmware is abnormal, and runs the backup firmware when it is abnormal, publishes firmware abnormal information, a terminal serial number of the firmware abnormality and a firmware version number through a first Internet of Things communication module, and subscribes to a firmware upgrade topic at the same time; then the Internet of Things server binds a firmware download task according to the received firmware abnormal information, the terminal serial number of the firmware abnormality and the firmware version number, and pushes an upgrade task message correspondingly; then the backup firmware receives and uses the upgrade task message to download a corresponding firmware upgrade package from the Internet of Things server; finally, it is judged whether the download of the firmware upgrade package is successful, if yes, the firmware upgrade package is installed, otherwise the download is continued. The present application can simplify firmware restoration and make the restoration automatic.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the field of Internet of Things, and in particular to a system and method for restoring firmware of an Internet of Things terminal. BACKGROUND

[0002] Due to the great advantages of the fifth generation mobile communication (5G) in low latency, ultra-low power consumption, and multi-terminal compatibility, with the commercialization and popularization of 5G, more industries will gradually emerge. Internet of Things (IOT) terminals can obtain low latency and ultra-low power consumption network environment through 5G, and can better realize the interconnection of all things.

[0003] Internet of Things terminals such as POS machines need to be returned to the factory for repair in the use process, in order to avoid such factory repair, the prior art provides a networked firmware recovery method, but most of the firmware recovery methods are on a large memory, large storage independent operating system such as Android, such as routers, mobile phones, tablets, etc., and the terminal needs to have a human-computer interaction interface, and the firmware can be recovered by human operation. But for Internet of Things terminals belonging to embedded devices, system resources are limited, such as limited network bandwidth and limited memory, and there is no human-computer interaction interface, which cannot be applied to the above-mentioned firmware recovery technology suitable for devices with large memory, large storage and user interaction interface.

[0004] In view of the above problems, the present application needs to provide a method and system for restoring firmware of an Internet of Things terminal, in order to simplify firmware recovery and automatically download firmware from an Internet of Things server when the firmware is abnormal, thereby realizing automatic recovery when the firmware is abnormal. SUMMARY

[0005] In order to solve the problems existing in the prior art, at least one embodiment of the present application provides a system and method for restoring firmware of an Internet of Things terminal.

[0006] In a first aspect, an embodiment of the present application provides a method for restoring firmware of an Internet of Things terminal, comprising the following steps:

[0007] (a) backing up firmware in an Internet of Things terminal for its firmware, the backup firmware comprising a first Internet of Things communication module and a first Internet communication module;

[0008] (b) after the Internet of Things terminal is powered on, the boot program detects whether the firmware of the Internet of Things terminal is abnormal, and runs the backup firmware when it is abnormal, and the backup firmware publishes firmware abnormal information, a terminal serial number of firmware abnormality and a firmware version number to an Internet of Things server through the first Internet of Things communication module, and subscribes to a firmware upgrade topic at the same time;

[0009] (c) receiving, by the IoT server, the firmware exception information, the terminal serial number of the firmware exception, and the firmware version number through a second IoT communication module, binding a firmware download task according to the terminal serial number of the firmware exception and the firmware version number, and pushing an upgrade task message through the second IoT communication module;

[0010] (d) receiving, by the backup firmware, the upgrade task message through the first IoT communication module, downloading the corresponding firmware upgrade package from the IoT server through the first Internet communication module using the upgrade task message;

[0011] (e) determining whether the backup firmware successfully downloads the firmware upgrade package, if yes, continuing step (f), if not, continuing the download of the firmware upgrade package in step (d); and

[0012] (f) installing the firmware upgrade package in the corresponding position of the firmware by the boot program.

[0013] In some embodiments, the upgrade task message in steps (c) and (d) includes upgrade package information, and whether the backup firmware successfully downloads the firmware upgrade package is determined by the upgrade package information in the upgrade task message in step (e).

[0014] In some embodiments, the boot program detects whether the firmware is abnormal by detecting the integrity of the firmware in step (b), and the backup firmware is run after the backup firmware is copied to the corresponding position of the firmware when the firmware is abnormal.

[0015] In some embodiments, the backup firmware sends a request to download the corresponding firmware upgrade package to the IoT server through the first Internet communication module in step (d), and the IoT server receives the request through the second Internet communication module and sends the firmware upgrade package to the IoT terminal.

[0016] In some embodiments, step (d) supports breakpoint resume when downloading the corresponding firmware upgrade package from the IoT server.

[0017] In some embodiments, the first IoT communication module and the second IoT communication module both realize IoT communication based on the MQTT protocol.

[0018] In some embodiments, the first Internet communication module and the second Internet communication module both realize Internet communication based on the HTTP / HTTPS protocol.

[0019] In some embodiments, the IoT terminal includes a POS machine.

[0020] In a second aspect, the embodiments of the present application also provide a system for restoring firmware of an Internet of Things terminal, which comprises:

[0021] The Internet of Things terminal comprises a bootloader, firmware and backup firmware, the backup firmware comprises a first Internet of Things communication module and a first Internet communication module, the bootloader detects whether the firmware is abnormal after the Internet of Things terminal is powered on, and runs the backup firmware when the firmware is abnormal, the backup firmware publishes firmware abnormal information, a terminal serial number of firmware abnormality and a firmware version number to an Internet of Things server through the first Internet of Things communication module, and subscribes to a firmware upgrade topic at the same time; and

[0022] The Internet of Things server has a second Internet of Things communication module, a second Internet communication module, a processing module and an upgrade package storage for storing a firmware upgrade package, the second Internet of Things communication module receives the firmware abnormal information, the terminal serial number of firmware abnormality and the firmware version number, the processing module binds a firmware download task according to the terminal serial number of firmware abnormality and the firmware version number, and pushes an upgrade task message through the second Internet of Things communication module;

[0023] The backup firmware receives the upgrade task message through the first Internet of Things communication module, downloads the corresponding firmware upgrade package from the Internet of Things server through the first Internet communication module using the upgrade task message, judges whether the download of the firmware upgrade package is successful, continues to download if not until successful, and installs the firmware upgrade package in the corresponding position of the firmware by the bootloader if yes.

[0024] In some embodiments, the upgrade task message comprises upgrade package information, the backup firmware checks whether the downloaded firmware upgrade package is complete through the upgrade package information, and continues to download the corresponding firmware upgrade package from the Internet of Things server until the complete firmware upgrade package is downloaded if it is not complete.

[0025] In some embodiments, the bootloader detects whether the firmware is abnormal by detecting the integrity of the firmware, and runs the backup firmware after copying the backup firmware to the corresponding position of the firmware when the firmware is abnormal.

[0026] In some embodiments, the backup firmware sends a request for downloading the corresponding firmware upgrade package to the Internet of Things server through the first Internet communication module, and the Internet of Things server receives the request through the second Internet communication module and sends the firmware upgrade package to the Internet of Things terminal.

[0027] In some embodiments, the backup firmware supports breakpoint resuming when downloading a corresponding upgrade package from the Internet of Things server.

[0028] In some embodiments, the first Internet of Things communication module and the second Internet of Things communication module both realize Internet of Things communication based on the MQTT protocol.

[0029] In some embodiments, the first Internet communication module and the second Internet communication module both realize Internet communication based on the HTTP / HTTPS protocol.

[0030] In some embodiments, the Internet of Things terminal comprises a POS machine.

[0031] Compared with the prior art, which needs to return to the factory for firmware recovery or provides firmware recovery technology only applicable to devices with large memory, large storage and user interaction interface, the embodiments of the present application first backup firmware in the Internet of Things terminal for its firmware storage; then, after the Internet of Things terminal is powered on, the boot program detects whether the firmware of the Internet of Things terminal is abnormal, and runs the backup firmware when it is abnormal, the backup firmware publishes firmware abnormal information, a terminal serial number of firmware abnormality and a firmware version number to an Internet of Things server through a first Internet of Things communication module, and subscribes to a firmware upgrade topic at the same time; then, the Internet of Things server receives the firmware abnormal information, the terminal serial number of firmware abnormality and the firmware version number through a second Internet of Things communication module, binds a firmware download task according to the terminal serial number of firmware abnormality and the firmware version number, and pushes an upgrade task message through the second Internet of Things communication module; after that, the backup firmware receives the upgrade task message through the first Internet of Things communication module, downloads a corresponding firmware upgrade package from the Internet of Things server using the upgrade task message and through the first Internet communication module; finally, it is judged whether the backup firmware successfully downloads the firmware upgrade package, if yes, the boot program installs the firmware upgrade package in the corresponding position of the firmware, if not, the download of the firmware upgrade package continues.

[0032] The embodiments of the present application can simplify firmware recovery, automatically download firmware when the firmware is abnormal, thereby realizing the automatic recovery function of the Internet of Things terminal firmware loss, and enhancing the user experience, avoiding the factory repair caused by firmware abnormality. BRIEF DESCRIPTION OF DRAWINGS

[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0034] Figure 1 A component structure schematic diagram of a system for restoring firmware of an Internet of Things terminal is provided for an embodiment of the present application.

[0035] Figure 2 A flow schematic diagram of a method for restoring firmware of an Internet of Things terminal is provided for an embodiment of the present application. DETAILED DESCRIPTION

[0036] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the drawings of the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort belong to the scope of protection of the present application.

[0037] It should be noted that, in this document, relational terms such as“first” and“second”, and the like, are used solely to distinguish one entity or action from another entity or action, without necessarily requiring or implying any actual such relationship or order between such entities or actions.

[0038] Figure 1 A component structure schematic diagram of a system for restoring firmware of an Internet of Things terminal is provided for an embodiment of the present application. Referring to Figure 1 , the system 1 for restoring firmware of an Internet of Things terminal includes an Internet of Things terminal 10 and an Internet of Things server 12. Figure 1 Only one Internet of Things terminal 10 is shown in the figure, but actually, multiple Internet of Things terminals 10 can be included in the system 1. The Internet of Things terminal 10 includes a POS machine or the like. The components of the system 1 will be described in detail below.

[0039] The Internet of Things terminal 10 includes a boot program 10A, firmware 10B, backup firmware 10C, and a terminal storage module 10D. The backup firmware 10C has a first Internet of Things communication module 100C and a first Internet communication module 102C, so that the backup firmware 10C has an Internet of Things communication function and an Internet communication function. The terminal storage module 10D is used to store a terminal serial number 100D and a firmware version number 102D, and each Internet of Things terminal 10 has a unique terminal serial number 100D, and the firmware version number 102D is the version number corresponding to the current firmware. The boot program 10A runs after the Internet of Things terminal 10 is powered on, and the boot program 10A first detects whether the firmware 10B is abnormal. In this embodiment, the boot program 10A detects whether the firmware 10B is abnormal by detecting the integrity of the firmware 10B.

[0040] The boot program 10A runs the backup firmware 10C when the firmware 10B is abnormal. In this embodiment, the boot program 10A runs the backup firmware 10C after copying the backup firmware 10C to the corresponding position of the firmware 10B when the firmware 10B is abnormal. In other embodiments of the present application, the boot program 10A can directly run the backup firmware 10C without copying the backup firmware 10C to the corresponding position of the firmware 10B.

[0041] The backup firmware 10C publishes firmware abnormal information, a terminal serial number 100D of firmware abnormality, and a firmware version number 102D to the Internet of Things server 12 through the first Internet of Things communication module 100C, and subscribes to a firmware upgrade topic at the same time. The purpose of the backup firmware 10C publishing information and subscribing to the upgrade topic is to tell the Internet of Things server 12 that the firmware of the Internet of Things terminal 10 has been abnormal, and the Internet of Things server 12 needs to bind a download task for downloading firmware for it. In this embodiment, the first Internet of Things communication module 100C implements Internet of Things communication based on the MQTT protocol, and the first Internet communication module 102C implements Internet communication based on the HTTP / HTTPS protocol.

[0042] The Internet of Things server 12 has a second Internet of Things communication module 12A, a second Internet communication module 12B, a processing module 12C, and an upgrade package storage 12D for storing firmware upgrade packages 121D, …, 12nD. The second Internet of Things communication module 12A receives firmware abnormal information, a terminal serial number 100D of firmware abnormality, and a firmware version number 102D. The processing module 12C binds a firmware download task according to the terminal serial number 100D of firmware abnormality and the firmware version number 102D, and pushes an upgrade task message through the second Internet of Things communication module 12A. The processing module 12C can also bind a download task of the latest version firmware and push an upgrade task message when the firmware version number 102D is lower than the firmware version number of the firmware upgrade package stored in the upgrade package storage 12D for the Internet of Things terminal 10. In this embodiment, the second Internet of Things communication module 12A implements Internet of Things communication based on the MQTT protocol, and the second Internet communication module 12B implements Internet communication based on the HTTP / HTTPS protocol. The first Internet of Things communication module 100C and the second Internet of Things communication module 12A are both connected to the Internet of Things network (not shown) and communicate with each other through the Internet of Things network. The first Internet communication module 102C and the second Internet communication module 12B are both connected to the Internet network (not shown) and communicate with each other through the Internet network.

[0043] The backup firmware 10C receives the upgrade task message through the first Internet of Things communication module 100C, utilizes the upgrade task message and downloads the corresponding firmware upgrade package 121D,..., 12nD from the Internet of Things server 12 through the first Internet communication module 102C. The backup firmware 10C further judges whether the downloading of the firmware upgrade package is successful, if not, continues to download until successful, if yes, installs the firmware upgrade package in the corresponding position of the firmware 10B by the boot program 10A.

[0044] The upgrade task message includes upgrade package information, the backup firmware 10C judges whether the downloading of the firmware upgrade package is successful by checking whether the downloaded firmware upgrade package is complete by using the upgrade package information, and continues to download the corresponding firmware upgrade package from the Internet of Things server 12 when it is incomplete (i.e. unsuccessful downloading), until the complete firmware upgrade package (i.e. successful downloading) is downloaded. The backup firmware 10C checks the integrity of the upgrade package before installation, which can ensure the integrity and legality of the upgrade.

[0045] The backup firmware 10C sends a request for downloading the corresponding firmware upgrade package to the Internet of Things server 12 through the first Internet communication module 102C, and the Internet of Things server 12 receives the request through the second Internet communication module 12B and sends the firmware upgrade package to the Internet of Things terminal 10. The backup firmware 10C supports breakpoint resume when downloading the corresponding upgrade package from the Internet of Things server 12.

[0046] The Internet of Things terminal 10 can publish the information of completing the upgrade to the Internet of Things server 12 through the first Internet of Things communication module 102C or other similar Internet of Things communication modules when the installation of the firmware upgrade package is completed. For example, the boot program 10A can publish the information of completing the upgrade to the Internet of Things server 12 through its internal similar Internet of Things communication module.

[0047] Referring to Figure 2 , in combination with referring to Figure 1 , Figure 2 shows a flowchart of a method for restoring firmware of an Internet of Things terminal according to an embodiment of the present application. As shown in Figure 2 , the method 20 for restoring firmware of an Internet of Things terminal first performs step S200, stores a backup firmware in the Internet of Things terminal for its firmware, the backup firmware including a first Internet of Things communication module and a first Internet communication module. In this embodiment, the Internet of Things terminal includes a POS machine, the first Internet of Things communication module realizes Internet of Things communication based on the MQTT protocol, and the first Internet communication module realizes Internet communication based on the HTTP / HTTPS protocol.

[0048] In other embodiments of the present application, the first Internet of Things communication module can implement Internet of Things communication based on other industry commonly used Internet of Things protocols other than the MQTT protocol, and the first Internet communication module can implement Internet communication based on other industry commonly used Internet protocols other than the HTTP / HTTPS protocol.

[0049] The method 20 continues to step S210, after the Internet of Things terminal is powered on, the boot program detects whether the firmware of the Internet of Things terminal is abnormal, if yes, it continues to step S220, if not, it runs the firmware of the Internet of Things terminal (S230). In this embodiment, the boot program detects whether the firmware is abnormal by detecting the integrity of the firmware, and the boot program runs the backup firmware after copying the backup firmware to the corresponding position of the firmware when the firmware is abnormal.

[0050] In step S220, the backup firmware is run, the backup firmware publishes firmware abnormal information, a terminal serial number of firmware abnormality and a firmware version number to an Internet of Things server through the first Internet of Things communication module, and subscribes to a firmware upgrade topic at the same time. Each Internet of Things terminal has a unique terminal serial number.

[0051] The method 20 continues to step S240, the Internet of Things server receives firmware abnormal information, a terminal serial number of firmware abnormality and a firmware version number through the second Internet of Things communication module, binds a firmware download task according to the terminal serial number of firmware abnormality and the firmware version number, and pushes an upgrade task message through the second Internet of Things communication module. In this embodiment, when the received firmware version number is lower than the firmware version number of the stored firmware upgrade package, the Internet of Things server can bind a download task of the latest version firmware and push an upgrade task message.

[0052] The method 20 continues to step S250, the backup firmware receives an upgrade task message through the first Internet of Things communication module. In this embodiment, the upgrade task message includes upgrade package information, and the upgrade package information can include the size of the upgrade package and the version number of the upgrade package.

[0053] The method 20 continues to step S260, the backup firmware sends a request for downloading a corresponding firmware upgrade package to the Internet of Things server through the first Internet communication module using the upgrade task message.

[0054] The method 20 continues to step S270, the Internet of Things server receives the request through the second Internet communication module and sends the firmware upgrade package to the Internet of Things terminal. In this embodiment, when downloading the corresponding firmware upgrade package from the Internet of Things server, breakpoint resume is supported.

[0055] The method 20 continues to step S280 to determine whether the backup firmware successfully downloads the firmware upgrade package, and if yes, continues to step S290, and if not, returns to step S260. In this embodiment, whether the firmware upgrade package is successfully downloaded is determined by the upgrade package information in the upgrade task message. For example, whether the firmware upgrade package is successfully downloaded can be directly determined by the size of the upgrade package.

[0056] The method 20 continues to step S290 to install the firmware upgrade package at the corresponding position of the firmware by the boot program.

[0057] The method 20 can further include the following step after step S290: publishing upgrade completion information to the Internet of Things server by the first Internet of Things communication module when the firmware upgrade package is installed.

[0058] The embodiment of the present application first stores backup firmware in the Internet of Things terminal for its firmware; then after the Internet of Things terminal is powered on, the boot program detects whether the firmware of the Internet of Things terminal is abnormal, and runs the backup firmware when it is abnormal, and the backup firmware publishes firmware abnormal information, a terminal serial number of firmware abnormality and a firmware version number to the Internet of Things server by the first Internet of Things communication module, and subscribes to a firmware upgrade topic at the same time; then the Internet of Things server receives the firmware abnormal information, the terminal serial number of firmware abnormality and the firmware version number by the second Internet of Things communication module, binds a firmware download task according to the terminal serial number of firmware abnormality and the firmware version number, and pushes an upgrade task message by the second Internet of Things communication module; then the backup firmware receives the upgrade task message by the first Internet of Things communication module, downloads the corresponding firmware upgrade package from the Internet of Things server by the first Internet communication module using the upgrade task message; finally, it is determined whether the backup firmware successfully downloads the firmware upgrade package, and if yes, the boot program installs the firmware upgrade package at the corresponding position of the firmware, and if not, continues to download the firmware upgrade package.

[0059] The embodiment of the present application can simplify firmware recovery, automatically download firmware when the firmware is abnormal, thereby realizing the automatic recovery function of the Internet of Things terminal firmware loss, and enhancing the user experience, avoiding the factory repair caused by firmware abnormality.

[0060] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the processing units can be implemented within one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSP Devices or DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), processors, controllers, micro-controllers, microprocessors, other electronic units designed to perform the functions described herein, or a combination thereof.

[0061] For a software implementation, the techniques described herein can be implemented with modules (e.g., procedures, functions, and so on) that perform the functions described herein. The software codes can be stored in memory units and executed by processors. The memory unit can be implemented within the processor or external to the processor.

[0062] It is understood that the units and algorithms described in connection with the embodiments disclosed herein can be embodied in electronic hardware, firmware, software, or any combination thereof. Whether such functionality is implemented in hardware or software depends on the specific application and design constraints imposed on the overall system. Skilled artisans can implement the described functionality in varying ways for each particular application. Therefore, the disclosed embodiments are not limited to any specific combination of hardware and software.

[0063] It is apparent that for the sake of brevity, the operational processes of the system, device, and unit described above are not repeatedly disclosed in detail in connection with the method embodiments, and it is to be understood that each process of the above-mentioned method embodiments can be performed by the corresponding processes of the system, device, and unit described above, and vice versa.

[0064] In the embodiments provided by the present application, it should be understood that the execution sequence of the steps of the method embodiments can be arbitrarily adjusted unless there is a clear sequence requirement. The disclosed device and method can be implemented in other ways. For example, the device embodiments described above are only schematic. The division of the units is only a logical function division. There can be another division manner in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or in other forms.

[0065] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0066] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.

[0067] If the functions are realized in the form of software functional units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application essentially or partially contribute to the prior art, or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0068] It should be noted that, in this document, the terms "comprising" and "including" or any other variant thereof are intended to cover non-exclusive inclusions, so that processes, methods, articles, or devices that include a series of elements not only include those elements, but also include other elements not explicitly listed, or further include elements inherent in such processes, methods, articles, or devices. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of other identical elements in the process, method, article, or device that includes the element.

[0069] Those skilled in the art can understand that although some embodiments described herein include certain features included in other embodiments but not others, the combination of features of different embodiments means within the scope of the present application and forms different embodiments.

[0070] Although the embodiments of the present application are described in conjunction with the drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.

Claims

1. A method for restoring firmware of an Internet of Things (IoT) terminal, comprising the following steps: : (a) In the Internet of Things (IoT) terminal, a backup firmware is stored for its firmware, the backup firmware including a first IoT communication module and a first Internet communication module. (b) After the IoT terminal is powered on, its boot program detects whether the firmware of the IoT terminal is abnormal, and runs the backup firmware when abnormal. The backup firmware publishes firmware abnormality information, the serial number of the terminal with abnormal firmware and the firmware version number to the IoT server through the first IoT communication module, and subscribes to firmware upgrade topics at the same time. (c) The IoT server receives the firmware error information, the terminal serial number of the firmware error, and the firmware version number through the second IoT communication module, binds the firmware download task according to the terminal serial number and firmware version number of the firmware error, and pushes the upgrade task message accordingly through the second IoT communication module. (d) The backup firmware receives the upgrade task message through the first IoT communication module, and uses the upgrade task message to download the corresponding firmware upgrade package from the IoT server through the first Internet communication module. (e) Determine whether the backup firmware successfully downloaded the firmware upgrade package. If yes, continue to step (f); otherwise, continue downloading the firmware upgrade package in step (d). The success of the firmware upgrade package download is determined by the upgrade package information in the upgrade task message, including the size and version number of the upgrade package. (f) The bootloader installs the firmware upgrade package at the corresponding location of the firmware; the bootloader detects whether the firmware is abnormal by checking the integrity of the firmware, and when the firmware is abnormal, the bootloader copies the backup firmware to the corresponding location of the firmware and then runs the backup firmware.

2. The method according to claim 1, characterized in that, The upgrade task message in steps (c) and (d) includes upgrade package information, and in step (e), the upgrade package information in the upgrade task message is used to determine whether the backup firmware has successfully downloaded the firmware upgrade package.

3. The method according to claim 1, characterized in that, In step (b), the bootloader detects whether the firmware is abnormal by checking the integrity of the firmware. When the firmware is abnormal, the bootloader copies the backup firmware to the corresponding location of the firmware and then runs the backup firmware.

4. The method according to claim 1, characterized in that, In step (d), the backup firmware sends a request to the IoT server to download the corresponding firmware upgrade package through the first Internet communication module. The IoT server receives the request through the second Internet communication module and sends the firmware upgrade package to the IoT terminal. In step (d), when downloading the corresponding firmware upgrade package from the IoT server, interrupted downloads are supported.

5. The method according to claim 4, characterized in that, Both the first IoT communication module and the second IoT communication module implement IoT communication based on the MQTT protocol, and both the first Internet communication module and the second Internet communication module implement Internet communication based on the HTTP / HTTPS protocol. The IoT terminal includes a POS machine.

6. A system for restoring firmware of an Internet of Things (IoT) terminal, comprising: The Internet of Things (IoT) terminal includes a bootloader, firmware, and backup firmware. The backup firmware includes a first IoT communication module and a first Internet communication module. After the IoT terminal is powered on and started, the bootloader detects whether the firmware is abnormal and runs the backup firmware if an abnormality occurs. The backup firmware publishes firmware abnormality information, the serial number of the terminal with the abnormal firmware, and the firmware version number to the IoT server through the first IoT communication module, and simultaneously subscribes to firmware upgrade topics. The IoT server includes a second IoT communication module, a second Internet communication module, a processing module, and an upgrade package storage device for storing firmware upgrade packages. The second IoT communication module receives the firmware error information, the terminal serial number of the firmware error, and the firmware version number. The processing module binds the firmware download task according to the terminal serial number and firmware version number of the firmware error, and pushes the upgrade task message through the second IoT communication module. The backup firmware receives the upgrade task message through the first IoT communication module, and uses the upgrade task message and the first Internet communication module to download the corresponding firmware upgrade package from the IoT server. It then determines whether the download of the firmware upgrade package is successful. If not, it continues to download until it is successful. If it is successful, the bootloader installs the firmware upgrade package at the corresponding location on the firmware. The success of downloading the firmware upgrade package is determined by the upgrade package information in the upgrade task message. The upgrade package information includes the size of the upgrade package and the version number of the upgrade package. The bootloader detects firmware abnormalities by checking the integrity of the firmware. When the firmware is abnormal, the bootloader copies the backup firmware to the corresponding location of the firmware and then runs the backup firmware.

7. The system according to claim 6, characterized in that, The upgrade task message includes upgrade package information, and the backup firmware uses the upgrade package information in the upgrade task message to determine whether the download of the firmware upgrade package was successful.

8. The system according to claim 6, characterized in that, The bootloader detects whether the firmware is abnormal by checking the integrity of the firmware. When the firmware is abnormal, the bootloader copies the backup firmware to the corresponding location of the firmware and then runs the backup firmware.

9. The system according to claim 6, characterized in that, The backup firmware sends a request to the IoT server to download the corresponding firmware upgrade package via the first Internet communication module. The IoT server receives the request via the second Internet communication module and sends the firmware upgrade package to the IoT terminal. The backup firmware supports resuming interrupted downloads when downloading the corresponding upgrade package from the IoT server.

10. The system according to claim 6, characterized in that, Both the first IoT communication module and the second IoT communication module implement IoT communication based on the MQTT protocol, and both the first Internet communication module and the second Internet communication module implement Internet communication based on the HTTP / HTTPS protocol. The IoT terminal includes a POS machine.