The device parameter reading/writing method of terminal and device
Technical field
The present invention relates to data communication field, particularly a kind of device parameter reading/writing method of terminal and device.
Background technology
Mobile communication terminal (such as mobile phone) all requires write International Mobile Equipment Identity code (IMEI before dispatching from the factory, InternationalMobileEquipmentIdentity), simultaneously in production management in order to quality management being reviewed conveniently, also can writing sequence number (SNR, SerialNumber).If terminal is with WiFi and Bluetooth function, also need write WiFi Media Access Control Address (WiFiMACAddress) and bluetooth media access control address (BluetoothMACAddress).How fast, conveniently, reliably realizing the function of the device parameters such as read-write IMEI when producing, is that one of problem that must pay close attention to produced by communication terminal.
General in communication terminal production run, in order to realize the read-write of the device parameters such as IMEI, communication terminal all will be allowed first to plug data line, and described data line is in the majority with sata standard interfaces such as RS232, then power to communication terminal, make it enter special pattern to realize read-write.The read-write operation of this classic method is comparatively loaded down with trivial details, because need slotting data line for each communication terminal, power supply, open communication terminal make it enter special pattern just to complete read-write operation, single job flow process approximately needs the time of 20 seconds, and production efficiency is lower.
Nowadays, computer general-purpose peripherals uses serial ports fewer and fewerily, but then quite general for the use of USB (universal serial bus) (USB, UniversalSerialBus) interface, and USB interface has the advantage supporting hot plug, low cost.If carried out the read-write operation of the device parameter of paired terminal by USB data line, after plugging USB data line, terminal needs to connect the similar serial equipment of computer virtual by USB data line could realize reading and writing data, but the equipment of this virtual similar serial ports is out unwanted to consumer, the terminal that consumer uses is plugged USB data line and can not be occurred their unwanted thing on computers, otherwise can think that terminal quality has problem.
Summary of the invention
The problem to be solved in the present invention is to provide a kind of device parameter reading/writing method and device of terminal, thus can simple, safe and reliable, realize reading and writing the device parameter of terminal efficiently.
For solving the problem, technical solution of the present invention provides a kind of device parameter reading/writing method of terminal, comprising:
Terminal is connected with read-write equipment;
Read the control mark in described terminal, described control mark is for representing that parameter reading and writing operation is in state of activation or masked state;
When identify described control mark be expressed as parameter reading and writing operation be in state of activation, described read-write equipment and described terminal produce protocol interaction, generating virtual port;
Described read-write equipment realizes the read-write to the device parameter of described terminal by described virtual port;
After completing the read-write to described device parameter, described control mark is expressed as parameter reading and writing operation and is in masked state.
Optionally, the device parameter reading/writing method of described terminal also comprises: when carrying out system update to described terminal, shields storing the described read-write operation controlling the storage area of mark.
Optionally, the described state controlled residing for the operation of mark initial representation parameter reading and writing is state of activation.
Optionally, the device parameter reading/writing method of described terminal also comprises: when recovering the initial setting up of described terminal, described control mark is expressed as parameter reading and writing operation and is in masked state.
Optionally, described device parameter is at least one in IMEI, sequence number, Bluetooth MAC address and WiFiMAC address.
Optionally, before terminal is connected with read-write equipment, described terminal is powered and makes it be in opening.
Optionally, described terminal is connected by USB data line with described read-write equipment.
Optionally, by described USB data line, described terminal is powered.
Optionally, described terminal is mobile communication terminal.
For solving the problem, technical solution of the present invention also provides a kind of device parameter read-write equipment of terminal, comprising:
Reading unit, is suitable for the control mark in reading terminals, and described control mark is for representing that parameter reading and writing operation is in state of activation or masked state;
Virtual port generation unit, be suitable for when identify described control mark be expressed as parameter reading and writing operation be in state of activation, make described terminal and read-write equipment produce protocol interaction, generating virtual port;
Setting unit, is suitable for after described read-write equipment completes the read-write to the device parameter of described terminal by described virtual port, described control mark is expressed as parameter reading and writing operation and is in masked state.
Compared with prior art, technical solution of the present invention has the following advantages:
By arranging for representing that parameter reading and writing operation is in the control mark of state of activation or masked state in the terminal, after terminal is connected with read-write equipment, if be in state of activation to the described recognition result controlling mark for representing that parameter reading and writing operates, then described terminal and read-write equipment produce protocol interaction, generating virtual port, and after described read-write equipment completes the read-write to the device parameter of described terminal by described virtual port, described control mark is expressed as parameter reading and writing operation and is in masked state to close the automatic generation for described virtual port, thus can be simple, safe and reliable, realize efficiently reading and writing the device parameter of terminal.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet of the device parameter reading/writing method of the terminal that embodiment of the present invention provides;
Fig. 2 is the structural representation of the device parameter read-write equipment of the terminal that the embodiment of the present invention provides.
Embodiment
For enabling above-mentioned purpose of the present invention, feature and advantage more become apparent, and are described in detail the specific embodiment of the present invention below in conjunction with accompanying drawing.Set forth detail in the following description so that fully understand the present invention.But the present invention can be different from alternate manner described here to implement with multiple, those skilled in the art can when without prejudice to doing similar popularization when intension of the present invention.Therefore the present invention is not by the restriction of following public embodiment.
Fig. 1 is the schematic flow sheet of the device parameter reading/writing method of the terminal that embodiment of the present invention provides.As shown in Figure 1, the device parameter reading/writing method of described terminal comprises:
Step S101, is connected terminal with read-write equipment;
Step S102, reads the control mark in described terminal, and described control mark is for representing that parameter reading and writing operation is in state of activation or masked state;
Step S103, when identify described control mark be expressed as parameter reading and writing operation be in state of activation, described read-write equipment and described terminal produce protocol interaction, generating virtual port;
Step S104, described read-write equipment realizes the read-write to the device parameter of described terminal by described virtual port;
Step S105, after completing the read-write to described device parameter, is expressed as parameter reading and writing operation and is in masked state by described control mark.
Elaborate with the device parameter reading/writing method of specific embodiment to above-mentioned terminal below.
In the present embodiment, described terminal is mobile communication terminal, such as mobile phone, mobile landline telephone etc.In other embodiments, described terminal also can be the terminal of non-communicating class, such as panel computer, multi-media player etc.Described device parameter can be at least one in IMEI, SNR, Bluetooth MAC address and WiFiMAC address.In other embodiments, described device parameter can also in terminal other for realizing the parameter of the hardware device of communication network, such as: the MAC Address of Network Card, WimaxMAC address, ZigBeeMAC address etc. of Ethernet.
In order to realize the read-write of the device parameter to terminal, first needing to perform step S101, terminal is connected with read-write equipment.In the present embodiment, described read-write equipment is the personal computer (PC, PersonalComputer) being provided with parameter reading and writing instrument, and in other embodiments, described read-write equipment also can for being provided with the single-chip microcomputer of parameter reading and writing instrument.It should be noted that, in the present embodiment, consider that USB data line has hot plug, the advantage of low cost, described terminal can be connected by USB data line with described read-write equipment.In other embodiments, also can be connected by the data line of other types between terminal with read-write equipment, even can also be connected by wireless, such as, both can being realized by Bluetooth technology radio interconnected.
It should be noted that, if terminal is connected with read-write equipment by data line, interface associated relation between the interface that then both can refer to the interface of data line and the interface of terminal and read-write equipment, also the associated relation of the data transmission of setting up on the basis of interfaces interconnect can be referred to, now, terminal and read-write equipment is needed all to be in opening.Because read-write equipment is suitable for the read-write operation all terminals on production line being carried out to device parameter, therefore read-write equipment is generally all in opening, terminal on production line is then not necessarily in opening, even not to its power supply, to carry out the read-write operation of device parameter to terminal, need power to terminal and open.If but each terminal on production line is powered after it is connected with read-write equipment and opens, certainly will production efficiency be affected, therefore, in the present embodiment, before terminal is connected with read-write equipment, described terminal is powered and makes it be in opening.During concrete enforcement, all terminals on production line can be installed battery or external power-supply unit in advance, after terminal is opened, plug USB data line and be connected with read-write equipment, by described read-write equipment, terminal is carried out to the read-write operation of device parameter, so greatly can shorten the time of the read-write operation to device parameter, enhance productivity.Certainly, if terminal supports the power supply of USB data line, directly with USB data line, terminal is connected with read-write equipment, then relies on USB data line to be that terminal is powered, so can save the step into terminal installation battery or other power-supply units external, can enhance productivity equally.
After terminal being connected with read-write equipment, perform step S102, read the control mark in described terminal, described control mark is for representing that parameter reading and writing operation is in state of activation or masked state.
After the terminal being in opening is connected with read-write equipment by USB data line, read-write equipment detects that USB device is inserted, protocol interaction can be produced with terminal, and fictionalize the serial equipment of a similar RS232, can by this virtual serial equipment out referred to as virtual serial port, the parameter reading and writing instrument be then installed on read-write equipment sends related command to read or to write the device parameters such as IMEI number to terminal.Certainly, in the present embodiment, what USB data line fictionalized after inserting is a serial equipment, in other embodiments, also other data lines can be adopted or terminal is connected with read-write equipment by wireless mode, what fictionalize might not be serial equipment, but at least belongs to interfacing equipment, therefore can by the interfacing equipment that fictionalizes referred to as virtual port.
Consumer is when using terminal, if terminal is connected with computer, the automatic generating virtual port of meeting equally, but this virtual port is unwanted concerning consumer, if there is their unwanted thing after the terminal that consumer uses is connected with computer, then can think that this terminal quality has problem.Therefore, inventor considers, can arranging one in the terminal for representing that parameter reading and writing operation is in the control mark of state of activation or masked state, identifying by described control the control realized automatic generating virtual port.
Particularly, can after terminal be connected with read-write equipment, first read described control mark, automatic generating virtual port is determined whether according to the described recognition result controlling mark, if identify described control mark be expressed as parameter reading and writing operation be in state of activation, now can generating virtual port automatically, read-write equipment just can complete read-write to device parameter by described virtual port, if identify described control mark be expressed as parameter reading and writing operation be in masked state, now just can not generating virtual port.In the specific implementation, described control mark can be a parameter, such as auto_usb, and this parameter is a variable, suppose that this parameter is that 0 expression parameter reading and writing operation is in masked state, namely close the function of automatic generating virtual port, suppose that this parameter is that 1 expression parameter reading and writing operation is in state of activation, namely activate the function of automatic generating virtual port.
Read described control mark after, perform step S103, when identify described control mark be expressed as parameter reading and writing operation be in state of activation, described read-write equipment and described terminal produce protocol interaction, generating virtual port.
During concrete enforcement, terminal is detecting in USB device insertion situation, first usb_auto variable is read, if identifying usb_auto variable is 1, illustrate that described control mark is expressed as parameter reading and writing operation and is in state of activation, then terminal and read-write equipment produce protocol interaction, generating virtual port, read-write equipment just can come IMEI by the virtual port fictionalized, SNR, Bluetooth MAC address, the read-write of the device parameters such as WiFiMAC address, if identifying usb_auto variable is 0, illustrate that described control mark is expressed as parameter reading and writing operation and is in masked state, then can not generating virtual port automatically.
In the present embodiment, in order to the read-write operation terminal on production line being carried out to device parameter can be realized, state residing for described control mark initial representation parameter reading and writing being operated is state of activation, when so just can guarantee that terminal is connected first with read-write equipment, can automatically generating virtual port so that read-write equipment realizes the read-write operation to device parameter by described virtual port.
After the described virtual port of generation, perform step S104, described read-write equipment realizes the read-write to the device parameter of described terminal by described virtual port.In the present embodiment, terminal plugs USB data line with after read-write equipment connection, automatically can fictionalize the virtual serial port of a similar RS232 serial ports, the Reading and writing instrument be installed on read-write equipment just can realize the function of the device parameters such as read-write IMEI by this virtual serial port.
After step S104, perform step S105, after completing the read-write to described device parameter, described control mark is expressed as parameter reading and writing operation and is in masked state.In order to ensure consumer when terminal is connected with apparatus such as computer, can not automatic generating virtual port again, just need after completing the read-write to described device parameter, close the function of " automatic generating virtual port ".In the present embodiment, USB data line connects rear generating virtual serial ports automatically function with computer is plugged if closed a terminal, read-write equipment is after completing the read-write operation to device parameter, the order of " closing automatic virtual serial port " is sent by this virtual serial port, after terminal receives this order, just the parameter usb_auto in storer is revised as " usb_auto=0 ", such terminal is when taking off battery or power down, again install battery or add external power supply and plug after USB data line is connected with apparatus such as computer, terminal detects parameter usb_auto=0 in storer, then no longer automatic generating virtual serial ports, read-write equipment also just cannot read and write the device parameters such as IMEI by USB data line, consumer also can not see virtual serial port when terminal being connected with apparatus such as computer by USB data line, namely the use of consumer to normal USB function is not affected, ensure that the quality safety of terminal of dispatching from the factory.
In the present embodiment, the device parameter reading/writing method of described terminal also comprises: when carrying out system update to described terminal, shields storing the described read-write operation controlling the storage area of mark.Due to terminal dispatch from the factory after user because to reprocess or the reason such as function renewal wants upgrade software, in order to prevent wiping during upgrade software or revise described control mark, need shielding to storing the described read-write operation controlling the storage area of mark, such as when system update, terminal produces a control signal, to forbid carrying out read-write operation to the described storage area controlling mark.In addition, can also the described storage area controlling can not to wipe or must back up when mark is stored in terminal staging, such as by the storage area of the parameter usb_auto memory mobile phone radio-frequency (RF) calibration parameter in the present embodiment, because system upgrade inherently retains described radio-frequency (RF) calibration parameter, otherwise mobile phone looks for net performance and speech quality to be had a strong impact on, so can parameter usb_auto be placed in identical storage area with described radio-frequency (RF) calibration parameter, even if the data of this storage area of upgrade software still can retain like this, thus also quality problems can not be caused.
In addition, in the present embodiment, the device parameter reading/writing method of described terminal also comprises: when recovering the initial setting up of described terminal, described control mark is expressed as parameter reading and writing operation and is in masked state.Usually, terminal has a factory reset or is the similar functions recovering initial setting up, in order to ensure that the production line terminal that to cause because failing to write the device parameters such as IMEI dispatching from the factory does not close the function of automatic generating virtual port, therefore, can when performing the function of factory reset or recovery initial setting up, parameter usb_auto is set to " 0 ", thus ensures that the terminal of dispatching from the factory has closed the function of plugging USB data line and connecting generating virtual serial ports automatically after computer all.
It should be noted that, described control mark is expressed as parameter reading and writing operation be in masked state after, and do not mean that and can not modify to described control mark again, only for user, this control mark can only be expressed as parameter reading and writing operation and be in masked state, if producer needs to modify to the device parameter of terminal, still can reset described control mark by specific purpose tool, recover the function of " automatic generating virtual serial ports ".
In addition, production line fails to write the device parameters such as IMEI and does not mean that terminal can not normally be used, because all can initially have the device parameters such as identical IMEI in usual all terminals, and be in order to ensure passing through this type of certain terminal of device parameter unique identification to the read-write operation of the device parameters such as IMEI.
Based on the device parameter reading/writing method of above-mentioned terminal, the embodiment of the present invention also provides a kind of device parameter read-write equipment of terminal.Fig. 2 is the structural representation of the device parameter read-write equipment of the terminal that the embodiment of the present invention provides, as shown in Figure 2, the device parameter read-write equipment of described terminal comprises: reading unit 201, be suitable for the control mark in reading terminals, described control mark is for representing that parameter reading and writing operation is in state of activation or masked state; Virtual port generation unit 202, is connected with described reading unit 201, be suitable for when identify described control mark be expressed as parameter reading and writing operation be in state of activation, make described terminal and read-write equipment produce protocol interaction, generating virtual port; Setting unit 203, is connected with described virtual port generation unit 202, is suitable for after described read-write equipment completes the read-write to the device parameter of described terminal by described virtual port, described control mark is expressed as parameter reading and writing operation and is in masked state.
In the present embodiment, the device parameter read-write equipment of described terminal also comprises screen unit (not shown), is suitable for when carrying out system update to described terminal, shields storing the described read-write operation controlling the storage area of mark.The described state controlled residing for the operation of mark initial representation parameter reading and writing is state of activation.
In addition, described setting unit 203 is also suitable for when recovering the initial setting up of described terminal, described control mark is expressed as parameter reading and writing operation and is in masked state.
In the present embodiment, described terminal is mobile communication terminal, and described device parameter is at least one in IMEI, SNR, Bluetooth MAC address and WiFiMAC address.
The concrete enforcement of the device parameter read-write equipment of described terminal with reference to the enforcement of the device parameter reading/writing method of above-mentioned terminal, can not repeat them here.
To sum up, the device parameter reading/writing method of the terminal that embodiment of the present invention provides and device, at least have following beneficial effect:
By arranging for representing that parameter reading and writing operation is in the control mark of state of activation or masked state in the terminal, after terminal is connected with read-write equipment, if be in state of activation to the described recognition result controlling mark for representing that parameter reading and writing operates, then described terminal and read-write equipment produce protocol interaction, generating virtual port, and after described read-write equipment completes the read-write to the device parameter of described terminal by described virtual port, described control mark is expressed as parameter reading and writing operation and is in masked state to close the automatic generation for described virtual port, thus can be simple, safe and reliable, realize efficiently reading and writing the device parameter of terminal.
Before being connected with read-write equipment in terminal, described terminal being powered and makes it be in opening, greatly can shorten the time of the read-write operation to device parameter, enhance productivity.
When carrying out system update to described terminal, by shielding to storing the described read-write operation controlling the storage area of mark, ensure that the quality safety of terminal is reliable.
When recovering the initial setting up of described terminal, described control mark is expressed as parameter reading and writing operation and is in masked state, terminal of can avoiding causing because production line fails to write device parameter dispatching from the factory does not close the function of automatic generating virtual port, further ensures the quality safety of terminal of dispatching from the factory.
Although the present invention with preferred embodiment openly as above; but it is not for limiting the present invention; any those skilled in the art without departing from the spirit and scope of the present invention; the Method and Technology content of above-mentioned announcement can be utilized to make possible variation and amendment to technical solution of the present invention; therefore; every content not departing from technical solution of the present invention; the any simple modification done above embodiment according to technical spirit of the present invention, equivalent variations and modification, all belong to the protection domain of technical solution of the present invention.