Device upgrading method, system, computer device and computer program product

By generating device fingerprints for industrial IoT devices, querying communication protocols and performing firmware verification, generating firmware data unit queues and total package verification values, and performing automated firmware upgrades based on upgrade instruction sets, the problem of low efficiency in managing multiple device models is solved, and efficient device upgrades are achieved.

CN120492003BActive Publication Date: 2025-11-28ROYPOW TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510927769.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-07
Publication Date
2025-11-28
Estimated Expiration
2045-07-07

AI Technical Summary

Technical Problem

In the context of firmware upgrades for industrial IoT devices, existing technologies cannot effectively address the low efficiency of unified management of multiple device models, and the R&D costs increase exponentially, making it difficult to achieve unified management of multiple device models.

Method used

By generating a unique device fingerprint for the device to be identified, querying the communication protocol, obtaining and verifying the total upgrade firmware package, generating a firmware data unit queue and a total package verification value, and performing automated firmware upgrades based on the upgrade instruction set.

Benefits of technology

It enables automated firmware upgrades for different types of devices with different communication protocols, improving development efficiency and possessing high versatility and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120492003B_ABST
    Figure CN120492003B_ABST
Patent Text Reader

Abstract

The application is suitable for the technical field of firmware upgrading, and provides a device upgrading method, system, computer device and computer program product, comprising: generating a device fingerprint for a target device, querying a communication protocol of the target device based on the device fingerprint, obtaining a total upgrading firmware package of the target device, generating a firmware data unit queue and a total package check value based on the total upgrading firmware package under the condition that the total upgrading firmware package passes firmware check, obtaining an upgrading instruction set of the target device based on the device fingerprint, and upgrading the target device based on the communication protocol, the upgrading instruction set, the firmware data unit queue and the total package check value. The device upgrading method provided by the application can realize automatic firmware upgrading of devices of different types and different communication protocols, has high universality and expandability, and can improve development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of firmware upgrading, and particularly relates to a device upgrading method and system, a computer device and a computer program product. BACKGROUND

[0002] In the firmware upgrading scene of industrial Internet of Things devices, enterprises often realize wireless upgrading of devices by mobile terminals through Bluetooth protocols. The current mainstream industrial control protocols and private protocols have significant differences in data frame formats, verification mechanisms, device addressing methods and the like, resulting in compatibility problems such as protocol analysis fragmentation, incompatible firmware package formats, and different security verification logics when integrating externally purchased devices.

[0003] The traditional upgrading scheme needs to develop a protocol analysis module and a verification process for each type of device. When a new model device is accessed, the developer needs to repeatedly analyze the protocol document, reconstruct the communication instruction set and verify the security strategy, resulting in exponential growth of research and development costs. This "one device, one scheme" mode seriously restricts the unified management efficiency of multiple types of devices, and it is urgent to build a general and highly expandable device upgrading scheme. SUMMARY

[0004] Therefore, the embodiments of the present application provide a device upgrading, system, computer device and computer program product to realize automatic firmware upgrading of devices compatible with different types and different communication protocols, and have high universality and expandability, which can improve the development efficiency.

[0005] The first aspect of the embodiments of the present application provides a device upgrading method, comprising:

[0006] generating a unique device fingerprint for each target device in the to-be-identified device;

[0007] querying a communication protocol of the target device in a configuration file based on the device fingerprint;

[0008] obtaining a total upgrading firmware package of the target device, performing firmware verification on the total upgrading firmware package, and generating a firmware verification result;

[0009] generating a firmware data unit queue and a total package verification value based on the total upgrading firmware package in a case where the firmware verification result indicates that the total upgrading firmware package passes the firmware verification, the firmware data unit queue comprising a plurality of firmware data units, each firmware data unit comprising a firmware block and a block verification code corresponding to the firmware block;

[0010] obtaining an upgrading instruction set of the target device based on the device fingerprint, the upgrading instruction set comprising a plurality of upgrading instructions;

[0011] upgrade the target device based on the communication protocol, the upgrade instruction set, the firmware data unit queue and the total package check value.

[0012] In an implementation form of the first aspect, before the generating a unique device fingerprint for each target device of the to-be-identified devices, the method further comprises:

[0013] performing a device scan and establishing a preliminary connection with each to-be-identified device scanned;

[0014] obtaining service information of each to-be-identified device establishing the preliminary connection respectively;

[0015] respectively matching in a configuration file according to the service information of each to-be-identified device, to determine whether each to-be-identified device is a target device.

[0016] In an implementation form of the first aspect, the generating a unique device fingerprint for each target device of the to-be-identified devices comprises:

[0017] obtaining a unique identifier and service information of each target device;

[0018] generating a device fingerprint for each target device according to the unique identifier and the service information of each target device respectively.

[0019] In an implementation form of the first aspect, the total upgrade firmware package comprises a latest firmware package, and the obtaining a total upgrade firmware package of the target device and performing firmware check on the total upgrade firmware package and generating a firmware check result comprises:

