Firmware installation method and electronic equipment
By analyzing the configuration file, obtaining the target identifier of the target sensor and sending the installation file to the target sensor, a unified firmware installation method for a universal serial bus sensor is realized, solving the problems of high firmware upgrade costs and poor maintenance in the existing technology, and improving development efficiency and scalability.
Patent Information
- Application Number
- CN202510012425.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-05-27
AI Technical Summary
In the prior art, the firmware upgrade of general serial bus sensors lacks a unified method, resulting in high development costs, large resource investment, long development cycle, poor maintenance and poor scalability.
Provide a firmware installation method, by obtaining the installation files and configuration files in the firmware update file, parsing the configuration files to obtain the target identifier of the target sensor, and sending the installation files to the target sensor based on the identifier, realizing the firmware installation of the target sensor.
This method simplifies the firmware upgrade process, reduces development costs and resource investment, improves maintainability and scalability, and can be quickly generalized and used for a long time.
Smart Images

Figure CN120045195A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of electronic technologies, including but not limited to a firmware installation method and an electronic device. Background Art
[0002] Currently, there are many types of sensors for various Universal Serial Bus (USB). There is no unified method for firmware (FW) upgrade of USB sensors, and the firmware upgrade of sensor devices can only be completed by relying on the software provided by each vendor. The disadvantages of this solution are: high development cost, large resource investment, long development cycle, poor maintainability, poor scalability, high design requirements, and inability to be quickly generalized and used for a long time. Summary of the Invention
[0003] In view of this, the embodiments of the present application provide a firmware installation method and an electronic device.
[0004] The technical solution of the embodiments of the present application is implemented as follows:
[0005] In a first aspect, the embodiments of the present application provide a firmware installation method, including:
[0006] Obtain a firmware update file, where the firmware update file includes an installation file and a configuration file corresponding to a target sensor;
[0007] Parse the configuration file to obtain a target identifier corresponding to the target sensor;
[0008] Based on the target identifier, send the installation file to the target sensor so that the target sensor installs the installation file.
[0009] In a second aspect, the embodiments of the present application provide a firmware installation device, including:
[0010] A first obtaining module, configured to obtain a firmware update file, where the firmware update file includes an installation file and a configuration file corresponding to a target sensor;
[0011] A first parsing module, configured to parse the configuration file to obtain a target identifier corresponding to the target sensor;
[0012] A first sending module, configured to send the installation file to the target sensor based on the target identifier so that the target sensor installs the installation file.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it realizes obtaining a firmware update file, where the firmware update file includes an installation file and a configuration file corresponding to a target sensor; parsing the configuration file to obtain a target identifier corresponding to the target sensor; and based on the target identifier, sending the installation file to the target sensor so that the target sensor installs the installation file.
[0014] In a fourth aspect, an embodiment of the present application provides a storage medium storing executable instructions, which are used to realize obtaining a firmware update file when executed by a processor, where the firmware update file includes an installation file and a configuration file corresponding to a target sensor; parsing the configuration file to obtain a target identifier corresponding to the target sensor; and based on the target identifier, sending the installation file to the target sensor so that the target sensor installs the installation file.
[0015] In a fifth aspect, a computer program product includes a computer program or instruction. When the computer program or instruction is executed by a processor, it realizes obtaining a firmware update file, where the firmware update file includes an installation file and a configuration file corresponding to a target sensor; parsing the configuration file to obtain a target identifier corresponding to the target sensor; and based on the target identifier, sending the installation file to the target sensor so that the target sensor installs the installation file. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1A It is a schematic flowchart of the implementation process of a firmware installation method provided by an embodiment of the present application;
[0017] Figure 1B It is a schematic structural diagram of a firmware update file provided by an embodiment of the present application;
[0018] Figure 2 It is a schematic flowchart of the implementation process of generating a firmware update file provided by an embodiment of the present application;
[0019] Figure 3 It is a schematic flowchart of the implementation process of a firmware installation method provided by an embodiment of the present application;
[0020] Figure 4A It is a schematic flowchart of the process of upgrading the firmware of a sensor device provided by an embodiment of the present application;
[0021] Figure 4B It is a schematic flowchart of the implementation process of upgrading the firmware of a sensor provided by an embodiment of the present application;
[0022] Figure 5 It is a schematic structural diagram of the composition of a firmware installation device provided by an embodiment of the present application;
[0023] Figure 6 A hardware entity schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the specific technical solution of the embodiments of the present application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.
[0025] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0026] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0028] The present application embodiment provides a firmware installation method, such as Figure 1A As shown, the method includes:
[0029] Step S101: Acquire a firmware update file, wherein the firmware update file includes an installation file and a configuration file corresponding to a target sensor;
[0030] Here, firmware is a software program embedded in a hardware device (such as a computer, mobile phone, sensor, etc.) to control the basic functions and operations of the device. Firmware is usually stored in the read-only memory of the hardware device. By updating the firmware regularly, you can ensure that the device is in the best condition and enjoy the latest features and security improvements.
[0031] The firmware update file is a firmware update file sent by an electronic device to a sensor connected to the electronic device, and is used to update the firmware of the sensor. For example, a sensor can be connected to an electronic device through a standard USB interface, where there are many types of sensors, such as pressure sensors, power sensors, temperature sensors, vibration sensors, displacement sensors, acceleration sensors, etc.
[0032] In some embodiments, multiple different types of sensors can be integrated into one device. For example, an environmental monitoring device integrating a temperature sensor, a humidity sensor, and a vibration sensor, and a speed monitoring device integrating a radar, a camera, an ultrasonic sensor, an accelerometer, and a gyroscope. Different sensors in the integrated device correspond to different sensor firmware.
[0033] Here, the firmware update file includes an installation file and a configuration file corresponding to the target sensor. Among them, the installation file can be an update package for updating the firmware of the target sensor, and the configuration file can be used to characterize the sensor information and installation file information corresponding to the target sensor. In some embodiments, the configuration file can be stored in the form of a parameter table.
[0034] Figure 1B The following is a schematic structural diagram of a firmware update file provided by an embodiment of the present application. As Figure 1B shown, the firmware update file includes: an update data file (Update Capsule), a parameter table (Device File), and a signature file (Catalog File). Among them,
[0035] The update data file, that is, the update capsule, is a firmware update mechanism defined under the Unified Extensible Firmware Interface (UEFI) specification. It allows the operating system to send the firmware information to be updated to the system firmware, and during the next startup process, the system updates the firmware before locking the Flash device.
[0036] The update data file includes updated system firmware, updated device firmware, and UEFI drivers.
[0037] The updated system firmware refers to updating the low-level programming of the hardware device to improve the performance, security, or fix known bugs of the device.
[0038] The updated device firmware refers to updating or upgrading the software (firmware) embedded in the hardware device to improve the performance, security, compatibility, or fix known bugs of the device.
[0039] The UEFI driver is a special type of driver that is loaded by the UEFI firmware when the electronic device starts up and is used to initialize and configure hardware devices such as graphics cards, network cards, and sound cards. These drivers allow the UEFI firmware to communicate with the hardware devices, ensuring that the devices are correctly configured and ready for data transmission before the system starts up.
[0040] A parameter table is a file used to describe data information such as devices or files. It can be composed of standard ASCII codes and its content can be viewed and modified with any text editor.
[0041] A signature file is a digital signature file used to verify the security and integrity of firmware update files (such as updated device firmware). It contains metadata related to the firmware update file, such as file size, hash value, etc.
[0042] Here, the configuration file can include a parameter table and a signature file.
[0043] Step S102: Parse the configuration file to obtain the target identifier corresponding to the target sensor.
[0044] Here, since the target identifier of the target sensor can be pre-stored in the parameter table of the configuration file, the target identifier of the target sensor can be obtained by parsing the configuration file. For example, the target identifier can be the manufacturer identifier or model identifier of the target sensor. The serial number of the target sensor can be pre-stored in the configuration file in advance. During implementation, the serial number stored in the configuration file can be parsed using the rule for parsing the sensor serial number to obtain the manufacturer identifier or model identifier of the target sensor.
[0045] Step S103: Based on the target identifier, send the installation file to the target sensor so that the target sensor installs the installation file.
[0046] During implementation, first, the target sensor to be sent can be determined based on the target identifier, and then the installation file is sent to the target sensor so that the target sensor installs the installation file. For example, based on the target identifier being a target sensor of model a produced by manufacturer A, the installation file can be sent to the target sensor of model a produced by manufacturer A connected to the electronic device to update the firmware of the target sensor based on the installation file.
[0047] In some embodiments, the configuration file can be parsed to obtain multiple target identifiers corresponding to multiple target sensors; different target sensors can correspond to different installation files. During implementation, multiple installation files can be sent to the corresponding multiple target sensors respectively based on the multiple target identifiers to achieve synchronous reception of installation files by multiple target sensors.
[0048] In the embodiments of the present application, first, a firmware update file including an installation file and a configuration file corresponding to a target sensor is obtained; then, the configuration file is parsed to obtain a target identifier corresponding to the target sensor; finally, based on the target identifier, the installation file is sent to the target sensor so that the target sensor installs the installation file. In this way, by setting the configuration file in the firmware update file, the target sensor to which the installation file is to be sent can be determined using the configuration file, so as to enable the target sensor to receive and install the installation file. Further, the configuration file may further include multiple sensor identifiers, and multiple sensor identifiers can be recognized, and the installation file of each sensor is correspondingly sent to the corresponding sensor, realizing synchronous sending of the installation files of multiple sensors and enabling each sensor to install the corresponding installation file, effectively improving the efficiency of installing the files of multiple sensors.
[0049] Figure 2 It is a schematic diagram of an implementation process for generating a firmware update file provided by the embodiments of the present application. As Figure 2 shown, it can be implemented through the following steps:
[0050] Step S210: Obtain the installation file corresponding to the target sensor;
[0051] Here, the installation file corresponding to the target sensor may be a software file for installing or updating the sensor firmware. These files contain the program code, configuration information, and necessary metadata required for the normal operation of the sensor. By installing a new firmware version, new functions can be added or existing functions can be improved, thereby enhancing the performance and reliability of the sensor. The firmware installation file may also contain fix programs for known errors, and these fixes can ensure that the sensor can operate stably under specific conditions. New hardware devices or software platforms may require updating the sensor firmware to ensure compatibility.
[0052] In the implementation process, the installation file can be obtained through the following methods:
[0053] Official channels: The sensor manufacturer provides official firmware download channels, and the installation file can be obtained from the manufacturer's official website or a designated download platform.
[0054] Authorized distributors: Some authorized distributors or partners may also provide download services for the installation file, and the installation file can be obtained through the network address provided by the authorized distributor or partner.
[0055] Step S220: Identify the target sensor and obtain the configuration file corresponding to the target sensor;
[0056] During the implementation process, the manufacturer information, model information, etc. of the target sensor can be obtained by identifying the target sensor, so as to generate a configuration file corresponding to the target sensor based on the manufacturer information and model information.
[0057] In some embodiments, when the target sensor is connected to the electronic device, an instruction to obtain the target sensor information can be sent to the target sensor to obtain the sensor information sent by the target sensor, and the sensor information (including the manufacturer information and model information) of the target sensor can be identified to generate a configuration file. For example, when the target sensor is connected to the electronic device using a USB interface, the serial number sent by the target sensor can be obtained through the USB interface, the sensor information of the target sensor can be identified from the serial number, and a configuration file can be generated based on the sensor information.
[0058] For example, Table 1 below is a configuration file provided by an embodiment of the present application:
[0059]
[0060] As shown in Table 1 above, the first column (Offset) represents the starting position, that is, from which bit to start obtaining data. For example, the number 4 in the second row represents starting to obtain data (blength) from the 4th bit.
[0061] The second column (Field) represents a specific attribute or feature of the data. The third column (Size) represents the size of the data; the fourth column (Value) represents the data type; the fifth column (Description) is a description of the specific attribute of this row, where
[0062] The first row (CRC): The checksum (CRC) of the entire file, with a size of 4 bytes, used to store numerical values, including integers and decimals, and is an immutable type. The byte information excluding CRC, that is, the checksum does not include the four bytes from 0 to 3.
[0063] The second row (bLength): The length of the sensor suffix, and this length information includes the byte information of CRC, with a size of 1 byte and a data type of 16 bits.
[0064] The third row (ucDfuSignature): The unique sensor signature field, with a size of 3 bytes. UC usually represents Unsigned Char, that is, the unsigned character type. This unsigned character type can only store non - negative integers, and its value range is usually from 0 to 255 (the maximum value that can be represented by an 8 - bit binary number).
[0065] Fourth line (bcdDFU): Sensor specification model, with a size of 2 bytes, Binary-Coded Decimal (BCD). In this encoding, each decimal digit (0 - 9) is represented as a 4-bit binary number.
[0066] Fifth line (idVendor): Vendor identifier, with a size of 2 bytes. The ID is a unique identifier used to uniquely identify a record in a database. The ID can be an integer type (such as an integer or a long integer) or a character type (such as a string or a GUID).
[0067] Sixth line (idProduct): Product identifier, with a size of 2 bytes. The ID is a unique identifier used to uniquely identify a record in a database.
[0068] Seventh line (bcdDevice): Device version number, with a size of 2 bytes, Binary-Coded Decimal.
[0069] Eighth line (Configuration): Configuration information. Bit0 = 1 sends a USB reset signal after upload or download is completed. Bit1:Bit2:Bit3 = 001 - 111 When uploading or downloading, after sending a detach request, wait 001 - 111 seconds and give up after the device re-enumerates. The default is 5 seconds. With a size of 4 bytes, Binary-Coded Decimal.
[0070] During implementation, the configuration file of the data structure in Table 1 above can be set in front of the firmware installation file. That is, by adding this configuration file as a header file, the sensor corresponding to the installation file can be determined based on this configuration file.
[0071] Step S230, generate the firmware update file based on the installation file corresponding to the target sensor and the configuration file.
[0072] During implementation, the configuration file and the installation file can be packaged into a firmware update file in a format that is easy to install and deploy. For example, based on the installation file and the binary image of the operating system or specific software of the electronic device.
[0073] In the embodiments of the present application, first obtain the installation file corresponding to the target sensor; then identify the target sensor and obtain the configuration file corresponding to the target sensor; finally, generate the firmware update file based on the installation file and the configuration file corresponding to the target sensor. In this way, in the case of obtaining the installation file of the target sensor, by identifying the target sensor again, the configuration file that can represent the sensor information of the target sensor is obtained, and the finally generated firmware update file contains both the installation file and the configuration file, so as to realize the installation of the configuration file of the target sensor by using the configuration file.
[0074] In some embodiments, the configuration file is used to record the target identifier of the target sensor and the sensor information corresponding to the target identifier, or,
[0075] Here, the configuration file can be for a corresponding target sensor, based on the target identifier of the target sensor and the sensor information corresponding to the target identifier.
[0076] For example, the configuration file can have the file structure as described in Table 1 above. Using this file structure, the specification model, supplier identifier, product identifier, etc. of the target sensor can be recorded as the target identifier, and the sensor firmware verification information, device version number, configuration information, etc. corresponding to the target identifier can also be recorded.
[0077] The configuration file is used to record the target identifier of at least one of the target sensors and the sensor information corresponding to the target identifier of each of the target sensors.
[0078] Furthermore, the target identifiers of multiple target sensors and the sensor information corresponding to each target identifier can be recorded in one configuration file.
[0079] For example, in one configuration file, the identifiers corresponding to the temperature sensor, humidity sensor, and vibration sensor integrated in an environmental monitoring device are recorded, as well as the sensor information corresponding to the temperature sensor, humidity sensor, and vibration sensor respectively.
[0080] In the embodiments of the present application, the configuration file is used to record the target identifier of the target sensor and the sensor information corresponding to the target identifier. In this way, it is possible to record the target identifier and sensor information of a target sensor using the configuration file, and each target sensor can be correspondingly provided with a configuration file to further use the configuration file to implement firmware installation for the target sensor.
[0081] The configuration file is used to record the target identifier of at least one target sensor and the sensor information corresponding to the target identifier of each target sensor. In this way, it is possible to integrate the identifiers and sensor information of multiple sensors in a device into one configuration file to further use the configuration file to implement firmware installation for each sensor in the device.
[0082] In some embodiments, the sensor information includes the firmware version. Before the step S103 of "sending the installation file to the target sensor" above, implementing firmware installation further includes the following steps:
[0083] Step S104: Parse the configuration file to obtain the target firmware version corresponding to the target sensor;
[0084] Here, as shown in Table 1 above, "bcdDevice" in the configuration file can record the version of the target sensor, that is, the target firmware version.
[0085] During the implementation process, the target firmware version can be obtained based on the position and occupied bytes of the field where this "bcdDevice" is recorded. For example, the starting position is the 14th byte and it occupies 2 bytes.
[0086] Step S105: Compare the target firmware version with the current firmware version of the target sensor to obtain a version comparison result;
[0087] During the implementation process, the current firmware version of the target sensor can be obtained to compare the parsed target firmware version and the current firmware version to determine the version comparison result. The comparison result includes that the target firmware version is the same as the current firmware version, the target firmware version is an upgraded version of the current firmware version, and the version level of the current firmware version is higher than the target firmware version.
[0088] In some embodiments, different identifiers can be used to represent the comparison result. For example, when the target firmware version is an upgraded version of the current firmware version, it is identified as 1; when the version level of the current firmware version is higher than the target firmware version, it is identified as 0; when the comparison result includes that the target firmware version is the same as the current firmware version, it is identified as 2. For example, the current firmware version of the temperature sensor obtained is version 1.0, and the obtained target firmware version is version 2.0. It is determined that the target firmware version is an upgraded version of the current firmware version and is identified as 1.
[0089] Step S106: Determine that the target firmware version is an upgraded version of the current firmware version based on the version comparison result.
[0090] During the implementation process, it can be determined that the target firmware version is an upgraded version of the current firmware version based on the comparison result.
[0091] For example, when the comparison result is 1, it is determined that the target firmware version is an upgraded version of the current firmware version. In this case, the step of installing the firmware installation file for the target sensor, that is, step S103, is executed.
[0092] In the embodiments of the present application, first, the configuration file is parsed to obtain the target firmware version corresponding to the target sensor; then, the target firmware version is compared with the current firmware version of the target sensor to obtain a version comparison result; based on the version comparison result, it is determined that the target firmware version is an upgraded version of the current firmware version. In this way, it is possible to first determine whether the target firmware version is an upgraded version and then execute the step of the installation file, improving the preparedness and efficiency of the version upgrade and effectively avoiding the ineffective execution where the target firmware version cannot support the upgrade of the target sensor.
[0093] In some embodiments, the sensor information includes configuration information, and the firmware installation method further includes the following steps:
[0094] Step S107: Analyze the configuration file to obtain the target configuration information corresponding to the target sensor;
[0095] Here, as shown in Table 1 above, "Configuration" in the configuration file can record the configuration information of the target sensor, that is, the target configuration information.
[0096] During implementation, based on the position and occupied bytes of the field where this "Configuration" is recorded, for example, the starting position is the 15th byte, the target configuration information can be obtained.
[0097] Step S108: Determine whether the target sensor performs a restart operation after the firmware upgrade is completed based on the target configuration information.
[0098] Here, as shown in Table 1 above, the configuration information is a total of 4 bytes. Bit0 = 1 indicates sending a USB reset signal after upload or download is completed. Bit1:Bit2:Bit3 = 001 - 111. When uploading or downloading, after sending a disconnection request, wait for 001 - 111 seconds and then give up after the device re-enumerates. The default is 5 seconds.
[0099] During implementation, based on the target configuration information, it can be determined whether the target sensor restarts immediately after the firmware upgrade is completed, or waits for a target time and then restarts.
[0100] In the embodiments of the present application, the configuration file is analyzed to obtain the target configuration information corresponding to the target sensor; in this way, it can be realized to determine whether the target sensor performs a restart operation after the firmware upgrade is completed based on the target configuration information.
[0101] In some embodiments, the sensor information includes verification information. Before "sending the installation file to the target sensor" in the above step S103, implementing firmware installation further includes the following steps:
[0102] Step S109: Analyze the configuration file to obtain the verification information;
[0103] Here, as shown in Table 1 above, "dwCRC" in the configuration file can record the verification information of the target sensor.
[0104] During implementation, based on the position and occupied bytes of the field where this "dwCRC" is recorded, for example, the starting position is the 15th byte and it occupies 2 bytes, the verification information can be obtained.
[0105] Step S110: Determine that the data in the firmware update file matches the preset data based on the verification information.
[0106] Here, the verification information can be important data for ensuring the integrity and correctness of the file. It can verify whether any changes have occurred during file transmission or storage. If the file is tampered with or damaged, its verification information will change, thus detecting data anomalies. By comparing the preset data and the verification information, it is ensured that the file has not been maliciously tampered with, thereby protecting the security of electronic devices and sensors.
[0107] In the embodiment of the present application, the configuration file is parsed to obtain the verification information. In this way, it can be determined that the data in the firmware update file matches the preset data. In the case of a match, the step of installing the file is then executed, effectively improving the security of the file installation process.
[0108] In some embodiments, the sensor information includes signature information. Before the step of "sending the installation file to the target sensor" in the above step S103, the following steps are further included to implement firmware installation:
[0109] Step S111: Parse the configuration file to obtain the signature information;
[0110] Here, as shown in Table 1 above, "ucDfuSignature" in the configuration file can record the signature information of the target sensor.
[0111] During implementation, the signature information can be obtained based on the position and occupied bytes of the field where "ucDfuSignature" is recorded. For example, the starting position is the 5th byte and it occupies 3 bytes.
[0112] Step S112: Determine that the signature information matches the preset signature specification.
[0113] Here, the signature information is an important security mechanism for verifying the integrity of the file and identifying the identity of the publisher. To ensure that the installation file has not been tampered with or damaged during transmission. When the file is tampered with, its signature information will change, thus detecting file anomalies. The signature information contains the identity information or digital certificate of the developer, which helps users identify the publisher of the file and prevent the installation of malicious software.
[0114] In some embodiments, the signature information is generated based on a hash algorithm and an encryption algorithm. The developer uses a private key to encrypt the hash value of the file to generate the signature information. During the verification phase, the user or system uses the public key to decrypt the signature information and compares it with the hash value of the file to verify the integrity of the file and the identity of the publisher.
[0115] During implementation, it is possible to determine whether the signature information is consistent with the pre-set signature specification. If the signature information is inconsistent, the system can reject the installation or upgrade to ensure the security and integrity of the firmware installation file.
[0116] In the embodiments of the present application, the configuration file is parsed to obtain the signature information. In this way, when it is determined that the signature information matches the pre-set signature specification, the steps of the installation file are then executed, effectively improving the security and integrity of the installation file process.
[0117] In some embodiments, the firmware update file further includes a management policy driver, and the above firmware installation method further includes the following steps:
[0118] Step S113: Parse the firmware update file to obtain the management policy driver;
[0119] Here, the Firmware Management Protocol (FMP) is a protocol defined by the Unified Extensible Firmware Interface (UEFI) specification, which can provide a standardized method for firmware update and management. The management policy driver, that is, the FMP driver, is an implementation of this protocol, used to establish communication between the operating system and the firmware in order to perform firmware update and management tasks.
[0120] During implementation, the management policy driver can be set in the firmware update file, and based on a pre-set parsing method, such as the storage information of the management policy driver, the management policy driver is parsed from the firmware update file.
[0121] Step S114: Execute the firmware management policy driver to enable the target sensor to install the installation file.
[0122] Here, the firmware management protocol provides a standardized way to perform firmware updates, supporting the download, verification, and installation of firmware. The protocol allows firmware updates to be performed while the system of the electronic device is running, without restarting the system or interrupting services.
[0123] During implementation, the firmware management policy driver can be executed to enable the target sensor to complete the task of installing the firmware installation file.
[0124] In the embodiments of the present application, the firmware update file is parsed to obtain the management policy driver. In this way, it is possible to execute the firmware management policy driver to enable the target sensor to install the installation file. The efficiency of installing the firmware installation file for the target sensor is improved.
[0125] In some embodiments, before "sending the installation file to the target sensor" in the above step S103, as Figure 3 shown, implementing firmware installation further includes the following steps:
[0126] Step S310: Based on the target identifier, send an upgrade instruction for firmware upgrade to the target sensor, so that the target sensor resets firmware loading in response to the upgrade instruction and runs in the device firmware update mode;
[0127] During implementation, the electronic device sends a message indicating readiness for upgrade to the target sensor. The waiting bus reset will stop all loaded drivers, and then step S320 will be executed to send the new firmware (installation file) to the target sensor. That is, the electronic device clears the current state and stops the loaded drivers through bus reset, so as to prepare for the sending and writing of the new firmware.
[0128] The target sensor sends a message indicating that the device firmware update mode has been activated to the electronic device to notify the electronic device that the target sensor has entered the device firmware update mode. In this state, enumerating the device firmware update descriptor set will prevent other drivers from being loaded. That is, after the system or device enumerates (i.e., identifies and configures) a device firmware update descriptor set, other drivers will be prevented from being loaded onto the device.
[0129] When the system enumerates a device firmware update descriptor set, it identifies that the target sensor is in the device firmware update mode and is ready for firmware update. During this process, to prevent the firmware update from being interfered with, the system prevents the loading of other drivers that may conflict with this update process. This is because different drivers may attempt to control the same device, resulting in data conflicts or device failures.
[0130] Step S320: Send the installation file to the target sensor;
[0131] During implementation, the installation file can be sent to the target sensor using the USB interface.
[0132] Step S330: Send a mode exit instruction to the target sensor to exit the device firmware update mode, so that the target sensor performs a restart operation to exit the device firmware update mode when it determines that the firmware upgrade is completed;
[0133] During implementation, the electronic device sends a mode exit instruction message for preparing to exit the device firmware update mode to the target sensor, which notifies the device to switch back from the device firmware update mode to the normal operating mode. In the device firmware update mode, the device is used to receive and install new firmware. Once the firmware update is completed or it is decided not to perform the update, the device exits the device firmware update mode so that the user can use its functions normally.
[0134] Here, when exiting the device firmware update, all reprogramming operations of the device are completed and it is ready to return to runtime. That is, all necessary firmware updates or configuration changes of the device have been completed. Preparing to return to runtime involves a series of preparatory work required for the device to smoothly transition from the device firmware update mode to the normal operating mode, which may include resetting the device, clearing temporary data, loading new firmware, etc.
[0135] Step S340: Obtain the descriptor corresponding to the updated firmware sent by the target sensor;
[0136] During implementation, the electronic device uses the USB interface to send a reset signal to the connected target sensor to return the target sensor to its initial state and re - perform the enumeration (i.e., identification and configuration) process. And it can enumerate the runtime descriptor of the new firmware to characterize that the new firmware of the device has taken effect and can be enumerated, and the device can be used normally. Among them, in a USB device, a descriptor is a data structure used to provide information about the device, configuration, interface, endpoints, etc.
[0137] Step S350: Determine the updated firmware information of the target sensor based on the descriptor corresponding to the updated firmware.
[0138] During implementation, the updated firmware information of the target sensor can be determined based on the information about the device, configuration, interface, endpoints, etc. in the descriptor reported by the target sensor.
[0139] In some embodiments, after the electronic device receives the firmware update file, steps S310 to S315 can be executed by the operating system of the electronic device.
[0140] In some embodiments, after the electronic device receives the firmware update file, the firmware update file can be passed to the Basic Input Output System (BIOS). After the BIOS receives the firmware update file, it parses the firmware update file to parse out the configuration file and the installation file. The BIOS executes the general USB firmware management policy driver, determines the target sensor based on the target identifier of the configuration file, executes the firmware management policy driver to refresh the firmware of the target sensor, and finally the BIOS feeds back the execution result to the operating system to end the firmware upgrade of the target sensor.
[0141] In the embodiment of the present application, first, an upgrade instruction for firmware upgrade is sent to the target sensor based on the target identifier; then the installation file is sent to the target sensor; a mode exit instruction for exiting the device firmware update mode is sent to the target sensor, and a descriptor corresponding to the updated firmware sent by the target sensor is obtained; finally, the updated firmware information of the target sensor is determined based on the descriptor corresponding to the updated firmware. In this way, it is possible to interact with the target sensor based on the target identifier parsed from the configuration file and complete the firmware installation of the target sensor.
[0142] Figure 4A It is a schematic flow diagram for upgrading the firmware of a sensor device provided by an embodiment of the present application. As Figure 4A shown, it can be implemented through the following steps:
[0143] Step S401: When the operating system receives a firmware update file upgrade, the firmware update file is passed to the BIOS;
[0144] Here, the USB interface protocol of the electronic device supports a unified firmware update (FW update) specification (Specification). The USB device (sensor) firmware upgrade specification is a standard for guiding how to update the firmware of a device through the USB interface. This specification can ensure that devices from different manufacturers can follow a unified upgrade process, thereby improving the compatibility and reliability of firmware updates. The firmware of the USB device supports this firmware update specification
[0145] The firmware update file can be a unified update package (WU package) integrating the firmware of multiple USB devices. The WU package, that is, the Windows update package, is a specific software package format used for updates and patch releases of the Windows operating system.
[0146] Step S402: After the BIOS receives the firmware update file, it parses the firmware update file and extracts the firmware management protocol driver and the firmware image from it;
[0147] Here, the firmware management protocol is a protocol defined by the Unified Extensible Firmware Interface (UEFI) specification, which can provide a standardized method for firmware update and management. The FMP driver is an implementation of this protocol, used to establish communication between the operating system and the firmware in order to perform firmware update and management tasks.
[0148] The firmware image (FW image) is data containing the new firmware version. It can be a binary file containing all the code and data structures of the firmware.
[0149] Step S403: The BIOS parses the parameter table of the firmware image;
[0150] Here, the parameter table at least includes the Vendor ID (VID) or the Device ID (DID);
[0151] Step S404: The BIOS determines the corresponding sensor device based on the vendor identifier or the device identifier, and executes the firmware management protocol driver to refresh the firmware of the sensor device;
[0152] During the implementation process, the BIOS refreshes the corresponding firmware of the sensor device by executing the firmware management protocol driver, and the sensor device is determined based on the vendor identifier or the device identifier.
[0153] Step S405: The BIOS feeds back the execution result to the operating system, and ends the upgrade of the sensor device firmware.
[0154] When the BIOS completes the firmware upgrade of the sensor device, the upgrade result is fed back to the operating system. The upgrade result includes successful upgrade and unsuccessful upgrade.
[0155] In the embodiment of the present application, the firmware of multiple sensor devices is integrated into a unified update package by adopting a horizontal architecture, which is flexible and extensible. The BIOS distributes at least one sensor firmware update data pushed through the update package to each sensor integrated in the AI Sensor Hub. Adopting a unified firmware management protocol driver facilitates the firmware upgrade and maintenance of the sensor device.
[0156] Figure 4B It is a schematic diagram of the implementation process for upgrading the sensor firmware provided by the embodiment of the present application. As Figure 4B shown, it can be realized through the following steps:
[0157] Step S411: Prepare for the upgrade;
[0158] During the implementation process, the host (electronic device) sends a message of preparing for the upgrade to the device (sensor). The waiting bus reset will stop all loaded drivers, and then new firmware will be sent. That is, the host clears the current state and stops the loaded drivers through the bus reset, so as to prepare for the sending and writing of the new firmware.
[0159] Step S412: Restart;
[0160] During implementation, the host restarts the device via USB, and this restart causes all runtime drivers to be unloaded. That is, the bus reset causes all runtime drivers to be unloaded, which is to ensure a clean and unconfigured state during firmware updates or device configuration changes. After the reset, the system reloads the drivers and configures the device as needed.
[0161] Step S413: The device firmware update mode is activated;
[0162] During implementation, the device sends a message to the host indicating that the device firmware update mode has been activated to notify the host that the device has entered the device firmware update mode. In this state, enumerating the device firmware update descriptor set will prevent other drivers from being loaded. That is, after the system or device enumerates (i.e., identifies and configures) a device firmware update descriptor set, other drivers will be prevented from being loaded onto the device.
[0163] When the system enumerates a device firmware update descriptor set, it identifies that the device is in the device firmware update mode and is ready for firmware update. During this process, to prevent the firmware update from being interfered with, the system prevents the loading of other drivers that may conflict with this update process. This is because different drivers may attempt to control the same device, resulting in data conflicts or device failures.
[0164] Step S414: Download the firmware;
[0165] During implementation, the host can send the target firmware corresponding to the target device to the target device based on the identification of the target device, enabling the device to download the corresponding firmware.
[0166] Step S415: Prepare to exit the device firmware update mode;
[0167] During implementation, the host sends a message to the device to prepare to exit the device firmware update mode, that is, to notify the device to switch back from the device firmware update mode to the normal operating mode. In the device firmware update mode, the device is used to receive and install new firmware. Once the firmware update is complete or it is decided not to update, the device exits the device firmware update mode so that the user can use its functions normally.
[0168] Here, when exiting the device firmware update, all reprogramming operations of the device are completed and it is ready to return to runtime. That is, all necessary firmware updates or configuration changes of the device have been completed. Being ready to return to runtime involves a series of preparatory work required for the device to smoothly transition from the device firmware update mode to the normal operating mode, which may include resetting the device, clearing temporary data, loading new firmware, etc.
[0169] Step S416: Restart.
[0170] During the implementation process, the host uses the USB interface to send a reset signal to the connected device, causing the device to return to its initial state and restart the enumeration (i.e., recognition and configuration) process. Moreover, it can enumerate the runtime descriptors of the new firmware to indicate that the new firmware of the device has taken effect and can be enumerated, and the device can be used normally. Among them, in a USB device, a descriptor is a data structure used to provide information about the device, configuration, interface, endpoints, etc.
[0171] In the embodiments of the present application, performing the above steps S411 to S416 can enable the device to complete the installation of the firmware in the firmware update mode, improving the reliability and efficiency of the firmware installation.
[0172] Based on the foregoing embodiments, the embodiments of the present application provide a firmware installation device. The device includes each module included, each module includes each sub-module, and each sub-module includes units, which can be implemented by a processor in an electronic device; of course, it can also be implemented by specific logic circuits; during the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0173] Figure 5 It is a schematic structural diagram of the composition of the firmware installation device provided by the embodiments of the present application, as Figure 5 shown, the device 500 includes:
[0174] A first acquisition module 510, which acquires a firmware update file, where the firmware update file includes an installation file and a configuration file corresponding to a target sensor;
[0175] A first parsing module 520, which is used to parse the configuration file to obtain a target identifier corresponding to the target sensor;
[0176] A first sending module 530, which is used to send the installation file to the target sensor based on the target identifier, so that the target sensor installs the installation file.
[0177] In some embodiments, the firmware installation device further includes a second acquisition module, an identification module, and a generation module. Among them, the second acquisition module is configured to acquire the installation file corresponding to the target sensor; the identification module is configured to identify the target sensor and acquire the configuration file corresponding to the target sensor; the generation module is configured to generate the firmware update file based on the installation file corresponding to the target sensor and the configuration file.
[0178] In some embodiments, the configuration file is used to record the target identifier of the target sensor and the sensor information corresponding to the target identifier, or the configuration file is used to record the target identifiers of at least one of the target sensors and the sensor information corresponding to the target identifier of each target sensor.
[0179] In some embodiments, the sensor information includes the firmware version. The firmware installation device further includes a second parsing module, a comparison module, and a first determination module. Among them, the second parsing module is configured to parse the configuration file to obtain the target firmware version corresponding to the target sensor; the comparison module is configured to compare the target firmware version with the current firmware version of the target sensor to obtain a version comparison result; the first determination module is configured to determine, based on the version comparison result, that the target firmware version is an upgraded version of the current firmware version.
[0180] In some embodiments, the sensor information includes configuration information. The firmware installation device further includes a third parsing module and a second determination module. Among them, the third parsing module is configured to parse the configuration file to obtain the target configuration information corresponding to the target sensor; the second determination module is configured to determine, based on the target configuration information, whether the target sensor performs a restart operation after the firmware upgrade is completed.
[0181] In some embodiments, the sensor information includes verification information and / or signature information. The firmware installation device further includes a fourth parsing module and a third determination module, and / or a fifth parsing module and a fourth determination module. Among them, the fourth parsing module is configured to parse the configuration file to obtain the verification information; the third determination module is configured to determine, based on the verification information, that the data in the firmware update file matches the preset data; the fifth parsing module is configured to parse the configuration file to obtain the signature information; the fourth determination module is configured to determine that the signature information matches the preset signature specification.
[0182] In some embodiments, the firmware update file further includes a management policy driver, and the firmware installation device further includes a sixth parsing module and an execution module. The sixth parsing module is configured to parse the firmware update file to obtain the management policy driver. The execution module is configured to execute the firmware management policy driver to cause the target sensor to install the installation file.
[0183] In some embodiments, the firmware installation device further includes a second sending module, configured to send an upgrade instruction for firmware upgrade to the target sensor, so that the target sensor resets firmware loading in response to the upgrade instruction and operates in the device firmware update mode.
[0184] In some embodiments, the firmware installation device further includes a third sending module, a third obtaining module, and a fifth determining module. The third sending module is configured to send a mode exit instruction for exiting the device firmware update mode to the target sensor based on the target identifier, so that the target sensor performs a restart operation to exit the device firmware update mode when it determines that the firmware upgrade is completed. The third obtaining module is configured to obtain a descriptor corresponding to the updated firmware sent by the target sensor. The fifth determining module is configured to determine the updated firmware information of the target sensor based on the descriptor corresponding to the updated firmware.
[0185] The description of the above device embodiments is similar to the description of the above method embodiments and has similar beneficial effects to those of the method embodiments. For the technical details not disclosed in the device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0186] It should be noted that in the embodiments of the present application, if the above method is implemented in the form of software function modules and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the related technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing an electronic device (which can be a mobile phone, a tablet computer, a notebook computer, a desktop computer, etc.) to execute all or part of the methods described in the embodiments of the present application. The foregoing storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disc. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0187] Correspondingly, an embodiment of the present application provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps in the firmware installation method provided in the above embodiments.
[0188] Correspondingly, an embodiment of the present application provides an electronic device. Figure 6 As shown in the schematic diagram of a hardware entity of the electronic device provided by the embodiment of the present application, Figure 6 as shown, the hardware entity of the device 600 includes a memory 601 and a processor 602. The memory 601 stores a computer program that can run on the processor 602. When the processor 602 executes the program, the steps in the firmware installation method provided in the above embodiment are implemented.
[0189] The memory 601 is configured to store instructions and applications executable by the processor 602, and can also cache data to be processed or already processed by the processor 602 and each module in the electronic device 600 (for example, image data, audio data, voice communication data, and video communication data), and can be implemented by flash memory (FLASH) or random access memory (Random Access Memory, RAM).
[0190] It should be noted here that the descriptions of the above storage medium and device embodiments are similar to the descriptions of the above method embodiments and have similar beneficial effects to the method embodiments. For the technical details not disclosed in the storage medium and device embodiments of the present application, please refer to the descriptions of the method embodiments of the present application for understanding.
[0191] It should be understood that the term "one embodiment" or "an embodiment" mentioned throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application. Therefore, the appearances of "in one embodiment" or "in an embodiment" throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the magnitudes of the sequence numbers of the above processes do not mean the order of execution is prior or subsequent. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. The sequence numbers of the embodiments of the present application above are only for description and do not represent the advantages or disadvantages of the embodiments.
[0192] It should be noted that in this article, the term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, such that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the phrase "including a..." does not exclude the presence of additional identical elements in the process, method, article or device including the element.
[0193] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the displayed or discussed components can be through some interfaces. The indirect coupling or communication connection of devices or units can be electrical, mechanical, or other forms.
[0194] The units described above as separate components may or may not be physically separated. The components displayed as units may or may not be physical units; they can be located in one place or distributed to multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0195] In addition, each functional unit in the embodiments of the present application can be all integrated in a processing unit, or each unit can be separately used as a unit, or two or more units can be integrated in a unit; the above-mentioned integrated units can be implemented in the form of hardware, or in the form of hardware plus software functional units.
[0196] Those of ordinary skill in the art can understand that all or part of the steps to implement the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments; and the foregoing storage medium includes: removable storage devices, read-only memory (ROM), magnetic disks, or optical disks, etc., which can store program codes.
[0197] Alternatively, if the above-mentioned integrated units of the present application are implemented in the form of software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application essentially or the part that contributes to the related technology can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions to enable an electronic device (which can be a mobile phone, a tablet computer, a notebook computer, a desktop computer, etc.) to execute all or part of the methods described in the embodiments of the present application. And the foregoing storage medium includes: removable storage devices, ROM, magnetic disks, or optical disks, etc., which can store program codes.
[0198] The methods disclosed in several method embodiments provided by this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0199] The features disclosed in several product embodiments provided by this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0200] The features disclosed in several method or device embodiments provided by this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0201] As mentioned above, it is only the implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should be covered within the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. A firmware installation method, the method comprising: Obtaining a firmware update file, wherein the firmware update file includes an installation file and a configuration file corresponding to the target sensor; Parsing the configuration file to obtain a target identifier corresponding to the target sensor; Based on the target identifier, the installation file is sent to the target sensor, so that the target sensor installs the installation file.
2. The method of claim 1, further comprising: Obtaining the installation file corresponding to the target sensor; Identify the target sensor, and obtain a configuration file corresponding to the target sensor; The firmware update file is generated based on the installation file corresponding to the target sensor and the configuration file.
3. The method according to claim 2, wherein the configuration file is used to record the target identification of the target sensor and the sensor information corresponding to the target identification, or The configuration file is used to record a target identifier of at least one of the target sensors and sensor information corresponding to the target identifier of each of the target sensors.
4. The method according to claim 3, wherein the sensor information includes a firmware version, and before sending the installation file to the target sensor, the method further comprises: Parsing the configuration file to obtain a target firmware version corresponding to the target sensor; Comparing the target firmware version with the current firmware version of the target sensor to obtain a version comparison result; The target firmware version is determined to be an upgraded version of the current firmware version based on the version comparison result.
5. The method of claim 3, wherein the sensor information includes configuration information, and the method further comprises: Parsing the configuration file to obtain target configuration information corresponding to the target sensor; Determine whether the target sensor performs a restart operation after completing the firmware upgrade based on the target configuration information.
6. The method according to claim 3, wherein the sensor information includes verification information and / or signature information, and before sending the installation file to the target sensor, the method further comprises: Parsing the configuration file to obtain the verification information; Determining, based on the verification information, that the data in the firmware update file matches the preset data; and / or, Parsing the configuration file to obtain the signature information; It is determined that the signature information matches a preset signature specification.
7. The method according to any one of claims 1 to 6, wherein the firmware update file further includes a management policy driver, and the method further includes: Parsing the firmware update file to obtain the management policy driver; The firmware management policy driver is executed to enable the target sensor to install the installation file.
8. The method according to any one of claims 1 to 6, before sending the installation file to the target sensor, the method further comprises: Based on the target identifier, an upgrade instruction for firmware upgrade is sent to the target sensor, so that the target sensor resets firmware loading in response to the upgrade instruction and operates in a device firmware update mode.
9. The method of claim 8, further comprising: Sending a mode exit instruction for exiting the device firmware update mode to the target sensor, so that the target sensor performs a restart operation to exit the device firmware update mode when determining that the firmware upgrade is completed; Obtaining a descriptor corresponding to the updated firmware sent by the target sensor; The updated firmware information of the target sensor is determined based on the descriptor corresponding to the updated firmware.
10. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor obtains a firmware update file when executing the program, wherein: The firmware update file includes an installation file and a configuration file corresponding to the target sensor; the configuration file is parsed to obtain a target identifier corresponding to the target sensor; based on the target identifier, the installation file is sent to the target sensor so that the target sensor installs the installation file.