The application is a divisional application of a Chinese patent application 201310103347.4 entitled "a method and a device for processing product production data" filed on 28.3.2013.
Detailed Description
In the method, after an upper application of a mobile terminal fails to read product production data information in first product production data, a device driver of the mobile terminal reads product production data information in second product production data and replaces the first product production data with the second product production data, so that the problem of product production data reading failure caused by a mobile terminal modification tool is solved, and the product production data can be successfully obtained in the normal use process of the mobile terminal.
Fig. 1 is a schematic diagram of a process of a method for processing product production data according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
s101: and the upper layer application of the mobile terminal reads the product production data information in the first product production data.
S102: after the upper application of the mobile terminal fails to read the product production data information in the first product production data in the step S101, the device driver of the mobile terminal reads the product production data information in the second product production data, and replaces the first product production data with the second product production data.
In the embodiment of the invention, in consideration of the importance of the product production data, the product production data is divided into two parts, and after the product production data information in the first part of the product production data fails to be read, the product production data information in the second part of the product production data can be further read, and the second part of the product production data is used for replacing the first part of the product production data, so that the recovery of the product production data is realized.
Before the mobile terminal leaves a factory and in the process of updating product production data in the factory, the product production data to be written or updated is written into the first product production data and the second product production data in sequence to realize backup, and at the moment, the two product production data are the same. However, due to factors such as reading the product production data for many times, damaging hardware of a memory for storing the product production data, deleting a modification tool and the like, the first product production data may not be read, or the read data is verified to be wrong, so that the first product production data is unavailable, and at this time, the device driver of the mobile terminal invisibly and automatically reads product production data information in the second product production data, and replaces the first product production data with the read second product production data to recover the product production data. The invisible data is invisible to a user of the mobile terminal, and the automatic data is used for automatically reading the product production data information in the second product production data without the confirmation of the upper application after the device driver knows that the product production data information in the first product production data fails to be read, and returning the read product production data information to the upper application. The device driver of the mobile terminal may be a driver code in the kernel of the operating system of the mobile terminal. Since the above process is unknown to the user of the mobile terminal, the user perception is enhanced.
Further, the second product production data is read only by the device driver of the mobile terminal.
The first product production data has a read-write interface for the upper layer application and is visible for the upper layer application; in a factory, a first product production data can be written by a specific device through an upper layer application of the mobile terminal, and after the mobile terminal is shipped from a factory, the upper layer application can only read product production data information in the first product production data in the normal use process of the mobile terminal, and the product production data cannot be rewritten or deleted. The second product production data is completely hidden from the outside world, and the only thing that can be operated on is the device driver. Optionally, the device driver is a driver code in the kernel of the operating system of the mobile terminal.
Further, the first part of product production data and the second part of product production data are respectively stored in different partitions or different memories of the same memory of the mobile terminal.
By doing so, the situation that production data of two products cannot be read due to damage of one partition can be effectively avoided, and the reliability is high. In practical implementation, one copy of product production data can occupy storage space of 32K, 64K, etc., and the specific size depends on the data volume of the product production data.
Further, the method for processing product production data provided by the embodiment of the present invention further includes: and the mobile terminal takes the received initial product production data as first product production data and stores the first product production data, and takes the received initial product production data as second product production data and stores the second product production data.
In the production process of the mobile terminal, the mobile terminal stores the received initial product production data as first product production data, and then stores the initial product production data as second product production data invisibly by the device driver. If any of the two storage processes fails, the production process is re-entered. Until the number of times of repeatedly entering the generation process reaches a preset number threshold (for example, 2 times).
Further, the method for processing product production data provided by the embodiment of the present invention further includes:
and the mobile terminal replaces the stored first part of product production data with the received updated product production data as the first part of product production data, and replaces the stored second part of product production data with the updated product production data as the second part of product production data.
Depending on the process requirements, in special cases (e.g., product back-ups), product production data needs to be updated in the factory. In the process, the production data of the two products are updated respectively, and the two products are ensured to be the same.
Further, if the replacement of the updated product production data with the stored first copy of product production data fails, the device driver of the mobile terminal reads product production data information in the stored first copy of product production data, and if the reading succeeds, the received updated product production data is used as the first copy of product production data to replace the stored first copy of product production data;
and if the updated product production data fails to replace the stored second product production data, the device driver of the mobile terminal reads the product production data information in the stored second product production data, and if the reading succeeds, the received updated product production data is used as the second product production data to replace the stored second product production data.
When product production data is updated, one updating failure may be caused by a plurality of reasons such as operation, reading and writing of hardware equipment, and the like, wherein the product production data is considered to be failed to update no matter whether any one of the first product production data and the second product production data fails to update. At this time, the updating process can be selected to quit, the stored product production data can be tried to be read, if the reading is successful, the hardware storing the product production data is proved not to be damaged, and the product production data can be tried to be updated again. In practical implementation, a threshold of the number of repeated updates (for example, 2 times) may be preset, and when the number of repeated updates reaches the preset threshold, the updating process is exited.
When reading the product production data, the device driver uses the function bdget _ disk () to obtain the device handle (as the parameter of the following function call) of the memory or memory partition storing the product production data, and reads the product production data through the function family break () and break (). The device driver can realize the mutual replacement of two pieces of product production data through a function family getblk (), mark _ buffer _ dirty (), ll _ rw _ block (), and brelse (). Thus, the production data of the two products are ensured to be synchronous. For example, when two copies of product production data are stored in the partitions BCK1 and BCK2 of the same memory, respectively, the data of BCK1 can be written into BCK2 through the above function family. The above functions are merely examples and should not be construed as limiting the embodiments of the present invention.
Next, the product production data reading, the initial product production data writing, and the product production data updating process according to the embodiment of the present invention will be described with reference to fig. 2, fig. 3, and fig. 4, respectively.
First, a process of reading production data of an embodiment of the present invention is explained with reference to fig. 2.
S201: the upper layer application of the mobile terminal reads the product production data information in the first product production data, and if the product production data information is successful, the step S202 is executed; if the failure occurs, go to step S203;
s202: returning the read product production data information to the upper layer application;
s203: the device driver of the mobile terminal automatically reads the product production data information in the second product production data, and if the product production data information fails, the step S204 is executed; if successful, step S205 is executed, and optionally, step S205' may be executed before step S205 is executed;
s204: confirming that a memory or a memory partition for storing the product production data is damaged and cannot be repaired, and quitting the reading flow of the product production data;
s205: replacing the first copy of product production data with the second copy of product production data and returning to step S202;
s205': the memory partition or the memory for storing the first product production data is formatted, and the purpose of the step is to remove possible bad blocks of the memory partition and improve the storage success rate in replacement.
Next, a process of writing initial product production data according to an embodiment of the present invention will be described with reference to fig. 3.
S301: entering a factory production mode;
s302: taking the received initial product production data as a first part of product production data, storing the first part of product production data, executing the step S303 if the storage is successful, and returning to the step S301 if the storage is failed;
s303: taking the received initial product production data as second product production data, storing the second product production data, executing the step S304 if the storage is successful, and returning to the step S301 if the storage is failed;
s304: and entering other stages of production.
The initial product production data is written with a specific device before the mobile terminal is shipped. Generally, the mobile terminal enters a factory production mode to write product production data. After the successful writing of the production data, the other stages of the factory production are entered, such as: packaging the shell, testing the performance of the whole machine and the like.
As can be seen from the above steps, the factory production mode is re-entered when any one of the first product production data or the second product production data fails to be stored, and in actual implementation, the number of re-entering the factory production mode (for example, 2 times) can be limited to avoid dead cycles.
Finally, the update process of the product production data of the embodiment of the present invention is explained with reference to fig. 4.
Depending on the process requirements, in special cases (e.g., product back-ups), the product production data needs to be updated within the factory. In the process, the production data of the two products are updated respectively so as to ensure that the production data of the two products are the same. The process is realized by the following steps:
s401: the mobile terminal replaces the stored first part of product production data with the received updated product production data as the first part of product production data; if the replacement is successful, executing step S402, and if the replacement is failed, executing step S403;
s402: the mobile terminal replaces the stored second product production data by using the received updated product production data as the second product production data, if the second product production data is successful, the step S405 is executed, and if the second product production data is failed, the step S406 is executed;
s403: the device driver of the mobile terminal reads product production data information in the stored first product production data, if the reading is successful, the step S401 is returned, and if the reading is failed, the step S404 is executed;
s404: confirming that a memory or a memory partition for storing the production data of the product is damaged and cannot be repaired, and quitting the updating process of the production data of the product;
s405: entering other steps of factory updating;
s406: and the device driver of the mobile terminal reads the product production data information in the stored second product production data, if the reading is successful, the step S402 is returned, and if the reading is failed, the step S404 is executed.
In practice, the number of times of re-updating (e.g. 2 times) may be limited to avoid dead cycles. Optionally, when the step S402 is executed, if the step S404 fails, the step S404 may also be directly executed, that is, it is determined that the memory or the memory partition of the product production data is damaged, the update process of the product production data is exited, and no update is performed.
Based on the same inventive concept, the embodiment of the present invention further provides a device for processing product production data by a mobile terminal, and as the implementation principle of the mobile terminal is similar to the method for processing product production data in the embodiment of the present invention, the implementation of the mobile terminal may refer to the implementation of the method, and repeated details are not repeated.
Fig. 5 is a schematic structural diagram of an apparatus for processing product production data according to an embodiment of the present invention. The device specifically includes:
the upper application 501 is used for reading product production data information in the first product production data;
the device driver 502 is configured to read product production data information in the second product production data after the upper layer application 501 fails to read product production data information in the first product production data, and then replace the first product production data with the second product production data.
Further, in the apparatus for processing product production data provided by the embodiment of the present invention, the second product production data is read and written only by the device driver.
Further, as shown in fig. 6A, the apparatus for processing product production data according to the embodiment of the present invention further includes: the first memory 601, wherein the first memory 601 comprises a partition BCK1 and a partition BCK2, the partition BCK1 is used for storing the first product production data, and the partition BCK2 is used for storing the second product production data.
Alternatively, as shown in fig. 6B, the apparatus for processing product production data according to the embodiment of the present invention further includes: a second memory 602 for storing a first copy of the product manufacturing data and a third memory 603 for storing a second copy of the product manufacturing data, wherein the second memory 602 is used for storing a first copy of the product manufacturing data and the third memory 603 is used for storing a second copy of the product manufacturing data.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.