[0020] communicating with the target device based on the communication protocol, to obtain a device model and a current firmware version of the target device;

[0021] querying a latest firmware version of the target device based on the device model;

[0022] in a case where the latest firmware version is different from the current firmware version, obtaining a latest firmware package of the target device;

[0023] parsing the latest firmware package to obtain a first device model corresponding to the latest firmware package;

[0024] in a case where the first device model is the same as the device model of the target device, generating a firmware check result indicating that the total upgrade firmware package passes the firmware check.

[0025] In an implementation form of the first aspect, in the case that the firmware check result indicates that the total upgrade firmware package passes the firmware check, generating a firmware data unit queue and a total package check value based on the total upgrade firmware package comprises:

[0026] In the case that the firmware check result indicates that the total upgrade firmware package passes the firmware check, dividing the total upgrade firmware package into a plurality of firmware blocks;

[0027] According to the device fingerprint, querying a set of firmware package check algorithms corresponding to the target device in the configuration file;

[0028] According to the check algorithms in the set of firmware package check algorithms, respectively generating a total package check value of the total upgrade firmware package and a block check code corresponding to each of the firmware blocks;

[0029] Respectively grouping each of the firmware blocks and the corresponding block check code into a firmware data unit, and adding the firmware data unit to a firmware data unit queue.

[0030] In an implementation form of the first aspect, the upgrading the target device based on the communication protocol, the upgrade instruction set, the firmware data unit queue and the total package check value comprises:

[0031] Determining that the communication protocol is a protocol for communicating with the target device;

[0032] According to an upgrade step indicated by an upgrade instruction in the upgrade instruction set, sending firmware unit data in the firmware data unit queue to the target device;

[0033] After the data transmission in the firmware data unit queue is completed, performing upgrade check based on the total package check value, and if the check passes, generating an upgrade result indicating that the target device is upgraded successfully.

[0034] In an implementation form of the first aspect, according to the upgrade step indicated by the upgrade instruction in the upgrade instruction set, sending the firmware unit data in the firmware data unit queue to the target device comprises:

[0035] Taking out a firmware data unit from the head of the firmware data unit queue;

[0036] Sending the firmware data unit to the target device;

[0037] In the case that the confirmation information sent by the target device based on the firmware data unit is received, updating the upgrade progress;

[0038] returning a firmware data unit from a head of the firmware data unit queue in a case that the firmware data unit queue is not empty;

[0039] sending an end identifier to the target device in a case that the firmware data unit queue is empty;

[0040] performing an upgrade check based on the total package check value after the data transmission in the firmware data unit queue is completed, and generating an upgrade result indicating that the target device is upgraded successfully in a case that the check is passed, including:

[0041] receiving a complete check code sent by the target device based on the end identifier;

[0042] generating an upgrade result indicating that the target device is upgraded successfully in a case that the complete check code is equal to the total package check value;

[0043] generating an upgrade result indicating that the target device is not upgraded successfully in a case that the complete check code is not equal to the total package check value.

[0044] A second aspect of the embodiment of the application provides a device upgrade system, including:

[0045] a fingerprint generation module configured to generate a unique device fingerprint for each target device in a to-be-identified device;

[0046] a configuration query module configured to query a communication protocol of the target device in a configuration file based on the device fingerprint;

[0047] a firmware check module configured to obtain a total upgrade firmware package of the target device, perform firmware check on the total upgrade firmware package, and generate a firmware check result;

[0048] a firmware division module configured to generate a firmware data unit queue and a total package check value based on the total upgrade firmware package in a case that the firmware check result indicates that the total upgrade firmware package passes the firmware check, the firmware data unit queue including a plurality of firmware data units, each firmware data unit including a firmware block and a block check code corresponding to the firmware block;

[0049] an instruction acquisition module configured to obtain an upgrade instruction set of the target device from a fingerprint upgrade library based on the device fingerprint, the upgrade instruction set including a plurality of upgrade instructions;

[0050] a firmware upgrade module configured to upgrade the target device based on the communication protocol, the upgrade instruction set, the firmware data unit queue, and the total package check value.

[0051] The third aspect of the embodiments of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the device upgrading method according to the first aspect when executing the computer program.

[0052] The fourth aspect of the embodiments of the present application provides a computer program product, characterized by comprising a computer program, and the computer program, when executed, causes the device upgrading method according to the first aspect to be executed.

[0053] The first aspect of the embodiments of the present application has the following beneficial effects: the device fingerprint is generated for the target device, the communication protocol of the target device is queried in the configuration file according to the device fingerprint, the total upgrading firmware package of the target device is acquired, the firmware data unit queue and the total package check value are generated based on the total upgrading firmware package after the total upgrading firmware package is verified, the upgrading instruction set of the target device is acquired based on the device fingerprint, and finally the firmware data unit queue and the total package check value are sent to the target device under the indication of the upgrading instruction set based on the communication protocol, so as to realize the upgrading of the target device. The device upgrading method can realize the automatic firmware upgrading of devices of different types and different communication protocols, has high universality and expandability, and can improve the development efficiency.

