CN115185553A - Method for updating device firmware of user and related device - Google Patents

Method for updating device firmware of user and related device Download PDF

Info

Publication number
CN115185553A
CN115185553A CN202110357075.5A CN202110357075A CN115185553A CN 115185553 A CN115185553 A CN 115185553A CN 202110357075 A CN202110357075 A CN 202110357075A CN 115185553 A CN115185553 A CN 115185553A
Authority
CN
China
Prior art keywords
target
firmware
equipment
partition
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110357075.5A
Other languages
Chinese (zh)
Inventor
黄福伟
刘涛
江壮伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen 3Nod Digital Technology Co Ltd
Original Assignee
Shenzhen 3Nod Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen 3Nod Digital Technology Co Ltd filed Critical Shenzhen 3Nod Digital Technology Co Ltd
Priority to CN202110357075.5A priority Critical patent/CN115185553A/en
Publication of CN115185553A publication Critical patent/CN115185553A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Abstract

The embodiment of the application belongs to the technical field of computers, and relates to a method for updating user equipment firmware and related equipment thereof, wherein the method comprises the steps that an operating system of a user computer carries out equipment detection operation, when the operating system detects any associated equipment, the detected associated equipment is taken as target equipment, and a drive program is downloaded and installed from an updating server; the operating system of the user computer finds the target firmware file through the driving program; and the operating system of the user computer creates a preparation example in the equipment manager through the driver, binds a callback function of firmware upgrading, starts the callback function of firmware upgrading to detect whether the current computer meets the upgrading condition, and sends the target firmware file and the upgrading instruction to the target equipment when the current computer meets the upgrading condition. According to the method and the device, the firmware of the device is updated and upgraded quickly, and meanwhile, more unnecessary hardware and software are avoided in the device.

Description

