The upgrade method and system of embedded device firmware based on ActiveX
Technical field
The present invention relates to embedded device firmware upgrade fields, more particularly to the embedded device firmware based on ActiveX
Upgrade method and system.
Background technology
With the development of electronic information technology, embedded device has been widely used the every field of daily life.Due to
Embedded device firmware itself is in the presence of the more and more diversified functional requirement of the defect and user for needing to repair, embedded device
It needs constantly to upgrade its firmware.Conventional upgrade method is that embedded device manufacturer is specific to each user one in the prior art
Upgrading software and a firmware upgrade packet, utilize upgrading software carry out firmware upgrade operation.It is often carried in embedded device
There is a series of product type, the required firmware upgrade packet of upgrading differs the embedded device of each product type every time, leads
Firmware upgrade version information is caused to be difficult to determine.In the case where embedded device is sold to end user, for huge user
Group, when having firmware updating update every time, embedded device manufacturer need to notify each end user to carry out firmware upgrade, and send liter
Grade software and firmware upgrade packet, cause manufacturer to be difficult to safeguard the firmware upgrade of the embedded device of numerous clients.If in addition, embedded
Formula equipment leaves the computer for having installed upgrading software, just can not carry out firmware upgrade operation, make the firmware liter of embedded device
Grade is restricted.To sum up, there are firmware upgrade operation complexity and firmware upgrades for the firmware upgrade technology of current routine techniques
The problem of version management complexity.
With Internet technologies development with it is universal, the chance that people access the resource on Internet is more and more,
And web application exploitation is put forward higher requirements, related resource, ActiveX control are especially shared on internet
Technology is come into being.ActiveX control is also referred to as OLE controls or OCX controls, is some softwares for Internet application and developments
Component or object can be plugged into Web page or other applications.A kind of mechanism of ActiveX control technology offer makes control
Can be embedded into Web page, and event is responded, using ActiveX control technology make the hardware interface of computer with
Internet interfaces are combined into one, and eliminate difference of the various resources between local resource and Internet resources.
Invention content
The technical problem to be solved in the present invention is that and firmware upgrade version management complicated for firmware upgrade operation is complicated
The problem of, provide that a kind of firmware upgrade operation is simple and firmware upgrade version management easily embedded based on ActiveX sets
The upgrade method and system of standby firmware.
The technical solution adopted by the present invention to solve the technical problems is:
The present invention provides the upgrade method of the embedded device firmware based on ActiveX, includes the following steps:
Whether computer auto-detection is equipped with the mating ActiveX controls of the embedded device being connect with the computer
Part, if the trigger signal of triggering ActiveX control to be received such as then;If otherwise installation ActiveX for identification is downloaded in prompt
The code signature certificate of control source and developer's information prompts peace after recognizing the code signature certificate and installing successfully
The trigger signal for controlling ActiveX control operation for filling ActiveX control, and user being waited for trigger;
Computer receives the trigger signal for controlling ActiveX control operation of user's triggering, passes through ActiveX control
The information list for the external equipment for being connected to computer is obtained, then insertion is found from described information list by inquiry operation
Formula equipment, reads the facility information of the embedded device, and the facility information includes the first type information and first version information;
And the routing information of the embedded device is recorded, establish the ActiveX control and the insertion using the routing information
Communication port between formula equipment makes embedded device enter the upgrade mode with ActiveX control information exchange;
ActiveX control receives selection information from the user, the selection information include second type information and
Second edition information;The facility information for the embedded device that the selection information received and ActiveX control are found carries out
Comparison matching;If the first type information is consistent with the second type information and second edition information is more than first version information,
Control computer is to web server requests firmware upgrade packet;
ActiveX control control computer carrys out automatic network to web server requests firmware upgrade packet, and by what is received
The firmware upgrade packet of server is transmitted to the embedded device;
The embedded device, which receives, to be detected whether after the firmware upgrade packet automatically as encrypted firmware upgrade package, if
Then the firmware upgrade packet is decrypted, executed after decryption processing and stores the firmware upgrade packet;If otherwise directly
It executes and stores the firmware upgrade packet.
The present invention also provides the upgrade methods of the embedded device firmware based on ActiveX, include the following steps:
Computer receives the trigger signal for controlling ActiveX control operation of user's triggering, makes to be connected with computer
Embedded device enter upgrade mode with ActiveX control information exchange;
ActiveX control control computer carrys out automatic network to web server requests firmware upgrade packet, and by what is received
The firmware upgrade packet of server is transmitted to the embedded device;
Embedded device receives, executes and store the firmware upgrade packet.
Preferably, before the trigger signal for controlling ActiveX control operation of computer reception user's triggering
Further include:Whether computer auto-detection is equipped with the mating ActiveX control of the embedded device being connect with the computer,
If the trigger signal of triggering ActiveX control to be received such as then;If otherwise installation ActiveX control for identification is downloaded in prompt
The code signature certificate of source and developer's information prompts installation after recognizing the code signature certificate and installing successfully
ActiveX control, and the trigger signal for controlling ActiveX control operation for waiting for user to trigger.
Preferably, the computer receives the trigger signal of triggering Active controls, makes to be connected with computer embedded
Equipment enters the step of upgrade mode with ActiveX control information exchange and includes:Computer receives being used for for user's triggering
The trigger signal for controlling ActiveX control operation obtains the information for the external equipment for being connected to computer by ActiveX control
List, then embedded device is found from described information list by inquiry operation, read the equipment letter of the embedded device
Breath, the facility information include the first type information and first version information;And the routing information of the embedded device is recorded,
The communication port between the ActiveX control and the embedded device is established using the routing information, makes embedded set
The standby upgrade mode entered with ActiveX control information exchange.
Preferably, in the ActiveX control control computer to also wrapping before web server requests firmware upgrade packet
It includes:ActiveX control receives selection information from the user, and the selection information includes second type information and the second edition
This information;The facility information for the embedded device that the selection information received and ActiveX control are found is subjected to comparison
Match;If the first type information is consistent with the second type information and second edition information is more than first version information, meter is controlled
Calculation machine is to web server requests firmware upgrade packet.
Preferably, the embedded device receives, executes and include the step of storing the firmware upgrade packet:It is described embedding
Enter formula equipment and receive to detect whether automatically after the firmware upgrade packet as encrypted firmware upgrade package, if then to the firmware liter
Grade packet is decrypted, and is executed after decryption processing and stores the firmware upgrade packet;If otherwise directly executing and storing described
Firmware upgrade packet.
The present invention also provides the upgrade-systems of the embedded device firmware based on ActiveX, including:
Detect trigger element:It is set for making computer auto-detection whether be equipped with connect with the computer embedded
Standby mating ActiveX control, if the trigger signal of triggering ActiveX control to be received such as then;If otherwise peace is downloaded in prompt
The code signature certificate of ActiveX control source and developer's information for identification is filled, the code signature certificate is being recognized
The triggering run for controlling ActiveX control for after installing successfully, prompting installation ActiveX control, and user being waited for trigger
Signal;
Trigger upgrade unit:For making computer receive the triggering for controlling ActiveX control operation of user's triggering
Signal obtains the information list for the external equipment for being connected to computer by ActiveX control, then by inquiry operation from described
Embedded device is found in information list, reads the facility information of the embedded device, and the facility information includes the first type
Number information and first version information;And the routing information of the embedded device is recorded, described in routing information foundation
Communication port between ActiveX control and the embedded device makes embedded device enter and is handed over ActiveX control information
Mutual upgrade mode;
Compare processing unit:For making ActiveX control receive selection information from the user, the selection information
Including the second type information and second edition information;The selection information received is found with ActiveX control embedded
The facility information of equipment carries out comparison matching;If the first type information is consistent with the second type information and second edition information is more than
When first version information, then control computer is to web server requests firmware upgrade packet;Otherwise prompt mismatches information, repeats
Operation;
Firmware transmission unit:For making ActiveX control control computer to web server requests firmware upgrade packet, and
The firmware upgrade packet from network server received is transmitted to the embedded device;
Firmware upgrade unit:For being detected whether automatically after so that embedded device is received the firmware upgrade packet as encryption
Firmware upgrade packet executes after decryption processing if then the firmware upgrade packet is decrypted and stores the firmware liter
Grade packet;If otherwise directly executing and storing the firmware upgrade packet.
Preferably, the embedded device is connected to the computer by USB line or RS232 lines.
Preferably, the firmware upgrade unit includes upgrading load-on module, memory module and decryption processing module, described
Upgrading load-on module is connected with the memory module and decryption processing module communication respectively.
The present invention has the following advantages that compared with prior art:Embedded based on ActiveX provided by the present invention sets
The upgrade method and system of standby firmware, may be implemented quickly and easily to update embedded device, and spy is provided to client without manufacturer
Embedded device need to be only connected on computer by fixed upgrading software, and by ActiveX control to web server requests
It downloads firmware upgrade packet and executes.
Description of the drawings
Present invention will be further explained below with reference to the attached drawings and examples, in attached drawing:
Fig. 1 is the flow chart of the upgrade method of the embedded device firmware the present invention is based on ActiveX.
Fig. 2 is the structural schematic diagram of the upgrade-system of the embedded device firmware the present invention is based on ActiveX.
Specific implementation mode
For a clearer understanding of the technical characteristics, objects and effects of the present invention, now control attached drawing is described in detail
The specific implementation mode of the present invention.
A kind of upgrade method of the embedded device firmware based on ActiveX, includes the following steps:
After computer unlatching, embedded device is connected on computer by USB line or RS232 lines, opens webpage
Browser simultaneously accesses the upgrading page.It is mating whether computer auto-detection is equipped with the embedded device being connect with computer
ActiveX control, if being equipped with ActiveX control, etc. user to be received triggering for controlling ActiveX control fortune
Capable trigger signal;If being fitted without ActiveX control, prompt download installation for identification ActiveX control source and
The code signature certificate of developer's information, the code signature certificate is to ensure that ActiveX control is not maliciously tampered, if meter
When calculation machine does not recognize the code signature certificate of AcitveX controls, it will be considered that ActiveX control is blocked for illegal program
It cuts, therefore code signature certificate is first installed before ActiveX control is installed.Computer is recognizing the installation of code signature certificate
The triggering for controlling ActiveX control operation for after success, prompting user installation ActiveX control, and user being waited for trigger
Signal.
Computer receives the trigger signal for controlling ActiveX control operation of user's triggering, passes through ActiveX control
Obtain be connected to computer external equipment facility information, the external equipment for being connected to computer can be keyboard, mouse,
Sound equipment and the embedded device for being built-in with embedded software, such as intercom mobile terminal.ActiveX control acquisition is connected to
The information list of the external equipment of computer;Search to be upgraded embedded set from above- mentioned information list by inquiry operation again
It is standby, and the facility information of the embedded device is read, which includes the first type information and first version information, and is remembered
The routing information for recording the embedded device is established ActiveX control using the routing information of the embedded device and is set with embedded
Communication port between standby makes embedded device enter the upgrade mode with ActiveX control information exchange.
Specifically, ActiveX control acquisition is connected to setting for the external equipment of computer by USB line or RS232 lines
Standby identifier, the external equipment for being connected to computer are that USB interface or RS232 interface correspond to different equipment identification respectively
Number, Windows systems can be differentiated by device identification number distinguishes different types of external equipment, such as RS232 interface
Device identification number is { 4d36e978-e325-11ce-bfc1-08002be10318 }, and the device identification number of USB device is
{ 745a17a0-74d3-11d0-b6fe-00a0c90f57da }, the external equipment in the present embodiment is USB device, then passes through tune
With WindowsAPI (application programming interfaces) functions HidD_GetHidGuid()To obtain a device identification number above-mentioned;Again
The device identification number got passes to api function SetupDiGetClassDevs()To enumerate all access computers
The information list of external equipment;API Function is passed through again for all external equipments enumerated
SetupDiEnumDeviceInterfaces()Obtain the brief information of external equipment, such as device address one by one;And handle obtains
The brief information got passes through API Function SetupDiGetDeviceInterfaceDetail()It is outer to be subject to extension acquirement
The details for connecing equipment extract routing information and record to get the detailed path information of the external equipment in information
Get off.Routing information is passed to api function CreateFile()Open embedded device;And pass through API Function HidD_
GetAttributes()The attribute information for obtaining the embedded device, according to the supplier ID in attribute information(VID), product
Identification code(PID)Whether inquiry is required embedded device to be upgraded;It is in this way then stop search equipment, such as otherwise continue to look into
It looks for, all equipment enumerated has been inquired until all.The routing information recorded during searching embedded device, and
Utilize api function CreateFile()Open embedded device, to read the facility information of the embedded device, the facility information
Including the first type information and first version information.Specifically, it is built using the routing information for the embedded device recorded
It is vertical to read handle and write handle, wherein to read handle for creating function reading ReadFiles()To carry out information exchange, handle is write
For creating write-in function WriteFile()To carry out information exchange, to establish between ActiveX control and embedded device
Communication port makes embedded device enter the upgrade mode with ActiveX control information exchange.Such as by calling ReadFiles
()Function reads the facility informations, such as Scanner_MS3.1 such as the first type information and the first version information of embedded device,
Wherein the first type information be Scanner_MS, first version information be 3.1, if the facility information read with it is input by user
Selection information, which is compared, rear correct then using the reading handle and to be write handle and establishes between ActiveX control and embedded device
Communication port makes embedded device enter the upgrade mode with ActiveX control information exchange, specifically, ActiveX control
Pass through call function WriteFile()The information 0x01,0xFF, 0xFF for so that embedded device is entered upgrade mode is written;It is embedded
Formula equipment calls function ReadFiles()Information 0x01,0xFF, 0xFF are read, embedded device is made to enter upgrade mode.
After the selection information of user's embedded device upgraded version that input selection is connected with computer on computers,
ActiveX control receives selection information from the user, and the selection information includes second type information and second edition information;
The facility information for the embedded device that the selection information received and ActiveX control are found is subjected to comparison matching;If the
When one type information is consistent with the second type information and second edition information is more than first version information, then control computer is to net
Network server asks firmware upgrade packet.Specifically, if user in a computer input selection information be Scanner_MS3.1 or
Scanner_2.1 i.e. its second type information is Scanner_MS, and second edition information is 3.1 or 2.1, by its with inquire
First type information of embedded device is Scanner_MS, and the facility information that first version information is 3.1 carries out comparison matching,
Since second edition information is not larger than first version information, therefore computer is to web server requests firmware upgrade packet, then
Prompt user re-enters selection information, executes comparison matching operation again.If the selection information that user inputs in a computer
For Scanner_MS4.1, i.e. its its second type information is Scanner_MS, and second edition information is 4.1, after matching by contrast
ActiveX control control computer is to web server requests firmware upgrade packet.If user's input selection information in a computer
For Scanner_XP3.1, i.e. its second type information is Scanner_XP, and second edition information is 3.1, since the second model is believed
Breath is inconsistent with the first type information, and computer to web server requests firmware upgrade packet, is not reresented user and re-entered
Information is selected, executes comparison matching operation again.
ActiveX control control computer carrys out automatic network to web server requests firmware upgrade packet, and by what is received
The firmware upgrade packet of server is transmitted to embedded device.Specifically, ActiveX control API Function
URLDownloadToFile()From network server download firmware upgrade packet, the firmware upgrade packet be user in a computer
The matched selection information of facility information of input and embedded device, such as the Scanner_MS4.1 in the present embodiment.It will receive again
To the firmware upgrade packet from network server be transmitted to the embedded device being connected with computer, by firmware upgrade packet turn
Embedded device is issued before by API Function fopen()Firmware file is opened, api function fread is recalled()It obtains
The attribute informations such as coded format, the firmware size of the firmware upgrade packet, such as the entitled Sys_App.DAT of firmware upgrade packet, size is
204800B(0x32000B), then the attribute information of firmware file be:Character string " DAT ", 16 mechanism datas:0x32000B, meter
Calculation machine reads the data packet that size is 32 bytes every time, the last one data packet gathers together enough 32 bytes less than the benefit 0 of 32 bytes.Lead to again
Cross write-in function WriteFile()The firmware upgrade packet is sent to embedded device.
After embedded device receives the attribute information of firmware upgrade packet, provide memory capacity corresponding with firmware size with
Firmware upgrade packet is received, embedded device detects whether the firmware upgrade packet is encrypted firmware automatically after receiving firmware upgrade packet
Upgrade package executes after decryption processing if then the firmware upgrade packet is decrypted and stores the firmware upgrade packet;If not
It then directly executes and stores the firmware upgrade packet.
The upgrade method of embedded device firmware provided by the present invention based on ActiveX may be implemented quickly and easily
Embedded device is updated, specific upgrading software is provided to client without manufacturer, only embedded device need to be connected to computer
On, and firmware upgrade packet is downloaded to web server requests by ActiveX control and is executed.
A kind of upgrade-system of the embedded device firmware based on ActiveX, mainly by embedded device, computer and net
Network server is constituted, and is specifically included:
Detect trigger element:The embedded device being connect with computer for making computer auto-detection whether be equipped with is matched
The ActiveX control of set, the embedded device are connected to computer by USB line or RS232 lines.It has been equipped with if detected
ActiveX control, the then trigger signal for controlling ActiveX control operation of user's triggering to be received such as;If do not pacified
ActiveX control is filled, then prompts to download the installation code signature of ActiveX control source and developer's information card for identification
Book, the code signature certificate is to ensure that ActiveX control is not maliciously tampered, if computer does not recognize AcitveX
When the code signature certificate of control, it will be considered that ActiveX control is intercepted for illegal program, therefore in installation ActiveX
Code signature certificate is first installed before control.Computer prompts user installation after recognizing code signature certificate and installing successfully
ActiveX control, and the trigger signal for controlling ActiveX control operation for waiting for user to trigger.
Trigger upgrade unit:For making computer receive the triggering for controlling ActiveX control operation of user's triggering
Signal obtains the facility information for the external equipment for being connected to computer by ActiveX control, this is connected to the external of computer
Equipment can be keyboard, mouse, sound equipment and the embedded device for being built-in with embedded software, and ActiveX control obtains connection
Embedded device is found from described information list to the information list of the external equipment of computer, then by inquiry operation,
The facility information of the embedded device is read, the facility information includes the first type information and first version information.And it records
The routing information of the embedded device establishes the ActiveX control and the embedded device using the routing information
Between communication port, so that embedded device is entered upgrade mode with ActiveX control information exchange.
Compare processing unit:For making ActiveX control receive selection information from the user, selection information include
Second type information and second edition information;The embedded device that the selection information received and ActiveX control are found
Facility information carry out comparison matching;If the first type information is consistent with the second type information and second edition information is more than first
When version information, then control computer is to web server requests firmware upgrade packet;Otherwise prompt mismatches information, repeats to grasp
Make;
Firmware transmission unit:For making ActiveX control control computer to web server requests firmware upgrade packet, and
The firmware upgrade packet from network server received is transmitted to embedded device;
Firmware upgrade unit:For being detected whether automatically after so that embedded device is received the firmware upgrade packet as encryption
Firmware upgrade packet executes after decryption processing if then firmware upgrade packet is decrypted and stores firmware upgrade packet;If not
It then directly executes and stores firmware upgrade packet.The firmware upgrade unit includes upgrading load-on module, memory module and decryption processing
Module, the upgrading load-on module are connected with memory module and decryption processing module communication respectively.
The present invention is illustrated by several specific embodiments, it will be appreciated by those skilled in the art that, it is not departing from
In the case of the scope of the invention, various transformation and equivalent substitute can also be carried out to the present invention.In addition, being directed to particular condition or tool
Body situation can do various modifications, without departing from the scope of the present invention to the present invention.Therefore, the present invention is not limited to disclosed
Specific embodiment, and should include whole embodiments for falling within the scope of the appended claims.