[0054] It can be understood that the beneficial effects of the second aspect to the fourth aspect can be referred to the related description in the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS

[0055] In order to more clearly illustrate the technical solutions in 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 other drawings can be obtained by those skilled in the art without creative labor.

[0056] Figure 1 is the implementation flowchart of the device upgrading method provided by the embodiments of the present application;

[0057] Figure 2 is the implementation flowchart of the device upgrading method provided by the embodiments of the present application;

[0058] Figure 3 is the implementation flowchart of the device upgrading method provided by the embodiments of the present application;

[0059] Figure 4 is the structure schematic diagram of the device upgrading system provided by the embodiments of the present application;

[0060] Figure 5is a schematic diagram of a computer device provided by an embodiment of the present application.

[0061] Figure 6 is a schematic diagram of a computer program product provided by an embodiment of the present application. DETAILED DESCRIPTION

[0062] In the following description, for the purposes of explanation and not limitation, specific details are set forth, such as particular sequences of steps, techniques, etc. in order to provide a thorough understanding of the embodiments of the application. However, it will be apparent to those skilled in the art that the embodiments of the application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, circuits, and

[0063] It is to be understood that the terminology "includes", "has", "holds", "contains" or "comprising", "comprised of" or "comprising", as used in the specification and in the following claims, indicates the presence of the stated features, integers, steps, operations, elements, or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, or groups thereof.

[0064] It is also to be understood that the terminology "and / or" as used in the specification and in the following claims, indicates any combination of the associated listed items, as well as all possible combinations of the items.

[0065] As used in the specification and in the following claims, the term "if" can be interpreted as meaning "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [the described condition or event] is detected" can be interpreted as meaning "upon determining" or "in response to determining" or "upon detecting [the described condition or event]" or "in response to detecting [the described condition or event]", depending on the context.

[0066] In addition, in the description of the application and in the following claims, the terms "first", "second", "third", etc. are used only to distinguish descriptions, and cannot be understood as indicating or implying relative importance.

[0067] Reference within the specification of this application to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places within specified

[0068] The device upgrading method provided in the embodiments of the present application can be applied to computer devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, Augmented Reality (AR) / Virtual Reality (VR) devices, notebook computers, Ultra-Mobile Personal Computers (UMPCs), netbooks, Personal Digital Assistants (PDAs), and the like, and can be connected in communication with various target devices, for example, in Bluetooth connection or local area network connection to implement firmware upgrading for various target devices. The embodiments of the present application do not limit the specific types of computer devices.

[0069] The device upgrading method provided in the embodiments of the present application can be applied to computer devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, Augmented Reality (AR) / Virtual Reality (VR) devices, notebook computers, Ultra-Mobile Personal Computers (UMPCs), netbooks, Personal Digital Assistants (PDAs), and the like, and can be connected in communication with various target devices, for example, in Bluetooth connection or local area network connection to implement firmware upgrading for various target devices. The embodiments of the present application do not limit the specific types of computer devices.

[0070] As shown in FIG. 1, Figure 1 The device upgrading method provided in the embodiments of the present application can be applied to computer devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, Augmented Reality (AR) / Virtual Reality (VR) devices, notebook computers, Ultra-Mobile Personal Computers (UMPCs), netbooks, Personal Digital Assistants (PDAs), and the like, and can be connected in communication with various target devices, for example, in Bluetooth connection or local area network connection to implement firmware upgrading for various target devices. The embodiments of the present application do not limit the specific types of computer devices.

[0071] In step S1, a unique device fingerprint is generated for each target device in the to-be-identified devices.

[0072] In the application, there are generally a plurality of to-be-identified devices, a target device in the to-be-identified devices is a trusted device, only the target device is a device to be subjected to firmware upgrading, and each target device corresponds to a unique device fingerprint.

[0073] In step S2, the communication protocol of the target device is queried in a configuration file based on the device fingerprint.

[0074] In the application, the configuration file includes configuration information of the target device, for example, device model, device communication protocol information, upgrade instruction, service UUID (Universally Unique Identifier), firmware version, hardware version, device name, device model and the like, and the configuration information of the corresponding target device can be uniquely found through one device fingerprint.

[0075] In the application, the communication protocols of different devices can be different, and accurate communication protocol information is required to ensure the communication quality. For example, the industrial control protocols of terminal devices for communicating with devices through Bluetooth include Modbus RTU and CANBus protocols; the data frame formats of the two are different, Modbus RTU is a fixed format (address + function code + length + data + verification), and CAN Bus is a flexible format (ID + data + length + verification).

[0076] In step S3, a total upgrade firmware package of the target device is acquired, firmware verification is performed on the total upgrade firmware package, and a firmware verification result is generated.

[0077] In the application, the total upgrade firmware package is the latest firmware package acquired from an upgrade server, and in a case where the total upgrade firmware package cannot be acquired from the server, a local firmware package can also be acquired from the local device as the total upgrade firmware package.