Method for updating device firmware of user and related device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method for updating a device firmware of a user and a related device.
Background
At present, most companies build a server, install a client on equipment, and query the server through the client to download firmware to execute updating. However, this approach requires more complex work, increases the cost of manpower and material resources, and increases the complexity of the equipment. The equipment needs to realize networking, realizes the self detection and downloading of programs, increases the complexity of hardware and software of the equipment end, and has more complex firmware upgrading of the equipment end.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method for updating a device firmware of a user and a related device thereof, so as to avoid a large amount of unnecessary hardware and software in the device while implementing a fast update and upgrade of the device firmware.
In order to solve the foregoing technical problem, an embodiment of the present application provides a method for updating a device firmware of a user, where the following technical solutions are adopted:
a method of updating a user's device firmware, comprising the steps of:
the operating system of the user computer carries out equipment detection operation, and when the operating system detects any associated equipment, the detected associated equipment is taken as target equipment, and a drive program is downloaded and installed from the update server;
the operating system of the user computer finds the target firmware file through the driving program;
and the operating system of the user computer creates a preparation example in the equipment manager through the driver, binds a callback function of firmware upgrading, starts the callback function of firmware upgrading to detect whether the current computer meets the upgrading condition, and sends the target firmware file and the upgrading instruction to the target equipment when the current computer meets the upgrading condition.
Further, the step of detecting whether the current computer meets the upgrade condition by the callback function for starting the firmware upgrade, and when the current computer meets the upgrade condition, sending the target firmware file and the upgrade instruction to the target device includes:
starting a callback function of the firmware upgrading, and detecting whether the current operating system is performing updating operation or not through the callback function;
when the current operating system is performing updating operation, starting a pre-established timer, and periodically detecting whether the current operating system is performing updating operation based on a preset time interval;
and when the current operating system does not carry out updating operation, transmitting the target firmware file to the target equipment, and sending an upgrading instruction to the target equipment.
Further, the step of detecting whether the current computer meets the upgrade condition by the callback function for starting the firmware upgrade, and sending the target firmware file and the upgrade instruction to the target device when the current computer meets the upgrade condition, includes:
starting a callback function of the firmware upgrade, detecting whether a current operating system is performing update operation or not through the callback function, and opening a handle of the target equipment to check the state of the target equipment;
when the current operating system is performing updating operation or the state of the target device is busy, starting a pre-established timer, regularly detecting whether the current operating system is performing updating operation or not based on a preset time interval, and detecting the state of the target device;
when the current operating system does not carry out updating operation and the state of the target equipment is idle, comparing whether the firmware version in the target equipment is consistent with the version of the target firmware file in the driving program or not;
and when the firmware version in the target equipment is inconsistent with the version of the target firmware file in the driver, sending the target firmware file and an upgrading instruction to the target equipment.
Further, the step that the operating system finds the target firmware file through the driver includes:
the operating system determines an installation file of the driver through the driver;
acquiring a target file path and a version number carried by an installation file of the driver;
and finding the target firmware file based on the target file path and the version number.
Further, after the step of sending the target firmware file and the upgrade instruction to the target device when the current computer meets the upgrade condition, the method further includes:
and the target equipment receives the target firmware file and the upgrading instruction sent by the user computer and executes equipment firmware upgrading operation.
Further, the target device includes a plurality of system partitions and data partitions, the target device receives the target firmware file and the upgrade instruction sent by the user computer, and the step of executing the device firmware upgrade operation includes:
the target equipment receives a target firmware file sent by a user computer, and stores the target firmware file in the data partition;
detecting a system partition initially operated by the target equipment as an initial partition;
decompressing the target firmware file to a system partition except the initial partition to obtain target firmware, and taking the system partition where the target firmware is located as a target partition;
and operating the target partition, determining the state of the operated target partition, and determining a system partition which continues to operate according to the state of the target partition.
Further, the system partition includes a first system partition and a second system partition, and the step of decompressing the target firmware file to the system partition other than the initial partition includes:
when the system partition initially operated by the target equipment is the first system partition, taking the first system partition as the initial partition, and decompressing the target firmware file into the second system partition to obtain target firmware;
when the system partition initially operated by the target equipment is the second system partition, taking the second system partition as the initial partition, and decompressing the target firmware file into the first system partition to obtain target firmware;
the step of operating the target partition, determining the state of the target partition after operation, and determining the system partition which continues to operate according to the state of the target partition comprises the following steps:
the target equipment modifies the variable corresponding to the starting operation so as to point the next operation to the target partition where the target firmware is located;
when a restart instruction is received, the target device runs the target partition;
the target device determines whether the running target partition can be started normally;
when the target partition can be started normally, determining that the target equipment is upgraded successfully, and operating the target partition;
and when the target partition is not normally started, the target equipment performs equipment restarting operation and points to the system partition initially operated by the target equipment.
The application provides a device for updating equipment firmware of a user, which comprises a user computer, wherein the user computer comprises:
the detection module is used for carrying out equipment detection operation, and when the operating system detects any associated equipment, the detection module takes the any associated equipment as target equipment and downloads and installs a driver from the update server;
the searching module is used for searching the target firmware file through the driving program;
the creating module is used for creating a device instance in the device manager through a driving program, creating a timer and binding a callback function of firmware upgrading, starting the callback function of firmware upgrading to detect whether the current computer meets upgrading conditions or not, and sending a firmware file and an upgrading instruction to the target device when the current computer meets the upgrading conditions.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which adopts the following technical solutions:
a computer device comprising a memory having computer readable instructions stored therein and a processor that when executed implements the steps of the method of updating a user's device firmware described above.
In order to solve the above technical problem, an embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solutions:
a computer readable storage medium having computer readable instructions stored thereon which, when executed by a processor, implement the steps of the above-described method of updating a user's device firmware.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
the method and the device simplify the hardware and software implementation of the user computer and the equipment, save manpower and material resources, enable the equipment to be more concentrated in the core function of the equipment, and are favorable for improving the product quality and the reliability. When the associated equipment is detected, the associated equipment is taken as target equipment, a driving program is loaded for the associated equipment, the target firmware file can be quickly found through the driving program, the environment is detected through a callback function, and when the environment meets the upgrading condition, the target firmware file is transmitted to the target equipment, so that the quick upgrading of the firmware of the target equipment is realized. By the method and the device, the target equipment does not need to be additionally configured and installed with the upgrading software, and only the target equipment firmware transmitted by the driving program needs to be received, so that the software redundancy in the target equipment is reduced, and the rapid firmware upgrading is realized.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram to which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method of updating a user's device firmware, according to the application;
FIG. 3 is a schematic block diagram illustrating one embodiment of an apparatus for updating device firmware of a user according to the present application;
FIG. 4 is a schematic block diagram of one embodiment of a computer device according to the present application.
Reference numerals: 101. a detection module; 102. a search module; 103. and creating a module.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein may be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
The method for updating the device firmware of the user is applied to a device firmware system for updating the user, and as shown in fig. 1, a system architecture may include an update server, a user computer and a device. The update server is connected to the user computer through a network, the user computer is connected to the device through a wired connection, for example, when the device is a USB device, the user computer is connected to the USB device through a USB cable, and the network may include various connection types, such as a wired connection, a wireless communication link, or an optical fiber cable.
It should be understood that the number of update servers, user computers, and devices in FIG. 1 is merely illustrative. There may be any number of update servers, user computers, and devices, as desired for an implementation.
The application supports automatic upgrading of firmware of USB equipment compatible with a Windows operating system, the equipment is usually sold and widely distributed in a computer use environment of a terminal user, and the application mode relates to a Windows driving program, a Windows updating mechanism and USB embedded equipment. The quality of product equipment can be continuously improved, because the equipment is sold and widely distributed in the computer environment of a plurality of remote users, the equipment can not be upgraded by manual maintenance, and in order to meet the changing customer requirements and perfect the problems found in the old firmware, the firmware in the terminal user equipment needs to be upgraded efficiently.
The application establishes a connection between the windows driver and the equipment to be upgraded. An extended driver installation file is made to create a virtual driver that is specific to the upgrade. Configuring the driver installation File to point to a Device ID (name) to be upgraded, specifying a path and a version number of a target firmware File in the driver installation File, setting an extension name inf (Device INFormation File) of the established target firmware File and the driver installation File, and uploading the target firmware File and the driver installation File to a windows update server respectively. And after receiving the target firmware file and the driver installation file, the windows update server automatically opens the driver installation file in a proper computer to install the driver, and simultaneously downloads the target firmware file to the user computer through the windows update server. Here, the appropriate computer refers to a computer that meets the conditions for supporting a driver and the like.
With continued reference to FIG. 2, a flow diagram of one embodiment of a method of updating a user's device firmware is shown, in accordance with the present application. The method for updating the equipment firmware of the user comprises the following steps:
s1: and when the operating system detects any associated equipment, the operating system takes the detected associated equipment as target equipment and downloads and installs the driver.
In this embodiment, the operating system is referred to as a windows operating system. The operating system determines whether any detected device is an associated device according to the device ID, so that the situation that the corresponding firmware file cannot be found and the device firmware cannot be upgraded is avoided. Wherein, the step of downloading and installing the driver from the update server comprises: and downloading and installing a driver from the update server, and registering a device creating function and an uninstalling function. In this application, the operating system performs a detection operation to determine whether a device is plugged into the computer. The following operations are implemented by the driver.
S2: and the operating system of the user computer finds the target firmware file through the driving program.
In this embodiment, the operating system finds the target firmware file through the driver, so as to facilitate subsequent device upgrade operations.
Specifically, the step of the operating system finding the target firmware file through the driver includes:
the operating system determines an installation file of the driver through the driver;
acquiring a target file path and a version number carried by an installation file of the driver;
and finding the target firmware file based on the target file path and the version number.
In this embodiment, the target file path and version number are read from the registry of the installation file of the driver and saved, so that the target firmware file is found based on the target file path and version number.
S3: and the operating system of the user computer creates a preparation example in the equipment manager through the driver, binds a callback function of firmware upgrading, starts the callback function of firmware upgrading to detect whether the current computer meets the upgrading condition, and sends the target firmware file and the upgrading instruction to the target equipment when the current computer meets the upgrading condition.
In this embodiment, the callback function of the firmware upgrade detects a series of conditions that are consistent with performing the upgrade. After the target device is determined, a device instance corresponding to the target device is created, and the name of the target device is stored.
Specifically, in step S3, that is, the callback function that starts the firmware upgrade detects whether the current computer meets the upgrade condition, and when the current computer meets the upgrade condition, the step of sending the target firmware file and the upgrade instruction to the target device includes:
starting a callback function of the firmware upgrading, and detecting whether the current operating system is performing updating operation or not through the callback function;
when the current operating system is performing updating operation, starting a pre-established timer, and periodically detecting whether the current operating system is performing updating operation based on a preset time interval;
and when the current operating system does not carry out updating operation, transmitting the target firmware file to the target equipment, and sending an upgrading instruction to the target equipment.
In this embodiment, the preset time interval in the present application is 4 hours, that is, whether the current operating system is performing the update operation is detected by the callback function every 4 hours according to the timer. A callback function is a function called by a function pointer. Detecting whether an update of the windows operating system is in progress, and if an ongoing update is generally not suitable for an upgrade, the condition detection may be postponed for one of the time intervals until the next, i.e. 4 hours later. And if the current windows operating system does not perform updating operation, opening a device communication pipeline to read and write the device, namely transmitting the target firmware file to the target device and sending an upgrading instruction.
In addition, in step S3, that is, the callback function for starting the firmware upgrade detects whether the current computer meets an upgrade condition, and when the current computer meets the upgrade condition, the step of sending the target firmware file and the upgrade instruction to the target device includes:
starting a callback function of the firmware upgrade, detecting whether a current operating system is performing update operation or not through the callback function, and opening a handle of the target equipment to check the state of the target equipment;
when the current operating system is performing updating operation or the state of the target equipment is busy, starting a pre-established timer, regularly detecting whether the current operating system is performing updating operation or not based on a preset time interval, and detecting the state of the target equipment;
when the current operating system does not perform updating operation and the state of the target equipment is idle, comparing whether the firmware version in the target equipment is consistent with the version of the target firmware file in the driving program or not;
and when the firmware version in the target equipment is inconsistent with the version of the target firmware file in the driver, sending the target firmware file and an upgrading instruction to the target equipment.
In the present embodiment, the predetermined time interval is 4 hours. And when the current operating system is performing updating operation or the state of the target equipment is busy, closing the handle of the target equipment, postponing until the next callback function operation, and detecting again. And when the firmware version in the target equipment is consistent with the version of the target firmware file in the driver, judging that upgrading is not needed, closing the equipment handle, pushing out the current callback function, and after 4 hours, running the callback function again, namely returning to the step of detecting whether the current operating system is performing updating operation or not at regular time based on a preset time interval and detecting the state of the target equipment.
It should be noted that, in the present application, since the new version of the firmware file is uploaded aperiodically, after this detection is completed, the new version of the firmware file is still uploaded subsequently, and the firmware of the device still needs to be upgraded, even if it is detected that the current operating system is not updated, the timer is still in a starting state, and whether the operating system is updating is detected periodically (once every 4 hours is detected) based on a time interval.
In step S3, the step of sending the target firmware file and the upgrade instruction to the target device includes:
acquiring the name of target equipment, and storing the name of the target equipment in the context of the equipment instance;
opening a file handle using createfile (a multi-function);
calling a winussb API to acquire the configuration, interface and endpoint information of the target equipment, and storing the configuration, interface and endpoint information of the target equipment in the context of an equipment instance;
and sending the target firmware file and an upgrading instruction to the target equipment according to the name of the target equipment, the configuration of the target equipment, the interface and the endpoint information.
In this embodiment, a communication process between the windows driver and the target device in this application includes: after the driver creates the device instance, the name of the target device is stored in the context of the device instance, the createfile is used for opening a file handle, the winuss API is called to obtain the configuration, the interface and the endpoint information of the target device, and the configuration, the interface and the endpoint information are stored in the context of the device instance for subsequent communication with the target device. The driver sends first data or instructions to the target equipment; after receiving the first data or the instruction, the target equipment returns second data; and the driver receives second data returned by the target equipment and processes the second data according to the sent instruction. Createfile is a multi-functional function that opens or creates a file or I/O device and returns an accessible handle. The winusb API is a preconfigured API interface. The first data may be a target firmware file, and the instruction is an upgrade instruction (ID _ UPDT instruction). The second data is an upgrade result returned by the target device (the returned ID _ OKAY indicates success, and the ID _ FAIL indicates failure), and the target device may be a USB embedded device compatible with the windows operating system.
S4: and the target equipment receives the target firmware file and the upgrading instruction sent by the user computer and executes equipment firmware upgrading operation.
In the embodiment, when the target device receives the target firmware file and the upgrade instruction sent by the user computer through the driver, the device firmware upgrade operation is performed.
Specifically, the target device includes a plurality of system partitions and data partitions, the target device receives the target firmware file and the upgrade instruction sent by the user computer, and the step of executing the device firmware upgrade operation includes:
the target equipment receives a target firmware file sent by a user computer, and stores the target firmware file in the data partition;
detecting a system partition initially operated by the target equipment as an initial partition;
decompressing the target firmware file to a system partition except the initial partition to obtain target firmware, and taking the system partition where the target firmware is located as a target partition;
and operating the target partition, determining the state of the operated target partition, and determining a system partition which is continuously operated according to the state of the target partition.
In this embodiment, the target firmware file is decompressed to a system partition other than the initial partition, so as to avoid interference with the original old firmware, and facilitate subsequent operation on the target partition.
Wherein the system partition comprises a first system partition and a second system partition, the target firmware file is decompressed to the system partition except the initial partition, and the step of obtaining the target firmware file comprises:
when the system partition initially operated by the target equipment is the first system partition, taking the first system partition as the initial partition, and decompressing the target firmware file into the second system partition to obtain target firmware;
when the system partition initially operated by the target equipment is the second system partition, taking the second system partition as the initial partition, and decompressing the target firmware file into the first system partition to obtain target firmware;
the step of operating the target partition, determining the state of the target partition after operation, and determining the system partition which continues to operate according to the state of the target partition comprises the following steps:
the target equipment modifies the variable corresponding to the starting operation so as to point the next running to the target partition where the target firmware is located;
when a restart instruction is received, the target device runs the target partition;
the target device determines whether the running target partition can be started normally;
when the target partition can be started normally, determining that the target equipment is upgraded successfully, and operating the target partition;
and when the target partition is not normally started, the target equipment performs equipment restarting operation and points to the system partition initially operated by the target equipment.
In this embodiment, the target device may create four partitions in advance, where the four partitions include a boot partition, a first system partition (a system partition), a second system partition (B system partition), and a data partition. The starting partition is a partition which is set for starting, the starting partition comprises files supporting starting, and when a restarting instruction is received, the files in the starting partition are used for supporting the starting operation of the multi-target partition. The target equipment initially runs in the system partition A or the system partition B, and the target firmware file is decompressed to the system partition B or the system partition A; the modified variable includes a bootFromAorB variable that starts from a when set = a. And when the target partition is not normally started, determining that the upgrading fails, and carrying out equipment restarting operation on the target equipment to point to the system partition initially operated by the target equipment.
The communication protocol between the driver and the target device is as follows. The communication instruction defines: # define MKID (a, b, c, d) ((a) | ((b) < < 8) | ((c) < < 16) | ((d) < < 24)); the # define ID _ VERN MKID ('V', 'E', 'R', 'N') -instruction represents a query for the current device firmware version; # define ID _ FIRM MKID ('F', 'I', 'R', 'M') - - - -represents a preparation to transfer a firmware file to a device; # define ID _ UPDT MKID ('U', 'P', 'D', 'T') - - - -indicates that the requesting device begins performing a firmware upgrade; # define ID _ DONE MKID ('D', 'O', 'N', 'E') -indicates that the device returns that an operation has been completed; # define ID _ DATA MKID ('D', 'a', 'T', 'a') -indicates that a packet is transmitted, and a large file is divided into small packets to be transmitted; # define ID _ OKAY MKID ('O', 'K', 'A', 'Y') -indicates that the apparatus is in a ready state and the next operation can be continued; # define ID _ FAIL MKID ('F', 'A', 'I', 'L') -indicates a device return operation failure; # define ID _ STAT MKID ('S', 'T', 'A', 'T') -indicates whether the querying device is idle; # define ID _ RBOT MKID ('R', 'B', 'O', 'T') -represents a request for a device reboot. Inquiring the firmware version of the equipment: and sending the ID _ VERN to the equipment, and returning the current equipment version number by the equipment. Querying the device for an idle state: the device will return ID _ OKAY indicating idle and ID _ FAIL indicating that the device is currently busy. Sending a firmware file to the device: the file sending method comprises the following steps: (1) Sending an ID _ FIRM instruction to the equipment, sending the size of the firmware file and the path information together, returning an ID _ OKAY by the equipment to indicate that the information is successfully received, and returning an ID _ FAIL to indicate that the information is failed to be received; (2) If ID _ OKAY is returned in the step (1), an ID _ DATA command is sent to indicate that the firmware file is sent by starting packetization, the equipment feeds back a state when receiving each packetization, if ID _ OKAY is fed back, the next packetization is continuously sent, and the feedback ID _ FAIL indicates that the receiving of the packetization FAILs, and then the packetization is sent again; (3) If the whole firmware file is sent to the equipment, the ID _ DONE is sent to the equipment, and after the equipment receives the instruction, the file is verified, the ID _ OKAY is returned to indicate that the file is received correctly, and the ID _ FAIL is returned to indicate that the file is received incorrectly. Sending an upgrade instruction to the device: and sending an ID _ UPDT instruction, carrying out firmware upgrade after the equipment receives the instruction, returning ID _ OKAY to indicate success, and indicating failure by ID _ FAIL.
Those skilled in the art will appreciate that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to computer readable instructions, which can be stored in a computer readable storage medium, and when executed, the computer readable instructions can include the processes of the embodiments of the methods described above. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless otherwise indicated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
With further reference to fig. 3, as an implementation of the method shown in fig. 2, the present application provides an embodiment of an apparatus for updating device firmware of a user, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be applied to various electronic devices in particular.
As shown in fig. 3, the apparatus 300 for updating the device firmware of the user according to the embodiment includes: a user computer and a target device.
The user computer comprises a detection module 101, a lookup module 102 and a creation module 103. The detection module 101 is configured to perform a device detection operation, and when an operating system detects any associated device, take the detected any associated device as a target device, and download and install a driver from an update server; the searching module 102 is configured to search for a target firmware file through the driver; the creating module 103 is configured to create a device instance in the device manager through the driver, create a timer and bind a callback function of firmware upgrade, start the callback function of firmware upgrade to detect whether the current computer meets an upgrade condition, and send a firmware file and an upgrade instruction to the target device when the current computer meets the upgrade condition.
And the target equipment is used for receiving the firmware file and the upgrading instruction sent by the driving program and executing equipment firmware upgrading operation.
In this embodiment, the method and the device simplify the hardware and software implementation of the user computer and the equipment, save manpower and material resources, enable the equipment to be more concentrated on the core function of the equipment, and are favorable for improving the product quality and the reliability. When the associated equipment is detected, the associated equipment is taken as target equipment, a driving program is loaded for the associated equipment, the target firmware file can be quickly found through the driving program, the environment is detected through a callback function, and when the environment meets the upgrading condition, the target firmware file is transmitted to the target equipment, so that the quick upgrading of the firmware of the target equipment is realized. By the method and the device, additional configuration upgrading software is not required to be installed in the target equipment, and only the target equipment firmware transmitted by the driving program needs to be received, so that the software redundancy in the target equipment is reduced, and meanwhile, the rapid firmware upgrading is realized.
The lookup module 102 includes a determination sub-module, an acquisition sub-module, and a lookup sub-module. The determining submodule is used for determining an installation file of the driver through the driver; the obtaining submodule is used for obtaining a target file path and a version number carried by an installation file of the driver; and the searching sub-module is used for searching the target firmware file based on the target file path and the version number.
The creation module 103 includes an activation sub-module, a detection sub-module, and a transmission sub-module. The starting submodule is used for starting a callback function of the firmware upgrading, and detecting whether the current operating system is performing updating operation or not through the callback function; the detection submodule is used for starting a pre-established timer when the current operating system is performing the updating operation, and regularly detecting whether the current operating system is performing the updating operation or not based on a preset time interval; and the transmission submodule is used for transmitting the target firmware file to the target equipment and sending an upgrading instruction to the target equipment when the current operating system is not subjected to updating operation.
The creation module 103 further includes an open sub-module, a status detection sub-module, a comparison sub-module, and a send sub-module. The opening sub-module is used for starting a callback function of the firmware upgrading, detecting whether the current operating system is performing updating operation through the callback function, and opening a handle of the target equipment to check the state of the target equipment; the state detection submodule is used for regularly detecting whether the current operating system is performing updating operation or not and detecting the state of the target equipment based on a preset time interval according to a pre-established timer when the current operating system is performing updating operation or the state of the target equipment is busy; the comparison submodule is used for comparing whether the firmware version in the target equipment is consistent with the version of the target firmware file in the driving program or not when the current operating system is not subjected to updating operation and the state of the target equipment is idle; the sending submodule is used for sending the target firmware file and the upgrading instruction to the target equipment when the firmware version in the target equipment is inconsistent with the version of the target firmware file in the driver.
The creating module 103 further includes a first saving sub-module, a handle sub-module, a second saving sub-module, and a send file sub-module. The first storage submodule is used for obtaining the name of the target device and storing the name of the target device in the context of the device instance; the handle submodule is used for opening a file handle by using createfile (a multifunctional function); the second storage sub-module is used for calling the winuss API to acquire the configuration, the interface and the endpoint information of the target equipment and storing the configuration, the interface and the endpoint information of the target equipment in the context of an equipment instance; and the file sending submodule is used for sending the target firmware file and the upgrading instruction to the target equipment according to the name of the target equipment, the configuration of the target equipment, the interface and the endpoint information.
The target equipment comprises a plurality of system partitions and data partitions, and comprises a receiving submodule, an initial submodule, a decompression submodule and an operation submodule, wherein the receiving submodule is used for receiving a target firmware file sent by a user computer and storing the target firmware file in the data partitions by the target equipment; the initial submodule is used for detecting a system partition initially operated by the target equipment and taking the system partition as an initial partition; the decompression submodule is used for decompressing the target firmware file into a system partition except the initial partition to obtain target firmware, and taking the system partition where the target firmware is located as a target partition; the operation sub-module is used for operating the target partition, determining the state of the target partition after operation, and determining a system partition which continues to operate according to the state of the target partition.
The system partition comprises a first system partition and a second system partition, the decompression submodule comprises a first decompression unit and a second decompression unit, and the first decompression unit is used for taking the first system partition as the initial partition and decompressing the target firmware file into the second system partition to obtain the target firmware when the system partition initially operated by the target device is the first system partition; the second decompressing unit is used for taking the second system partition as the initial partition when the system partition initially operated by the target device is the second system partition, decompressing the target firmware file to the first system partition, and obtaining the target firmware;
the operation sub-module comprises a modification unit, an operation unit, a determination upgrade completion unit and a restart unit, wherein the modification unit is used for modifying a variable corresponding to a start operation by the target equipment so as to point the next operation to the target partition where the target firmware is located; the running unit is used for running the target partition by the target equipment when a restart instruction is received; the determining unit is used for determining whether the running target partition can be started normally by the target equipment; the upgrading completion determining unit is used for determining that the target equipment is successfully upgraded when the target partition can be normally started, and operating the target partition; and the restarting unit is used for carrying out equipment restarting operation on the target equipment when the target partition fails to be started normally and pointing to the system partition initially operated by the target equipment.
The method and the device simplify the hardware and software implementation of the user computer and the equipment, save manpower and material resources, enable the equipment to be more concentrated in the core function of the equipment, and are favorable for improving the product quality and the reliability. When the associated equipment is detected, the associated equipment is taken as target equipment, a driving program is loaded for the associated equipment, the target firmware file can be quickly searched through the driving program, the environment is detected through a callback function, and when the environment meets the upgrading condition, the target firmware file is transmitted to the target equipment, so that the quick upgrading of the target equipment firmware is realized. By the method and the device, the target equipment does not need to be additionally configured and installed with the upgrading software, and only the target equipment firmware transmitted by the driving program needs to be received, so that the software redundancy in the target equipment is reduced, and the rapid firmware upgrading is realized.
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 4 in particular, fig. 4 is a block diagram of a basic structure of a computer device according to the embodiment.
The computer device 200 comprises a memory 201, a processor 202, a network interface 203 communicatively connected to each other via a system bus. It is noted that only computer device 200 having components 201-203 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user in a keyboard mode, a mouse mode, a remote controller mode, a touch panel mode or a voice control equipment mode.
The memory 201 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 201 may be an internal storage unit of the computer device 200, such as a hard disk or a memory of the computer device 200. In other embodiments, the memory 201 may also be an external storage device of the computer device 200, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 200. Of course, the memory 201 may also include both internal and external storage units of the computer device 200. In this embodiment, the memory 201 is generally used for storing an operating system installed in the computer device 200 and various application software, such as computer readable instructions of a method for updating device firmware of a user. Further, the memory 201 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 202 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 202 is generally operative to control overall operation of the computer device 200. In this embodiment, the processor 202 is configured to execute computer readable instructions stored in the memory 201 or process data, such as computer readable instructions for executing the method for updating the device firmware of the user.
The network interface 203 may comprise a wireless network interface or a wired network interface, wherein the wired network interface comprises a USB interface, and the network interface 203 is generally used for establishing a communication connection between the computer device 200 and other electronic devices.
In the embodiment, the target device does not need to be additionally configured and installed with the upgrading software, so that the redundancy of the software in the target device is reduced, and meanwhile, the rapid firmware upgrading is realized.
The present application provides yet another embodiment that provides a computer-readable storage medium having stored thereon computer-readable instructions executable by at least one processor to cause the at least one processor to perform the steps of the method of updating a user's device firmware as described above.
In the embodiment, the target device does not need to be additionally configured and installed with the upgrading software, so that the redundancy of the software in the target device is reduced, and meanwhile, the rapid firmware upgrading is realized.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It should be understood that the above-described embodiments are merely exemplary of some, and not all, embodiments of the present application, and that the drawings illustrate preferred embodiments of the present application without limiting the scope of the claims appended hereto. This application is capable of embodiments in many different forms and the embodiments are provided so that this disclosure will be thorough and complete. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that modifications can be made to the embodiments described in the foregoing detailed description, or equivalents can be substituted for some of the features described therein. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A method of updating a user's device firmware, comprising the steps of:
the method comprises the steps that an operating system of a user computer carries out equipment detection operation, when the operating system detects any associated equipment, the detected associated equipment is used as target equipment, and a driving program is downloaded and installed from an updating server;
the operating system of the user computer finds the target firmware file through the driving program;
and the operating system of the user computer creates a preparation example in the equipment manager through the driver, binds a callback function of firmware upgrading, starts the callback function of firmware upgrading to detect whether the current computer meets the upgrading condition, and sends the target firmware file and the upgrading instruction to the target equipment when the current computer meets the upgrading condition.
2. The method of claim 1, wherein the callback function for initiating the firmware upgrade detects whether the current computer meets upgrade conditions, and the step of sending the target firmware file and the upgrade instruction to the target device when the current computer meets the upgrade conditions comprises:
starting a callback function of the firmware upgrading, and detecting whether the current operating system is performing updating operation or not through the callback function;
when the current operating system is performing updating operation, starting a pre-established timer, and periodically detecting whether the current operating system is performing updating operation based on a preset time interval;
and when the current operating system does not carry out updating operation, transmitting the target firmware file to the target equipment, and sending an upgrading instruction to the target equipment.
3. The method of claim 1, wherein the callback function for initiating the firmware upgrade detects whether the current computer meets upgrade conditions, and the step of sending the target firmware file and the upgrade instruction to the target device when the current computer meets the upgrade conditions comprises:
starting a callback function of the firmware upgrading, detecting whether a current operating system is performing updating operation or not through the callback function, opening a handle of the target equipment, and checking the state of the target equipment;
when the current operating system is performing updating operation or the state of the target equipment is busy, starting a pre-established timer, regularly detecting whether the current operating system is performing updating operation or not based on a preset time interval, and detecting the state of the target equipment;
when the current operating system does not carry out updating operation and the state of the target equipment is idle, comparing whether the firmware version in the target equipment is consistent with the version of the target firmware file in the driving program or not;
and when the firmware version in the target equipment is inconsistent with the version of the target firmware file in the driver, sending the target firmware file and an upgrading instruction to the target equipment.
4. The method of claim 1, wherein the step of the operating system finding the target firmware file through the driver comprises:
the operating system determines an installation file of the driver through the driver;
acquiring a target file path and a version number carried by an installation file of the driver;
and finding the target firmware file based on the target file path and the version number.
5. The method of updating the firmware of the user's device according to claim 1, further comprising, after the step of sending the target firmware file and the upgrade instruction to the target device when the current computer meets the upgrade condition:
and the target equipment receives the target firmware file and the upgrading instruction sent by the user computer and executes equipment firmware upgrading operation.
6. The method of updating a user's device firmware of claim 5, wherein the target device comprises a plurality of system partitions and data partitions, the target device receives the target firmware files and upgrade instructions sent by the user computer, and the step of performing a device firmware upgrade operation comprises:
the target equipment receives a target firmware file sent by a user computer, and stores the target firmware file in the data partition;
detecting a system partition initially operated by the target equipment as an initial partition;
decompressing the target firmware file to a system partition except the initial partition to obtain target firmware, and taking the system partition where the target firmware is located as a target partition;
and operating the target partition, determining the state of the operated target partition, and determining a system partition which continues to operate according to the state of the target partition.
7. The method of updating device firmware of a user according to claim 6, wherein the system partition comprises a first system partition and a second system partition, the decompressing the target firmware file into the system partitions other than the initial partition, the obtaining the target firmware comprising:
when the system partition initially operated by the target equipment is the first system partition, taking the first system partition as the initial partition, and decompressing the target firmware file into the second system partition to obtain target firmware;
when the system partition initially operated by the target equipment is the second system partition, taking the second system partition as the initial partition, and decompressing the target firmware file into the first system partition to obtain target firmware;
the step of operating the target partition, determining the state of the target partition after operation, and determining the system partition which continues to operate according to the state of the target partition comprises the following steps:
the target equipment modifies the variable corresponding to the starting operation so as to point the next running to the target partition where the target firmware is located;
when a restart instruction is received, the target device runs the target partition;
the target device determines whether the running target partition can be started normally;
when the target partition can be started normally, determining that the target equipment is upgraded successfully, and operating the target partition;
and when the target partition is not normally started, the target equipment performs equipment restarting operation and points to the system partition initially operated by the target equipment.
8. An apparatus for updating a user's device firmware, the apparatus comprising a user computer, the user computer comprising:
the detection module is used for carrying out equipment detection operation, and when the operating system detects any associated equipment, the detection module takes the any associated equipment as target equipment and downloads and installs a driver from the update server;
the searching module is used for searching the target firmware file through the driving program;
the creating module is used for creating a device instance in the device manager through a driver, creating a timer, binding a callback function of firmware upgrading, starting the callback function of firmware upgrading to detect whether the current computer meets upgrading conditions, and sending a firmware file and an upgrading instruction to the target device when the current computer meets the upgrading conditions.
9. A computer device comprising a memory having computer readable instructions stored therein and a processor which when executed performs the steps of the method of updating a user's device firmware as claimed in any one of claims 1 to 7.
10. A computer readable storage medium having computer readable instructions stored thereon which, when executed by a processor, implement the steps of the method of updating a user's device firmware as claimed in any one of claims 1 to 7.
CN202110357075.5A 2021-04-01 2021-04-01 Method for updating device firmware of user and related device Pending CN115185553A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110357075.5A CN115185553A (en) 2021-04-01 2021-04-01 Method for updating device firmware of user and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110357075.5A CN115185553A (en) 2021-04-01 2021-04-01 Method for updating device firmware of user and related device

