The upgrade method and system of embedded device firmware based on ActiveXTechnical field
The present invention relates to embedded device firmware upgrade fields, more particularly to the embedded device firmware based on ActiveXUpgrade 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 toEmbedded 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 deviceIt needs constantly to upgrade its firmware.Conventional upgrade method is that embedded device manufacturer is specific to each user one in the prior artUpgrading software and a firmware upgrade packet, utilize upgrading software carry out firmware upgrade operation.It is often carried in embedded deviceThere is a series of product type, the required firmware upgrade packet of upgrading differs the embedded device of each product type every time, leadsFirmware upgrade version information is caused to be difficult to determine.In the case where embedded device is sold to end user, for huge userGroup, when having firmware updating update every time, embedded device manufacturer need to notify each end user to carry out firmware upgrade, and send literGrade 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, embeddedFormula equipment leaves the computer for having installed upgrading software, just can not carry out firmware upgrade operation, make the firmware liter of embedded deviceGrade is restricted.To sum up, there are firmware upgrade operation complexity and firmware upgrades for the firmware upgrade technology of current routine techniquesThe 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 internetTechnology is come into being.ActiveX control is also referred to as OLE controls or OCX controls, is some softwares for Internet application and developmentsComponent or object can be plugged into Web page or other applications.A kind of mechanism of ActiveX control technology offer makes controlCan be embedded into Web page, and event is responded, using ActiveX control technology make the hardware interface of computer withInternet 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 complicatedThe problem of, provide that a kind of firmware upgrade operation is simple and firmware upgrade version management easily embedded based on ActiveX setsThe 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 computerPart, if the trigger signal of triggering ActiveX control to be received such as then;If otherwise installation ActiveX for identification is downloaded in promptThe code signature certificate of control source and developer's information prompts peace after recognizing the code signature certificate and installing successfullyThe 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 controlThe information list for the external equipment for being connected to computer is obtained, then insertion is found from described information list by inquiry operationFormula 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 informationCommunication 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 andSecond edition information;The facility information for the embedded device that the selection information received and ActiveX control are found carries outComparison 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 receivedThe 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, ifThen the firmware upgrade packet is decrypted, executed after decryption processing and stores the firmware upgrade packet;If otherwise directlyIt 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 computerEmbedded 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 receivedThe 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 triggeringFurther 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 promptThe code signature certificate of source and developer's information prompts installation after recognizing the code signature certificate and installing successfullyActiveX 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 embeddedEquipment enters the step of upgrade mode with ActiveX control information exchange and includes:Computer receives being used for for user's triggeringThe trigger signal for controlling ActiveX control operation obtains the information for the external equipment for being connected to computer by ActiveX controlList, then embedded device is found from described information list by inquiry operation, read the equipment letter of the embedded deviceBreath, 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 setThe 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 packetIt includes:ActiveX control receives selection information from the user, and the selection information includes second type information and the second editionThis information;The facility information for the embedded device that the selection information received and ActiveX control are found is subjected to comparisonMatch;If the first type information is consistent with the second type information and second edition information is more than first version information, meter is controlledCalculation 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 embeddingEnter formula equipment and receive to detect whether automatically after the firmware upgrade packet as encrypted firmware upgrade package, if then to the firmware literGrade packet is decrypted, and is executed after decryption processing and stores the firmware upgrade packet;If otherwise directly executing and storing describedFirmware 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 embeddedStandby mating ActiveX control, if the trigger signal of triggering ActiveX control to be received such as then;If otherwise peace is downloaded in promptThe code signature certificate of ActiveX control source and developer's information for identification is filled, the code signature certificate is being recognizedThe triggering run for controlling ActiveX control for after installing successfully, prompting installation ActiveX control, and user being waited for triggerSignal;
Trigger upgrade unit:For making computer receive the triggering for controlling ActiveX control operation of user's triggeringSignal obtains the information list for the external equipment for being connected to computer by ActiveX control, then by inquiry operation from describedEmbedded device is found in information list, reads the facility information of the embedded device, and the facility information includes the first typeNumber information and first version information;And the routing information of the embedded device is recorded, described in routing information foundationCommunication port between ActiveX control and the embedded device makes embedded device enter and is handed over ActiveX control informationMutual upgrade mode;
Compare processing unit:For making ActiveX control receive selection information from the user, the selection informationIncluding the second type information and second edition information;The selection information received is found with ActiveX control embeddedThe 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 thanWhen first version information, then control computer is to web server requests firmware upgrade packet;Otherwise prompt mismatches information, repeatsOperation;
Firmware transmission unit:For making ActiveX control control computer to web server requests firmware upgrade packet, andThe 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 encryptionFirmware upgrade packet executes after decryption processing if then the firmware upgrade packet is decrypted and stores the firmware literGrade 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, describedUpgrading 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 setsThe upgrade method and system of standby firmware, may be implemented quickly and easily to update embedded device, and spy is provided to client without manufacturerEmbedded device need to be only connected on computer by fixed upgrading software, and by ActiveX control to web server requestsIt 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 detailThe 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 webpageBrowser simultaneously accesses the upgrading page.It is mating whether computer auto-detection is equipped with the embedded device being connect with computerActiveX control, if being equipped with ActiveX control, etc. user to be received triggering for controlling ActiveX control fortuneCapable trigger signal;If being fitted without ActiveX control, prompt download installation for identification ActiveX control source andThe code signature certificate of developer's information, the code signature certificate is to ensure that ActiveX control is not maliciously tampered, if meterWhen calculation machine does not recognize the code signature certificate of AcitveX controls, it will be considered that ActiveX control is blocked for illegal programIt cuts, therefore code signature certificate is first installed before ActiveX control is installed.Computer is recognizing the installation of code signature certificateThe triggering for controlling ActiveX control operation for after success, prompting user installation ActiveX control, and user being waited for triggerSignal.
Computer receives the trigger signal for controlling ActiveX control operation of user's triggering, passes through ActiveX controlObtain 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 toThe information list of the external equipment of computer;Search to be upgraded embedded set from above- mentioned information list by inquiry operation againIt is standby, and the facility information of the embedded device is read, which includes the first type information and first version information, and is rememberedThe routing information for recording the embedded device is established ActiveX control using the routing information of the embedded device and is set with embeddedCommunication 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 linesStandby identifier, the external equipment for being connected to computer are that USB interface or RS232 interface correspond to different equipment identification respectivelyNumber, Windows systems can be differentiated by device identification number distinguishes different types of external equipment, such as RS232 interfaceDevice 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 tuneWith WindowsAPI (application programming interfaces) functions HidD_GetHidGuid()To obtain a device identification number above-mentioned;AgainThe device identification number got passes to api function SetupDiGetClassDevs()To enumerate all access computersThe information list of external equipment;API Function is passed through again for all external equipments enumeratedSetupDiEnumDeviceInterfaces()Obtain the brief information of external equipment, such as device address one by one;And handle obtainsThe brief information got passes through API Function SetupDiGetDeviceInterfaceDetail()It is outer to be subject to extension acquirementThe details for connecing equipment extract routing information and record to get the detailed path information of the external equipment in informationGet 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), productIdentification 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 intoIt looks for, all equipment enumerated has been inquired until all.The routing information recorded during searching embedded device, andUtilize api function CreateFile()Open embedded device, to read the facility information of the embedded device, the facility informationIncluding the first type information and first version information.Specifically, it is built using the routing information for the embedded device recordedIt is vertical to read handle and write handle, wherein to read handle for creating function reading ReadFiles()To carry out information exchange, handle is writeFor creating write-in function WriteFile()To carry out information exchange, to establish between ActiveX control and embedded deviceCommunication 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 userSelection information, which is compared, rear correct then using the reading handle and to be write handle and establishes between ActiveX control and embedded deviceCommunication port makes embedded device enter the upgrade mode with ActiveX control information exchange, specifically, ActiveX controlPass through call function WriteFile()The information 0x01,0xFF, 0xFF for so that embedded device is entered upgrade mode is written;It is embeddedFormula 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 theWhen 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 netNetwork server asks firmware upgrade packet.Specifically, if user in a computer input selection information be Scanner_MS3.1 orScanner_2.1 i.e. its second type information is Scanner_MS, and second edition information is 3.1 or 2.1, by its with inquireFirst 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, thenPrompt user re-enters selection information, executes comparison matching operation again.If the selection information that user inputs in a computerFor Scanner_MS4.1, i.e. its its second type information is Scanner_MS, and second edition information is 4.1, after matching by contrastActiveX control control computer is to web server requests firmware upgrade packet.If user's input selection information in a computerFor Scanner_XP3.1, i.e. its second type information is Scanner_XP, and second edition information is 3.1, since the second model is believedBreath is inconsistent with the first type information, and computer to web server requests firmware upgrade packet, is not reresented user and re-enteredInformation 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 receivedThe firmware upgrade packet of server is transmitted to embedded device.Specifically, ActiveX control API FunctionURLDownloadToFile()From network server download firmware upgrade packet, the firmware upgrade packet be user in a computerThe matched selection information of facility information of input and embedded device, such as the Scanner_MS4.1 in the present embodiment.It will receive againTo the firmware upgrade packet from network server be transmitted to the embedded device being connected with computer, by firmware upgrade packet turnEmbedded device is issued before by API Function fopen()Firmware file is opened, api function fread is recalled()It obtainsThe 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 is204800B(0x32000B), then the attribute information of firmware file be:Character string " DAT ", 16 mechanism datas:0x32000B, meterCalculation 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 againCross 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 withFirmware upgrade packet is received, embedded device detects whether the firmware upgrade packet is encrypted firmware automatically after receiving firmware upgrade packetUpgrade package executes after decryption processing if then the firmware upgrade packet is decrypted and stores the firmware upgrade packet;If notIt 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 easilyEmbedded device is updated, specific upgrading software is provided to client without manufacturer, only embedded device need to be connected to computerOn, 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 netNetwork 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 matchedThe ActiveX control of set, the embedded device are connected to computer by USB line or RS232 lines.It has been equipped with if detectedActiveX control, the then trigger signal for controlling ActiveX control operation of user's triggering to be received such as;If do not pacifiedActiveX control is filled, then prompts to download the installation code signature of ActiveX control source and developer's information card for identificationBook, the code signature certificate is to ensure that ActiveX control is not maliciously tampered, if computer does not recognize AcitveXWhen the code signature certificate of control, it will be considered that ActiveX control is intercepted for illegal program, therefore in installation ActiveXCode signature certificate is first installed before control.Computer prompts user installation after recognizing code signature certificate and installing successfullyActiveX 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 triggeringSignal obtains the facility information for the external equipment for being connected to computer by ActiveX control, this is connected to the external of computerEquipment can be keyboard, mouse, sound equipment and the embedded device for being built-in with embedded software, and ActiveX control obtains connectionEmbedded 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 recordsThe routing information of the embedded device establishes the ActiveX control and the embedded device using the routing informationBetween 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 includeSecond type information and second edition information;The embedded device that the selection information received and ActiveX control are foundFacility information carry out comparison matching;If the first type information is consistent with the second type information and second edition information is more than firstWhen version information, then control computer is to web server requests firmware upgrade packet;Otherwise prompt mismatches information, repeats to graspMake;
Firmware transmission unit:For making ActiveX control control computer to web server requests firmware upgrade packet, andThe 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 encryptionFirmware upgrade packet executes after decryption processing if then firmware upgrade packet is decrypted and stores firmware upgrade packet;If notIt then directly executes and stores firmware upgrade packet.The firmware upgrade unit includes upgrading load-on module, memory module and decryption processingModule, 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 fromIn 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 toolBody 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 disclosedSpecific embodiment, and should include whole embodiments for falling within the scope of the appended claims.