[0078] In step S4, in a case where the firmware verification result indicates that the total upgrade firmware package passes the firmware verification, a firmware data unit queue and a total package verification value are generated based on the total upgrade firmware package, the firmware data unit queue includes a plurality of firmware data units, and each firmware data unit includes one firmware block and a block verification code corresponding to the firmware block.

[0079] In the application, the total upgrade firmware package is divided according to a fixed number of bytes (for example, 4 KB per block), or the firmware blocks are adaptively divided according to the buffer capacity of the device; each block has a block number, the block number can be sequentially numbered according to the order of the firmware block in the total upgrade firmware package, and is used for indexing and sequence control. By dividing the firmware blocks, the amount of data transmitted at a time can be reduced, transmission failures caused by unstable network can be reduced, breakpoint resume and retransmission strategies can be supported, and block processing and verification on a low-resource device can be facilitated.

[0080] In an application, based on a preset check algorithm, such as a cyclic redundancy check, a corresponding block check code is generated for each firmware block, and the firmware block and the corresponding block check code are added to the firmware data unit queue as a firmware data unit. In an application, a total package check value can be generated for the entire total upgrade firmware package based on an integrity check algorithm.

[0081] Step S5, based on the device fingerprint, obtaining an upgrade instruction set of the target device, the upgrade instruction set comprising a plurality of upgrade instructions.

[0082] In an application, the upgrade instructions in the upgrade instruction set of the target device are used to indicate specific firmware upgrade steps of the target device, and the upgrade instruction sets of different models of devices are different.

[0083] In an application, after obtaining the upgrade instruction set of the target device from the configuration file according to the device fingerprint of the target device for the first time, the device fingerprint of the target device and the upgrade instruction set thereof can be stored as a fingerprint upgrade data in a fingerprint upgrade library, and the upgrade instruction set of the target device can be obtained from the fingerprint upgrade library according to the device fingerprint in the future. In the case that the upgrade instruction set fails to be obtained from the fingerprint upgrade library, the upgrade instruction set is obtained from the configuration file according to the device fingerprint. The fingerprint upgrade library can improve the speed of obtaining the upgrade instruction set.

[0084] Step S6, based on the communication protocol, the upgrade instruction set, the firmware data unit queue and the total package check value, upgrading the target device.

[0085] The device upgrade method provided by the embodiments of the present application can be applied to the automatic firmware upgrade of devices of different types and different communication protocols, and can meet the upgrade requirements of devices of different types and different communication protocols. The device upgrade method provided by the present application can be based on multi-threading to simultaneously upgrade multiple devices, and is not limited by differences in device models, communication protocols, etc.

[0086] In one embodiment, before the step S1, for each target device in the to-be-identified devices, a unique device fingerprint is generated, and the step S1 further comprises:

[0087] Step S01, scanning the devices and establishing a preliminary connection with each to-be-identified device scanned.

[0088] Step S02, obtaining service information of each to-be-identified device establishing the preliminary connection respectively.

[0089] Step S03, respectively matching each to-be-identified device in the configuration file according to the service information of each to-be-identified device, and determining whether each to-be-identified device is a target device.

[0090] In application, the service information of the device to be identified includes a service UUID (Universally Unique Identifier) of the device. The service information is searched in a configuration file according to the service UUID of the device to be identified. If a device with the same service UUID is found, the device to be identified is determined as the target device.

[0091] In one embodiment, the step S1, a unique device fingerprint is generated for each target device in the device to be identified, including:

[0092] Step S11, the unique identifier and service information of each target device are obtained.

[0093] Step S12, a device fingerprint is generated for each target device according to the unique identifier and service information of each target device.

[0094] In application, the unique identifier of the target device is a hardware unique identifier of the target device, such as a mac address (Media Access Control Address).

[0095] In one embodiment, the total upgrade firmware package includes the latest firmware package, and the step S3, the total upgrade firmware package of the target device is obtained, and the firmware package is checked, and a firmware check result is generated, including:

[0096] Step S31, based on the communication protocol, the target device is communicated to obtain the device model and the current firmware version of the target device.

[0097] Step S32, the latest firmware version of the target device is queried based on the device model.

[0098] Step S33, in the case that the latest firmware version is different from the current firmware version, the latest firmware package of the target device is obtained.

[0099] In application, in most cases, the latest firmware version may be higher than the current firmware version, and the firmware version of the target device is upgraded. In some cases, for example, in the case that the current firmware version has a problem, the latest firmware version can be one version lower than the current firmware version, so that the firmware version is downgraded to the previous version which is more secure and stable.

[0100] Step S34, the latest firmware package is parsed to obtain the first device model corresponding to the latest firmware package.

[0101] In this application, if the latest firmware package is an unencrypted file, it can be parsed directly. If the latest firmware package is an encrypted file, it must first be decrypted using the password before parsing. The applicable device model for this firmware package is determined by parsing the first device model number in the latest firmware package.

[0102] Step S35: If the first device model and the target device model are the same, generate a firmware verification result to indicate that the total upgrade firmware package has passed firmware verification.

[0103] In application, if the first device model and the target device model are the same, it indicates that the general upgrade firmware package is suitable for the target device and can be used for firmware upgrades on the target device. Therefore, a firmware verification result is generated to indicate that the general upgrade firmware package has passed firmware verification. If the first device model and the target device model are different, it indicates that the general upgrade firmware package is not suitable for the target device.

[0104] like Figure 2 As shown, in one embodiment, step S4, when the firmware verification result indicates that the total upgrade firmware package has passed firmware verification, generates a firmware data unit queue and a total package verification value based on the total upgrade firmware package, including:

[0105] Step S41: If the firmware verification result indicates that the total upgrade firmware package has passed the firmware verification, the total upgrade firmware package is divided into multiple firmware blocks.

[0106] In this application, taking a firmware file size of 150kb and Bluetooth data transmission as an example, the maximum value of the Bluetooth Maximum Transmission Unit (MTU) is 517 bytes; 150 KB = 150 × 1,024 = 153,600 bytes; with the MTU set to 500 bytes, a 150kb firmware file needs to send data 308 times consecutively. That is, the total 150kb firmware upgrade package array is divided into 308 parts, each containing 500 bytes of data.

[0107] Step S42: Based on the device fingerprint, query the firmware package verification algorithm set corresponding to the target device in the configuration file.

[0108] In applications, different devices require different verification algorithms. The set of verification algorithms includes the verification algorithms required by the target device at each stage. For example, cyclic redundancy check is required in the firmware block verification stage, and integrity verification algorithms, such as checksum algorithms, are required in the verification stage of the total upgrade firmware package.

[0109] Step S43: Generate the total package verification value of the total upgrade firmware package and the block verification code corresponding to each firmware block according to the verification algorithms in the firmware package verification algorithm set.

[0110] Step axis S44, respectively, assembles each firmware block and its corresponding block check code into a firmware data unit, and adds the firmware data unit to the firmware data unit queue.

[0111] In one embodiment, step S6, upgrading the target device based on the communication protocol, the upgrade instruction set, the firmware data unit queue, and the total package checksum, includes:

[0112] Step S61: Determine that the communication protocol is the protocol for communicating with the target device.

[0113] Step S62: According to the upgrade steps indicated by the upgrade instructions in the upgrade instruction set, send the firmware unit data in the firmware data unit queue to the target device.

[0114] Step S63: After the data transmission in the firmware data unit queue is completed, an upgrade verification is performed based on the total package verification value. If the verification passes, an upgrade result is generated to indicate that the target device has been successfully upgraded.

[0115] like Figure 3 As shown, in one embodiment, step S62, which involves sending firmware unit data from the firmware data unit queue to the target device according to the upgrade steps indicated by the upgrade instructions in the upgrade instruction set, includes:

[0116] Step S621: Take a firmware data unit from the head of the firmware data unit queue.

[0117] In the application, the firmware data unit queue is implemented as a queue-like data structure with the characteristics of First In First Out (FIFO). The data at the head of the queue is the oldest data that has been enqueued, and the data at the tail of the queue is the newest data that has been enqueued. Each time, a firmware data unit is taken from the head of the queue until the queue is empty.

[0118] Step S622: Send the firmware data unit to the target device.

[0119] In this application, before sending firmware data units to the target device, the operating conditions of the target device are checked to determine whether the current operating conditions of the target device meet the conditions for firmware upgrade or meet the conditions that prohibit firmware upgrades. For example, firmware upgrades are prohibited when the target device's battery level is below 5%, the battery is at high or low temperatures, the battery is being charged at high power, the voltage is unstable, or the current is abnormal.

[0120] Step S623, in case that the target device sends the acknowledgement information based on the firmware data unit, update the upgrade progress.

[0121] In application, the target device generates the check code based on the firmware block in the received firmware data unit and the algorithm required for the firmware block check, such as the cyclic redundancy check, and sends the acknowledgement information (ACK, Acknowledgement) if the check code is equal to the block check code of the firmware block, which means that the firmware block in the firmware data unit passes the check, and updates the upgrade progress.

[0122] Step S624, in case that the firmware data unit queue is not empty, return to the step S621 to take out a firmware data unit from the head of the firmware data unit queue.

[0123] Step S625, in case that the firmware data unit queue is empty, send the end identifier to the target device.

[0124] The step S63, after the data transmission in the firmware data unit queue is completed, perform the upgrade check based on the total package check value, and generate the upgrade result for indicating the upgrade success of the target device if the check passes, including:

[0125] Step S631, receive the complete check code sent by the target device based on the end identifier.

[0126] In application, after receiving the end identifier, the target device forms a complete firmware data package by using the firmware data in all the received firmware data units, and generates the integrity check code of the firmware data package according to the integrity check algorithm.

[0127] Step S632, in case that the complete check code is equal to the total package check value, generate the upgrade result for indicating the upgrade success of the target device.

[0128] In application, the check of each firmware block is realized by the block check code, and the check of the complete firmware data package formed by all the firmware blocks received by the target device is realized by the integrity check code and the total package check value, which guarantees the reliability and safety of the firmware data for upgrade.

[0129] Step S633, in case that the complete check code is not equal to the total package check value, generate the upgrade result for indicating the upgrade failure of the target device.

[0130] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0131] The embodiments of the present application also provide a device upgrading system for executing the steps in the device upgrading system method embodiments described above. The device upgrading system can be a virtual appliance in a computer device, run by a processor of the computer device, or can be the computer device itself.

[0132] As shown in Figure 4 The device upgrading system 400 provided by the embodiments of the present application includes:

[0133] The fingerprint generation module 401 is configured to generate a unique device fingerprint for each target device in the to-be-identified devices;

[0134] The configuration query module 402 is configured to query the communication protocol of the target device in the configuration file based on the device fingerprint;

[0135] The firmware verification module 403 is configured to obtain a total upgrade firmware package of the target device, perform firmware verification on the total upgrade firmware package, and generate a firmware verification result;

[0136] The firmware division module 404 is configured to, in a case where the firmware verification result indicates that the total upgrade firmware package passes the firmware verification, generate a firmware data unit queue and a total package verification value based on the total upgrade firmware package, the firmware data unit queue including a plurality of firmware data units, and each firmware data unit including a firmware block and a block verification code corresponding to the firmware block;

[0137] The instruction acquisition module 405 is configured to acquire an upgrade instruction set of the target device from a fingerprint upgrade library based on the device fingerprint, the upgrade instruction set including a plurality of upgrade instructions;

[0138] The firmware upgrade module 406 is configured to upgrade the target device based on the communication protocol, the upgrade instruction set, the firmware data unit queue, and the total package verification value.

[0139] In one embodiment, the device upgrading system 400 further includes:

[0140] The scanning and identifying module is configured to: perform device scanning and establish a preliminary connection with each to-be-identified device scanned; acquire service information of each to-be-identified device establishing the preliminary connection respectively; and match in the configuration file according to the service information of each to-be-identified device respectively, to determine whether each to-be-identified device is a target device.

[0141] In one embodiment, the fingerprint generation module 401 is configured to:

[0142] obtain the unique identifier and service information of each target device;

[0143] generate a device fingerprint for each target device according to the unique identifier and service information of the target device.

[0144] In one embodiment, the firmware verification module 403 is configured to:

[0145] query the latest firmware version of the target device based on the device model;

[0146] if the latest firmware version is different from the current firmware version, obtain the latest firmware package of the target device;

[0147] parse the latest firmware package to obtain a first device model corresponding to the latest firmware package;

[0148] if the first device model is the same as the device model of the target device, generate a firmware verification result indicating that the total upgrade firmware package passes the firmware verification.

[0149] In one embodiment, the firmware division module 404 is configured to:

[0150] if the firmware verification result indicates that the total upgrade firmware package passes the firmware verification, divide the total upgrade firmware package into multiple firmware blocks;

[0151] query a set of firmware package verification algorithms corresponding to the target device in the configuration file according to the device fingerprint;

[0152] generate a total package verification value of the total upgrade firmware package and a block verification code corresponding to each firmware block according to the verification algorithms in the set of firmware package verification algorithms;

[0153] combine each firmware block and the corresponding block verification code into a firmware data unit, and add the firmware data unit to a firmware data unit queue.

[0154] In one embodiment, the firmware upgrade module 406 is configured to:

[0155] determine that the communication protocol is the protocol for communicating with the target device;

[0156] sending, according to an upgrade step indicated by an upgrade instruction in the upgrade instruction set, firmware unit data in the firmware data unit queue to the target device;

[0157] performing, after data transmission in the firmware data unit queue is completed, upgrade verification based on the total package check value, and generating an upgrade result indicating that the target device is upgraded successfully if the verification is passed.

[0158] In one embodiment, the firmware upgrade module 406 is configured to:

[0159] extract a firmware data unit from a head of the firmware data unit queue;

[0160] send the firmware data unit to the target device;

[0161] update an upgrade progress if the target device sends, based on the firmware data unit, acknowledgement information;

[0162] return to the step of extracting a firmware data unit from a head of the firmware data unit queue if the firmware data unit queue is not empty;

[0163] send an end identifier to the target device if the firmware data unit queue is empty;

[0164] The performing, after data transmission in the firmware data unit queue is completed, upgrade verification based on the total package check value, and generating an upgrade result indicating that the target device is upgraded successfully if the verification is passed, comprises:

[0165] receive a complete check code sent by the target device based on the end identifier;

[0166] generate an upgrade result indicating that the target device is upgraded successfully if the complete check code is equal to the total package check value;

[0167] generate an upgrade result indicating that the target device is not upgraded successfully if the complete check code is not equal to the total package check value.