Publications (1)

Publication Number Publication Date
CN115185553A true CN115185553A (en) 2022-10-14

Family

ID=83512466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110357075.5A Pending CN115185553A (en) 2021-04-01 2021-04-01 Method for updating device firmware of user and related device

Country Status (1)

Country Link
CN (1) CN115185553A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116820596A (en) * 2023-04-23 2023-09-29 超聚变数字技术有限公司 FRU (field replaceable unit) management method, device and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116820596A (en) * 2023-04-23 2023-09-29 超聚变数字技术有限公司 FRU (field replaceable unit) management method, device and system

Similar Documents

Publication Publication Date Title
US20100132042A1 (en) Method for upgrading antivirus software and terminal and system thereof
CN101689116A (en) System and method for updating device drivers
CN106020875B (en) Firmware update management method and device of embedded terminal
CN108540509B (en) Processing method and device of terminal browser, server and intelligent terminal
CN115185553A (en) Method for updating device firmware of user and related device
CN108595195B (en) Application program updating method, device, terminal and storage medium
CN113094064A (en) Gateway software module upgrading method, device, equipment and storage medium
WO2024007800A1 (en) Cloud terminal system upgrade method and apparatus, and cloud terminal and storage medium
WO2023226670A1 (en) Esim firmware upgrade method and apparatus, and device and medium
CN106484442B (en) Server system and method for updating startup mapping file
CN110688136A (en) Application program updating method and device
CN110737444A (en) Remote self-adaptive dynamic deployment method and system for operating system based on firmware
CN116700751A (en) Upgrading method of server firmware and computing device
CN113821264B (en) Operating system installation control method, installation control system and computing device
CN113411225B (en) QGA service management method, device, equipment and medium based on cloud host
CN109933353B (en) Embedded Web-based controller firmware upgrading method
CN111240589A (en) Partition isolation-based system management method, device, equipment and storage medium
CN106445571B (en) Mainboard and starting method
CN116149757B (en) Plug-in virtual route realization method, device, computer equipment and storage medium
CN114675893B (en) Drive management method and device and computer equipment
CN115268971B (en) Updating method, device, equipment and storage medium of signal processing system
CN107066277B (en) Method for updating universal unique identification code based on serial port
CN107562466B (en) Method and equipment for installing computer operating system
CN111324384B (en) Device and method for selecting starting image file according to device message in pre-execution environment
CN115454812A (en) Test method, computing equipment and test system for tested unit

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination