Equipment upgrading method and system, computer equipment and computer program product
By generating fingerprints for the device and obtaining the total upgrade firmware package for automatic upgrade, the compatibility problem in the firmware upgrade of industrial IoT devices is solved, and efficient multi-model device management is achieved.
Patent Information
- Application Number
- CN202510927769.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-07
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-07-07
AI Technical Summary
In the firmware upgrade of industrial IoT devices, the existing technology has problems such as fragmentation of protocol analysis, incompatible firmware formats, and different security verification logic, resulting in low management efficiency of multi-model equipment and high R&D costs.
By generating a unique device fingerprint for the device, querying the communication protocol, obtaining the total upgrade firmware package and verifying it, generating a firmware data unit queue and total package verification value, and automatically upgrading based on the upgrade instruction set.
It has achieved automatic firmware upgrades for equipment of different types and different communication protocols, which has high versatility and scalability, and has improved development efficiency.
Smart Images

Figure CN120492003A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of firmware upgrade technology, and in particular relates to a device upgrade method, system, computer device, and computer program product. Background Art
[0002] When upgrading firmware for Industrial IoT devices, companies often use Bluetooth to wirelessly update devices from mobile devices. Current mainstream industrial control protocols and proprietary protocols differ significantly in data frame formats, verification mechanisms, and device addressing methods. This leads to compatibility challenges when integrating outsourced equipment, such as fragmented protocol parsing, incompatible firmware package formats, and varying security verification logic.
[0003] Traditional upgrade solutions require custom development of protocol parsing modules and verification processes for each device type. When connecting a new device model, developers must repeatedly parse protocol documentation, reconstruct communication instruction sets, and verify security policies, resulting in exponentially increasing R&D costs. This "one device, one solution" model severely restricts the efficiency of unified management of multiple device models, necessitating the development of a universal and highly scalable device upgrade solution. Summary of the Invention
[0004] In view of this, the embodiments of the present application provide a device upgrade, system, computer device and computer program product to achieve automated firmware upgrades for devices compatible with different types and different communication protocols, and have high versatility and scalability, which can improve development efficiency.
[0005] A first aspect of an embodiment of the present application provides a device upgrade method, including: Generate a unique device fingerprint for each target device among the devices to be identified; querying a configuration file for a communication protocol of the target device based on the device fingerprint; Obtaining a total upgrade firmware package of the target device, performing firmware verification on the total upgrade firmware package, and generating a firmware verification result; If 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, the firmware data unit queue including a plurality of firmware data units, each of the firmware data units including a firmware block and a block verification code corresponding to the firmware block; Acquire an upgrade instruction set for the target device based on the device fingerprint, where the upgrade instruction set includes multiple upgrade instructions; The target device is upgraded based on the communication protocol, the upgrade instruction set, the firmware data unit queue and the total packet check value.
[0006] In an implementation of the first aspect, before generating a unique device fingerprint for each target device among the devices to be identified, the method further includes: Perform device scanning and establish a preliminary connection with each scanned device to be identified; Respectively obtaining service information of each of the devices to be identified with which the preliminary connection is established; Matching is performed in the configuration file according to the service information of each device to be identified, and determining whether each device to be identified is a target device.
[0007] In an implementation of the first aspect, generating a unique device fingerprint for each target device among the devices to be identified includes: Obtaining a unique identifier and service information of each of the target devices; A device fingerprint is generated for each target device according to the unique identifier and the service information of each target device.
[0008] In an implementation of the first aspect, the total upgrade firmware package includes a latest firmware package, and 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 includes: Communicate with the target device based on the communication protocol to obtain the device model and current firmware version of the target device; Query the latest firmware version of the target device based on the device model; When the latest firmware version is different from the current firmware version, obtaining the latest firmware package of the target device; Parsing the latest firmware package to obtain a first device model corresponding to the latest firmware package; In a case where the first device model and the device model of the target device are the same, a firmware verification result is generated indicating that the total upgrade firmware package passes firmware verification.
[0009] In an implementation of the first aspect, when the firmware verification result indicates that the total upgrade firmware package passes firmware verification, generating a firmware data unit queue and a total package verification value based on the total upgrade firmware package includes: If the firmware verification result indicates that the total upgrade firmware package passes the firmware verification, dividing the total upgrade firmware package into a plurality of firmware blocks; Querying the configuration file for a firmware package verification algorithm set corresponding to the target device according to the device fingerprint; generating, according to a verification algorithm in the firmware package verification algorithm set, a total package verification value of the total upgrade firmware package and a block verification code corresponding to each firmware block; Each of the firmware blocks and the corresponding block check code are respectively combined into a firmware data unit, and the firmware data unit is added to a firmware data unit queue.
[0010] In an implementation 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 packet check value includes: Determining the communication protocol as a 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 steps indicated by the upgrade instructions in the upgrade instruction set; After the data transmission in the firmware data unit queue is completed, an upgrade check is performed based on the total packet check value, and if the check passes, an upgrade result indicating that the target device is successfully upgraded is generated.
[0011] In an implementation of the first aspect, the sending, according to the upgrade step indicated by the upgrade instruction in the upgrade instruction set, the firmware unit data in the firmware data unit queue to the target device, includes: Taking out a 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 upon receiving confirmation information sent by the target device based on the firmware data unit; If the firmware data unit queue is not empty, returning to the step of taking out a firmware data unit from the head of the firmware data unit queue; When the firmware data unit queue is empty, sending an end identifier to the target device; After the data transmission in the firmware data unit queue is completed, performing an upgrade check based on the total packet check value, and generating an upgrade result indicating that the target device is successfully upgraded if the check passes, including: Receiving a complete verification code sent by the target device based on the end identifier; When the complete check code and the total package check value are equal, generating an upgrade result indicating that the target device is successfully upgraded; In a case where the complete check code and the total package check value are not equal, an upgrade result indicating that the upgrade of the target device is unsuccessful is generated.
[0012] A second aspect of an embodiment of the present application provides a device upgrade system, including: A fingerprint generation module, configured to generate a unique device fingerprint for each target device in the devices to be identified; A configuration query module, configured to query a configuration file for a communication protocol of the target device based on the device fingerprint; A firmware verification module, 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; a firmware partitioning module, configured to generate a firmware data unit queue and a total package check value based on the total upgrade firmware package if the firmware check result indicates that the total upgrade firmware package passes the firmware check, wherein the firmware data unit queue includes a plurality of firmware data units, each of which includes a firmware block and a block check code corresponding to the firmware block; An instruction acquisition module, configured to acquire an upgrade instruction set for the target device from a fingerprint upgrade library based on the device fingerprint, wherein the upgrade instruction set includes a plurality of upgrade instructions; A firmware upgrade module is used 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.
[0013] A third aspect of an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the device upgrade method described in the first aspect when executing the computer program.
[0014] A fourth aspect of the embodiments of the present application provides a computer program product, characterized in that it includes a computer program, and when the computer program is run, the device upgrade method as described in the first aspect is executed.
[0015] The beneficial effect of the first aspect of the embodiment of the present application is: by generating a device fingerprint for the target device, and querying the communication protocol of the target device in the configuration file based on the device fingerprint, the total upgrade firmware package of the target device is obtained, and after the total upgrade firmware package passes the verification, a firmware data unit queue and a total package verification value are generated based on the total upgrade firmware package, and then the upgrade instruction set of the target device is obtained based on the device fingerprint, and finally, based on the communication protocol, the firmware data unit queue and the total package verification value are sent to the target device under the instruction of the upgrade instruction set to realize the upgrade of the target device, and the above-mentioned device upgrade method can realize automatic firmware upgrade of devices of different types and different communication protocols, and has high versatility and scalability, which can improve development efficiency.
[0016] It can be understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0018] Figure 1 This is a schematic diagram of the implementation process of the device upgrade method provided in the embodiment of the present application; Figure 2 This is a schematic diagram of the implementation process of the device upgrade method provided in the embodiment of the present application; Figure 3 This is a schematic diagram of the implementation process of the device upgrade method provided in the embodiment of the present application; Figure 4 This is a schematic diagram of the structure of the device upgrade system provided in an embodiment of the present application; Figure 5 is a schematic diagram of a computer device provided in an embodiment of the present application; Figure 6 It is a schematic diagram of a computer program product provided in an embodiment of the present application. DETAILED DESCRIPTION
[0019] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0020] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0021] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0022] As used in this specification and the appended claims, the term "if" can be interpreted as "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 [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0023] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0024] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0025] The embodiment of the present application provides a device upgrade method for realizing automatic firmware upgrades for devices of different types and different communication protocols, and has high versatility and scalability, which can improve development efficiency. The device upgrade method provided by the present application generates a device fingerprint for the target device, and queries the communication protocol of the target device in the configuration file based on the device fingerprint, obtains the total upgrade firmware package of the target device, and after the total upgrade firmware package passes the verification, generates a firmware data unit queue and a total package verification value based on the total upgrade firmware package, and then obtains the upgrade instruction set of the target device based on the device fingerprint. Finally, based on the communication protocol, the firmware data unit queue and the total package verification value are sent to the target device under the instruction of the upgrade instruction set to realize the upgrade of the target device. The above-mentioned device upgrade method can realize automatic firmware upgrades for devices of different types and different communication protocols, and has high versatility and scalability, which can improve development efficiency.
[0026] The device upgrade 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, laptops, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). It can communicate with various target devices, such as Bluetooth connections and local area network connections, to implement firmware upgrades for various target devices. The embodiments of the present application do not impose any restrictions on the specific types of computer devices.
[0027] like Figure 1 As shown, the embodiment of the present application provides a device upgrade method, including: Step S1: Generate a unique device fingerprint for each target device in the devices to be identified.
[0028] In an application, there are generally multiple devices to be identified. The target device among the devices to be identified is a trusted device. Only the target device is a device to be upgraded for firmware. Each target device corresponds to a unique device fingerprint.
[0029] Step S2: querying the communication protocol of the target device in a configuration file based on the device fingerprint.
[0030] In the application, the configuration file includes the configuration information of the target device, such as device model, device communication protocol information, upgrade instructions, service UUID (Universally Unique Identifier), firmware version, hardware version, device name, device model, etc. The configuration information of the corresponding target device can be uniquely found through a device fingerprint.
[0031] In applications, the communication protocols of different devices may vary, requiring accurate information to ensure communication quality. For example, the industrial control protocols used by end devices to communicate via Bluetooth include Modbus RTU and CANBus. These protocols differ in their data transmission frame formats: Modbus RTU uses a fixed format (address + function code + length + data + checksum), while CANBus uses a flexible format (ID + data + length + checksum).
[0032] Step S3: Obtain the total upgrade firmware package of the target device, perform firmware verification on the total upgrade firmware package, and generate a firmware verification result.
[0033] In the application, the total upgrade firmware package is the latest firmware package obtained from the upgrade server. If the total upgrade firmware package cannot be obtained from the server, the local firmware package can also be obtained locally as the total upgrade firmware package.
[0034] Step S4, when the firmware verification result indicates that the total upgrade firmware package passes the firmware verification, generates a firmware data unit queue and a total package verification value based on the total upgrade firmware package, the firmware data unit queue includes multiple firmware data units, each of the firmware data unit includes a firmware block and a block verification code corresponding to the firmware block.
[0035] In applications, the upgrade firmware package can be segmented into fixed byte blocks (e.g., 4KB per block), or adaptively divided into blocks based on the device's cache capacity. Each block is assigned a block number, which can be used to index and sequence the blocks within the upgrade firmware package. This block division reduces the amount of data transmitted per transmission, mitigates transmission failures due to network instability, supports breakpoint resuming and retransmission strategies, and facilitates block processing and verification on low-resource devices.
[0036] In the application, a block checksum is generated for each firmware block based on a preset checksum algorithm, such as a cyclic redundancy check (CRC). The firmware block and the corresponding block checksum are added to a firmware data unit queue as a firmware data unit. In the application, a total package checksum can be generated for the entire upgrade firmware package based on an integrity checksum algorithm.
[0037] Step S5: acquiring an upgrade instruction set of the target device based on the device fingerprint, wherein the upgrade instruction set includes a plurality of upgrade instructions.
[0038] In the application, the upgrade instructions in the upgrade instruction set of the target device are used to indicate the specific firmware upgrade steps of the target device. The upgrade instruction sets of different models of devices are different.
[0039] In the application, after first obtaining the target device's upgrade instruction set from the configuration file based on its device fingerprint, the target device's device fingerprint and its upgrade instruction set can be stored as a fingerprint upgrade data item in the fingerprint upgrade library. Subsequently, the target device's upgrade instruction set can be obtained from the fingerprint upgrade library based on the device fingerprint. If obtaining the upgrade instruction set from the fingerprint upgrade library fails, the upgrade instruction set can be obtained from the configuration file based on the device fingerprint again. Using the fingerprint upgrade library can speed up the acquisition of upgrade instruction sets.
[0040] Step S6: Upgrading the target device based on the communication protocol, the upgrade instruction set, the firmware data unit queue, and the total packet check value.
[0041] The device upgrade method provided in the embodiments of this application is applicable to the automated firmware upgrade of devices of different types and communication protocols, and can meet the upgrade requirements of devices of different types and communication protocols. The device upgrade method provided in this application can simultaneously upgrade the firmware of multiple devices based on multithreading, and is not limited by differences in device models, communication protocols, etc.
[0042] In one embodiment, before generating a unique device fingerprint for each target device in the devices to be identified, step S1 further includes: Step S01: Scan for devices and establish a preliminary connection with each scanned device to be identified.
[0043] Step S02: respectively obtaining service information of each device to be identified with which the preliminary connection is established.
[0044] Step S03 : matching the service information of each device to be identified with the configuration file to determine whether each device to be identified is a target device.
[0045] In the application, the service information of the device to be identified includes the device's service UUID (Universally Unique Identifier). The service information is searched in the configuration file based on 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 to be the target device.
[0046] In one embodiment, step S1, generating a unique device fingerprint for each target device among the devices to be identified, includes: Step S11: Acquire the unique identifier and service information of each target device.
[0047] Step S12: Generate a device fingerprint for each target device according to the unique identifier and the service information of each target device.
[0048] In the 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).
[0049] In one embodiment, the total upgrade firmware package includes the latest firmware package, and step S3 of 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 includes: Step S31: Communicate with the target device based on the communication protocol to obtain the device model and current firmware version of the target device.
[0050] Step S32: query the latest firmware version of the target device based on the device model.
[0051] Step S33: When the latest firmware version is different from the current firmware version, obtain the latest firmware package of the target device.
[0052] In most cases, the latest firmware version may be higher than the current firmware version, allowing the target device to upgrade its firmware version. In some cases, such as when the current firmware version has problems, the latest firmware version can be one version lower than the current firmware version, allowing the firmware version to be downgraded to a more secure and stable previous version.
[0053] Step S34: parsing the latest firmware package to obtain the first device model corresponding to the latest firmware package.
[0054] In the 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 be decrypted according to the latest firmware package password before parsing. By parsing the first device model in the latest firmware package, the device model that the firmware package is applicable to is obtained.
[0055] Step S35 : When the first device model and the target device model are the same, a firmware verification result is generated indicating that the total upgrade firmware package has passed the firmware verification.
[0056] In the application, if the first device model and the target device model are the same, it indicates that the general upgrade firmware package is applicable to the target device and can be used for firmware upgrade of the target device, and thus a firmware verification result is generated indicating that the general upgrade firmware package has passed the firmware verification. If the first device model and the target device model are different, it indicates that the general upgrade firmware package is not applicable to the target device.
[0057] like Figure 2 As shown, in one embodiment, the step S4, when the firmware verification result indicates that the total upgrade firmware package passes the firmware verification, generates a firmware data unit queue and a total package verification value based on the total upgrade firmware package, including: Step S41 : if the firmware verification result indicates that the total upgrade firmware package passes the firmware verification, divide the total upgrade firmware package into a plurality of firmware blocks.
[0058] In this application, taking a 150KB firmware file as an example, and using Bluetooth to transmit firmware data, the maximum Bluetooth Maximum Transmission Unit (MTU) is 517 bytes. 150KB = 150 × 1,024 = 153,600 bytes. If the MTU is set to 500 bytes, the 150KB firmware file needs to be sent 308 times in a row. This means the 150 total firmware upgrade package array is divided into 308 portions, each with 500 bytes of data. Step S42: query the configuration file for a firmware package verification algorithm set corresponding to the target device according to the device fingerprint.
[0059] In applications, different devices require different verification algorithms. The verification algorithm set 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.
[0060] Step S43 , generating a total package verification value of the total upgrade firmware package and a block verification code corresponding to each firmware block according to a verification algorithm in the firmware package verification algorithm set.
[0061] In step S44 , each of the firmware blocks and the corresponding block check code are respectively combined into a firmware data unit, and the firmware data unit is added to a firmware data unit queue.
[0062] 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 packet check value, includes: Step S61: Determine that the communication protocol is a protocol for communicating with the target device.
[0063] Step S62: sending the firmware unit data in the firmware data unit queue to the target device according to the upgrade steps indicated by the upgrade instructions in the upgrade instruction set.
[0064] Step S63: After the data transmission in the firmware data unit queue is completed, an upgrade verification is performed based on the total packet verification value. If the verification passes, an upgrade result indicating that the target device is successfully upgraded is generated.
[0065] like Figure 3 As shown, in one embodiment, the step S62, 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, includes: Step S621: Take a firmware data unit from the head of the firmware data unit queue.
[0066] In the application, the firmware data unit queue is implemented as a queue data structure with a first-in-first-out (FIFO) feature. The data at the head of the queue is the oldest data to be queued, and the data at the tail of the queue is the latest data to be queued. One firmware data unit is taken from the head of the queue each time until the queue is empty.
[0067] Step S622: Send the firmware data unit to the target device.
[0068] In the application, before sending the firmware data unit to the target device, the target device's operating conditions are checked to determine whether the target device's current operating conditions meet the firmware upgrade requirements or meet the conditions that prohibit the firmware upgrade. For example, the firmware upgrade is prohibited when the target device's battery power is less than 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.
[0069] Step S623: upon receiving confirmation information sent by the target device based on the firmware data unit, updating the upgrade progress.
[0070] In the application, the target device generates a check code based on the firmware block in the received firmware data unit and the algorithm required for firmware block verification, such as cyclic redundancy check. If the check code is equal to the block check code of the firmware block, it means that the firmware block in the firmware data unit has passed the verification, and then sends an acknowledgment message (ACK) and updates the upgrade progress.
[0071] Step S624: If the firmware data unit queue is not empty, return to step S621 to take out a firmware data unit from the head of the firmware data unit queue.
[0072] Step S625 : When the firmware data unit queue is empty, an end flag is sent to the target device.
[0073] The step S63, after the data transmission in the firmware data unit queue is completed, performing an upgrade check based on the total packet check value, and generating an upgrade result indicating that the target device has been successfully upgraded if the check passes, includes: Step S631: Receive a complete verification code sent by the target device based on the end identifier.
[0074] In the application, after receiving the end identifier, the target device combines the firmware data in all received firmware data units into a complete firmware data packet, and generates an integrity check code for the firmware data packet according to the integrity check algorithm.
[0075] Step S632: When the complete check code and the total package check value are equal, an upgrade result is generated to indicate that the target device is successfully upgraded.
[0076] In the application, each firmware block is verified through the block check code, and the complete firmware data packet composed of all firmware blocks received by the target device is verified through the integrity check code and the total packet check value, ensuring the reliability and security of the firmware data used for upgrading.
[0077] Step S633: When the complete check code and the total package check value are not equal, an upgrade result is generated to indicate that the upgrade of the target device is unsuccessful.
[0078] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0079] The present application also provides a device upgrade system for executing the steps of the device upgrade system method embodiment. The device upgrade system can be a virtual appliance in a computer device, run by a processor of the computer device, or it can be the computer device itself.
[0080] like Figure 4 As shown, the embodiment of the present application provides a device upgrade system 400, including: Fingerprint generation module 401, used to generate a unique device fingerprint for each target device in the devices to be identified; A configuration query module 402 is configured to query a configuration file for a communication protocol of the target device based on the device fingerprint; The firmware verification module 403 is used to obtain the total upgrade firmware package of the target device, perform firmware verification on the total upgrade firmware package, and generate a firmware verification result; a firmware partitioning module 404 configured to generate a firmware data unit queue and a total package check value based on the total upgrade firmware package if the firmware check result indicates that the total upgrade firmware package passes the firmware check, wherein the firmware data unit queue includes a plurality of firmware data units, each of which includes a firmware block and a block check code corresponding to the firmware block; An 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, wherein the upgrade instruction set includes multiple upgrade instructions; 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 packet check value.
[0081] In one embodiment, the device upgrade system 400 further includes: The scanning and identification module is used to: perform device scanning and establish a preliminary connection with each scanned device to be identified; obtain the service information of each device to be identified with which the preliminary connection is established; and match the service information of each device to be identified in the configuration file to determine whether each device to be identified is a target device.
[0082] In one embodiment, the fingerprint generation module 401 is configured to: Obtaining a unique identifier and service information of each of the target devices; A device fingerprint is generated for each target device according to the unique identifier and the service information of each target device.
[0083] In one embodiment, the firmware verification module 403 is configured to: communicate with the target device based on the communication protocol to obtain the device model and current firmware version of the target device; Query the latest firmware version of the target device based on the device model; When the latest firmware version is different from the current firmware version, obtaining the latest firmware package of the target device; Parsing the latest firmware package to obtain a first device model corresponding to the latest firmware package; In a case where the first device model and the device model of the target device are the same, a firmware verification result is generated indicating that the total upgrade firmware package passes firmware verification.
[0084] In one embodiment, the firmware partitioning module 404 is configured to: If the firmware verification result indicates that the total upgrade firmware package passes the firmware verification, dividing the total upgrade firmware package into a plurality of firmware blocks; Querying the configuration file for a firmware package verification algorithm set corresponding to the target device according to the device fingerprint; generating, according to a verification algorithm in the firmware package verification algorithm set, a total package verification value of the total upgrade firmware package and a block verification code corresponding to each firmware block; Each of the firmware blocks and the corresponding block check code are respectively combined into a firmware data unit, and the firmware data unit is added to a firmware data unit queue.
[0085] In one embodiment, the firmware upgrade module 406 is configured to: Determining the communication protocol as a 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 steps indicated by the upgrade instructions in the upgrade instruction set; After the data transmission in the firmware data unit queue is completed, an upgrade check is performed based on the total packet check value, and if the check passes, an upgrade result indicating that the target device is successfully upgraded is generated.
[0086] In one embodiment, the firmware upgrade module 406 is configured to: Taking out a 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 upon receiving confirmation information sent by the target device based on the firmware data unit; If the firmware data unit queue is not empty, returning to the step of taking out a firmware data unit from the head of the firmware data unit queue; When the firmware data unit queue is empty, sending an end identifier to the target device; After the data transmission in the firmware data unit queue is completed, performing an upgrade check based on the total packet check value, and generating an upgrade result indicating that the target device is successfully upgraded if the check passes, including: Receiving a complete verification code sent by the target device based on the end identifier; When the complete check code and the total package check value are equal, generating an upgrade result indicating that the target device is successfully upgraded; In a case where the complete check code and the total package check value are not equal, an upgrade result indicating that the upgrade of the target device is unsuccessful is generated.
[0087] Figure 5 This is a schematic diagram of the structure of a computer device provided in one embodiment of the present application. Figure 5 As shown, the computer device 5 of this embodiment includes: at least one processor 50 ( Figure 5 Only one is shown in the figure) a processor, 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 of any of the above-mentioned device upgrade method embodiments when executing the computer program 52.
[0088] The computer device may include, but is not limited to, a processor 50 and a memory 51. Those skilled in the art will understand that Figure 5This is merely an example of the computer device 5 and does not constitute a limitation on the computer device 5 . The computer device 5 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device 5 may also include input and output devices, network access devices, etc.
[0089] The processor 50 may be a central processing unit (CPU), or 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, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.
[0090] In some embodiments, the memory 51 may be an internal storage unit of the computer device 5, such as a hard drive or memory of the computer device 5. In other embodiments, the memory 51 may also be an external storage device of the computer device 5, such as a plug-in hard drive, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, etc. Furthermore, the memory 51 may include both an internal storage unit of the computer device 5 and an external storage device. The memory 51 is used to store an operating system, application programs, a boot loader, data, and other programs, such as the program code of the computer program. The memory 51 may also be used to temporarily store data that has been output or is about to be output.
[0091] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of this application. Their specific functions and technical effects can be found in the method embodiment section and will not be repeated here.
[0092] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by 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 embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0093] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned various method embodiments can be implemented.
[0094] like Figure 6 As shown, an embodiment of the present application provides a computer program product 6, including a computer program 52. When the computer program 52 is run, the steps in the above-mentioned various device upgrade method embodiments are executed.
[0095] If the integrated unit is implemented as a software functional unit and sold or used as a standalone product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process steps in the above-mentioned method embodiments by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When executed by a processor, the computer program can implement the steps of each of the above-mentioned method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / computer equipment, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, removable hard drives, magnetic disks, or optical disks. In some jurisdictions, based on legislation and patent practice, computer-readable media cannot be electric carrier signals or telecommunication signals.
[0096] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0097] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0098] In the embodiments provided in this application, it should be understood that the disclosed computer devices and methods can be implemented in other ways. For example, the computer device embodiments described above are merely illustrative. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0099] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0100] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A device upgrade method, characterized in that: include: Generate a unique device fingerprint for each target device among the devices to be identified; querying a configuration file for a communication protocol of the target device based on the device fingerprint; Obtaining a total upgrade firmware package of the target device, performing firmware verification on the total upgrade firmware package, and generating a firmware verification result; If 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, the firmware data unit queue including a plurality of firmware data units, each of the firmware data units including a firmware block and a block verification code corresponding to the firmware block; Acquire an upgrade instruction set for the target device based on the device fingerprint, where the upgrade instruction set includes multiple upgrade instructions; The target device is upgraded based on the communication protocol, the upgrade instruction set, the firmware data unit queue and the total packet check value.
2. The device upgrade method according to claim 1, wherein: Before generating a unique device fingerprint for each target device in the devices to be identified, the method further includes: Perform device scanning and establish a preliminary connection with each scanned device to be identified; Respectively obtaining service information of each of the devices to be identified with which the preliminary connection is established; Matching is performed in the configuration file according to the service information of each device to be identified, and determining whether each device to be identified is a target device.
3. The device upgrade method according to claim 2, wherein: Generating a unique device fingerprint for each target device in the devices to be identified includes: Obtaining a unique identifier and service information of each of the target devices; A device fingerprint is generated for each target device according to the unique identifier and the service information of each target device.
4. The device upgrade method according to any one of claims 1 to 3, characterized in that: The total upgrade firmware package includes the latest firmware package, and 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 includes: Communicate with the target device based on the communication protocol to obtain the device model and current firmware version of the target device; Query the latest firmware version of the target device based on the device model; When the latest firmware version is different from the current firmware version, obtaining the latest firmware package of the target device; Parsing the latest firmware package to obtain a first device model corresponding to the latest firmware package; In a case where the first device model and the device model of the target device are the same, a firmware verification result is generated indicating that the total upgrade firmware package passes firmware verification.
5. The device upgrading method according to any one of claims 1 to 3, characterized in that: When 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 includes: If the firmware verification result indicates that the total upgrade firmware package passes the firmware verification, dividing the total upgrade firmware package into a plurality of firmware blocks; Querying the configuration file for a firmware package verification algorithm set corresponding to the target device according to the device fingerprint; generating, according to a verification algorithm in the firmware package verification algorithm set, a total package verification value of the total upgrade firmware package and a block verification code corresponding to each firmware block; Each of the firmware blocks and the corresponding block check code are respectively combined into a firmware data unit, and the firmware data unit is added to a firmware data unit queue.
6. The device upgrade method according to claim 5, wherein: 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 includes: Determining the communication protocol as a 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 steps indicated by the upgrade instructions in the upgrade instruction set; After the data transmission in the firmware data unit queue is completed, an upgrade check is performed based on the total packet check value, and if the check passes, an upgrade result indicating that the target device is successfully upgraded is generated.
7. The device upgrade method according to claim 6, wherein: The step of sending the firmware unit data in the firmware data unit queue to the target device according to the upgrade instruction in the upgrade instruction set includes: Taking out a 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 upon receiving confirmation information sent by the target device based on the firmware data unit; If the firmware data unit queue is not empty, returning to the step of taking out a firmware data unit from the head of the firmware data unit queue; When the firmware data unit queue is empty, sending an end identifier to the target device; After the data transmission in the firmware data unit queue is completed, performing an upgrade check based on the total packet check value, and generating an upgrade result indicating that the target device is successfully upgraded if the check passes, including: Receiving a complete verification code sent by the target device based on the end identifier; When the complete check code and the total package check value are equal, generating an upgrade result indicating that the target device is successfully upgraded; In a case where the complete check code and the total package check value are not equal, an upgrade result indicating that the upgrade of the target device is unsuccessful is generated.
8. A device upgrade system, characterized in that: include: A fingerprint generation module, configured to generate a unique device fingerprint for each target device in the devices to be identified; A configuration query module, configured to query a configuration file for a communication protocol of the target device based on the device fingerprint; A firmware verification module, 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; a firmware partitioning module, configured to generate a firmware data unit queue and a total package check value based on the total upgrade firmware package if the firmware check result indicates that the total upgrade firmware package passes the firmware check, wherein the firmware data unit queue includes a plurality of firmware data units, each of which includes a firmware block and a block check code corresponding to the firmware block; An instruction acquisition module, configured to acquire an upgrade instruction set for the target device from a fingerprint upgrade library based on the device fingerprint, wherein the upgrade instruction set includes a plurality of upgrade instructions; A firmware upgrade module is used 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.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the device upgrading method according to any one of claims 1 to 7 are implemented.
10. A computer program product, characterized in that The device comprises a computer program, which enables the device upgrading method according to any one of claims 1 to 7 to be executed when the computer program is executed.
Citation Information
Patent Citations
Program upgrading method and system, application system, and storage medium
CN109358883A
Internet of Things equipment upgrading system
CN113342371A
Firmware upgrading method based on cloud side collaboration, server side and edge gateway side
CN115529301A
Upgrading method compatible with multiple upgrading protocols
CN117472411A
Photovoltaic energy storage system battery upgrading method and device, terminal equipment and storage medium
CN118689512A