[0168] Figure 5 A structural schematic diagram of a computer device is provided in an embodiment of the present application. As shown in the structural schematic diagram of the computer device 5 in the embodiment, the computer device 5 comprises at least one processor 50 (only one processor is shown in the figure), a memory 51, and a computer program 52 stored in the memory 51 and executable on the at least one processor 50, wherein the processor 50 implements the steps in any of the device upgrade method embodiments described above when executing the computer program 52. Figure 5 Figure 5 ​​

[0169] The computer device can include, but is not limited to, a processor 50, a memory 51. Those skilled in the art can understand that, Figure 5 The computer device 5 is only an example and does not constitute a limitation on the computer device 5, and can include more or fewer components than shown, or combine certain components, or different components, for example, can also include input / output devices, network access devices, etc.

[0170] The processor 50 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or can also be any conventional processor.

[0171] The memory 51 can be an internal storage unit of the computer device 5 in some embodiments, such as a hard disk or memory of the computer device 5. The memory 51 can also be an external storage device of the computer device 5 in other embodiments, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 51 can include both the internal storage unit and the external storage device of the computer device 5. The memory 51 is used to store an operating system, application programs, a boot loader, data and other programs, such as program codes of the computer program, etc. The memory 51 can also be used to temporarily store data that has been output or will be output.

[0172] It should be noted that the information interaction, execution process, etc. between the above devices / units, since based on the same concept as the method embodiments of the present application, the specific functions and the brought technical effects can be referred to the method embodiments part, and will not be repeated here.

[0173] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0174] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.

[0175] like Figure 6 As shown, this application embodiment provides a computer program product 6, including a computer program 52. When the computer program 52 is run, the steps in the above-described device upgrade method embodiments are executed.

[0176] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / computer equipment, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0177] In the above embodiments, the description of each embodiment focuses on different aspects, and the parts not described in detail or recorded in a certain embodiment can be referred to the relevant description of other embodiments.

[0178] Those skilled in the art can understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0179] In the embodiments provided in the present application, it should be understood that the disclosed computer device and method can be implemented in other ways. For example, the computer device embodiments described above are only schematic. The division of the modules or units is only a logical function division, and there can be another division 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 displayed or discussed mutual coupling or direct coupling or communication connection can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0180] The units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.

[0181] The above described embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalent ones; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A device upgrade method, characterized by, The method comprises the following steps: generating a unique device fingerprint for each target device in the to-be-identified device; querying the communication protocol of the target device in the configuration file based on the device fingerprint; obtaining the total upgrade firmware package of the target device, performing firmware verification on the total upgrade firmware package, and generating a firmware verification result; in the case where the firmware verification result indicates that the total upgrade firmware package passes the firmware verification, generating a firmware data unit queue and a total package verification value based on the total upgrade firmware package; obtaining the upgrade instruction set of the target device from the configuration file based on the device fingerprint, wherein the upgrade instruction set comprises a plurality of upgrade instructions; after obtaining the upgrade instruction set of the target device from the configuration file based on the device fingerprint of the target device for the first time, storing the device fingerprint and the upgrade instruction set of the target device as a piece of fingerprint upgrade data in a fingerprint upgrade library, and subsequently obtaining the upgrade instruction set of the target device in the fingerprint upgrade library based on the device fingerprint of the target device, and in the case where the upgrade instruction set fails to be obtained from the fingerprint upgrade library, obtaining the upgrade instruction set from the configuration file based on the device fingerprint again; upgrading the target device based on the communication protocol, the upgrade instruction set, the firmware data unit queue, and the total package verification value, wherein the transmission data frame formats corresponding to the communication protocols of different devices are different; the upgrading the target device based on the communication protocol, the upgrade instruction set, the firmware data unit queue, and the total package verification value comprises: determining that the communication protocol is the protocol used for communication with the target device; sending the firmware unit data in the firmware data unit queue to the target device according to the upgrade step indicated by the upgrade instruction in the upgrade instruction set; after the data transmission in the firmware data unit queue is completed, performing upgrade verification based on the total package verification value, and generating an upgrade result indicating that the target device is successfully upgraded if the verification passes; the sending the firmware unit data in the firmware data unit queue to the target device according to the upgrade step indicated by the upgrade instruction in the upgrade instruction set comprises: taking one firmware data unit from the head of the firmware data unit queue; sending the firmware data unit to the target device; updating the upgrade progress in the case where the confirmation information sent by the target device based on the firmware data unit is received; returning to the step of taking one firmware data unit from the head of the firmware data unit queue in the case where the firmware data unit queue is not empty; sending an end identifier to the target device in the case where the firmware data unit queue is empty; before sending the firmware data unit to the target device, checking the working condition of the target device to determine whether the working condition of the target device meets the firmware upgrade condition or the condition of prohibiting solid-state upgrade; in the case where the working condition of the target device meets the condition of prohibiting solid-state upgrade, prohibiting solid-state upgrade.

2. The device upgrade method of claim 1, wherein, before the step of generating a unique device fingerprint for each target device in the to-be-identified device, the method further comprises the following steps: performing a device scan and establishing a preliminary connection with each of the scanned devices to be identified; obtaining service information of each of the devices to be identified that establishes the preliminary connection; determining whether each of the devices to be identified is a target device according to the service information of each of the devices to be identified in a configuration file.

3. The device upgrade method of claim 2, wherein, The method further includes: obtaining a unique identifier and service information of each of the target devices; generating a device fingerprint for each of the target devices according to the unique identifier and the service information of each of the target devices.

4. The device upgrade method of claim 1, wherein, The total upgrade firmware package includes a latest firmware package, and the method further includes: communicating with the target device based on the communication protocol to obtain a device model and a current firmware version of the target device; querying a latest firmware version of the target device based on the device model; in a case where the latest firmware version is different from the current firmware version, obtaining a latest firmware package of the target device, the latest firmware version being higher than the current firmware version or lower than the current firmware version; obtaining a first device model corresponding to the latest firmware package by parsing the latest firmware package; in a case where the first device model is the same as the device model of the target device, generating a firmware check result indicating that the total upgrade firmware package passes the firmware check.

5. The device upgrade method according to any one of claims 1 to 4, wherein The method further includes: in a case where the firmware check result indicates that the total upgrade firmware package passes the firmware check, generating a firmware data unit queue and a total package check value based on the total upgrade firmware package. in a case where the firmware check result indicates that the total upgrade firmware package passes the firmware check, dividing the total upgrade firmware package into a plurality of firmware blocks; querying a firmware package check algorithm set corresponding to the target device in the configuration file according to the device fingerprint; generating a total package check value of the total upgrade firmware package and a block check code corresponding to each of the firmware blocks according to a check algorithm in the firmware package check algorithm set; 6. A device upgrade system, comprising: adding each of the firmware blocks and the corresponding block check code to form a firmware data unit, and adding the firmware data unit to a firmware data unit queue. The method further includes: a fingerprint generation module configured to generate a unique device fingerprint for each of the target devices; a configuration query module configured to query a communication protocol of the target device in a configuration file based on the device fingerprint; a firmware check module configured to obtain a total upgrade firmware package of the target device, perform firmware check on the total upgrade firmware package, and generate a firmware check result; a firmware division module configured to, in a case where the firmware check result indicates that the total upgrade firmware package passes the firmware check, generate a firmware data unit queue and a total package check value based on the total upgrade firmware package. The instruction obtaining module is configured to obtain an upgrade instruction set of the target device from the fingerprint upgrade library based on the device fingerprint, wherein the upgrade instruction set comprises a plurality of upgrade instructions, and after the upgrade instruction set of the target device is obtained from the configuration file according to the device fingerprint of the target device for the first time, the device fingerprint and the upgrade instruction set of the target device are stored in the fingerprint upgrade library as a piece of fingerprint upgrade data, and subsequently, the upgrade instruction set of the target device is obtained from the fingerprint upgrade library according to the device fingerprint of the target device, and in the case that the upgrade instruction set is failed to be obtained from the fingerprint upgrade library, the upgrade instruction set is obtained from the configuration file according to the device fingerprint again; The firmware upgrade module is configured to upgrade the target device based on the communication protocol, the upgrade instruction set, the firmware data unit queue and the total packet check value, wherein the communication protocols of different devices correspond to different data transmission frame formats; the upgrading of the target device based on the communication protocol, the upgrade instruction set, the firmware data unit queue and the total packet check value comprises: determining that the communication protocol is the protocol for communicating with the target device; sending the firmware unit data in the firmware data unit queue to the target device according to the upgrade step indicated by the upgrade instruction in the upgrade instruction set; after the data transmission in the firmware data unit queue is completed, performing upgrade checking based on the total packet check value, and if the checking is passed, generating an upgrade result for indicating that the upgrade of the target device is successful; the sending of the firmware unit data in the firmware data unit queue to the target device according to the upgrade step indicated by the upgrade instruction in the upgrade instruction set comprises: taking one firmware data unit from the head of the firmware data unit queue; sending the firmware data unit to the target device; updating the upgrade progress if the confirmation information sent by the target device based on the firmware data unit is received; before the firmware data unit is sent to the target device, the working condition of the target device is further checked to determine whether the working condition of the target device meets the firmware upgrade condition or the condition for prohibiting the solid state upgrade; and in the case that the working condition of the target device meets the condition for prohibiting the solid state upgrade, the solid state upgrade is prohibited.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the device upgrade method according to any one of claims 1 to 5.

8. A computer program product, characterised in that, The computer program is run to cause the device upgrade method according to any one of claims 1 to 5 to be executed.

Citation Information

Patent Citations

  • Program upgrading method and system, application system, and storage medium

    CN109358883A

  • Upgrading method compatible with multiple upgrading protocols

    CN117472411A

  • Server cluster license obtaining method and device, equipment and medium

    CN119691706A