CN109074301B - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN109074301B
CN109074301B CN201780012551.1A CN201780012551A CN109074301B CN 109074301 B CN109074301 B CN 109074301B CN 201780012551 A CN201780012551 A CN 201780012551A CN 109074301 B CN109074301 B CN 109074301B
Authority
CN
China
Prior art keywords
storage device
data storage
removable data
removable
storage medium
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201780012551.1A
Other languages
Chinese (zh)
Other versions
CN109074301A (en
Inventor
李鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Publication of CN109074301A publication Critical patent/CN109074301A/en
Application granted granted Critical
Publication of CN109074301B publication Critical patent/CN109074301B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/28Error detection; Error correction; Monitoring by checking the correct order of processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)
  • Storage Device Security (AREA)

Abstract

A data processing method and device are used for solving the problem of data damage caused by the fact that an SD card is not removed according to correct operation in the prior art. The method comprises the following steps: when the removable data storage device is detected to be removed from the terminal equipment in the process of writing first data on the terminal equipment into a removable data storage device coupled with the terminal equipment, storing second data, which are not written into the removable data storage device, in the first data, in a preset storage medium of the terminal equipment; upon detecting that the removable data storage device is coupled to the terminal device again, writing second data stored in the storage medium to the removable data storage device.

Description

Data processing method and device
This application claims priority from a chinese patent application having application number 201710147617.X entitled "a method and apparatus for data processing" filed by the chinese patent office on 13/3/2017, the entire contents of which are incorporated herein by reference.
Technical Field
The present application relates to the field of data storage technologies, and in particular, to a data processing method and apparatus.
Background
At present, more and more applications and user data are installed on terminal equipment such as mobile phones and tablets, and the internal storage space of the terminal equipment is limited, so that many people select a Secure Digital Card (SD for short) as storage expansion, but the risk of data loss is brought. When the background of the terminal device system is writing data to the SD card, the user unplugs the SD or the SD accidentally breaks away from the terminal device, which may cause partial data on the SD to be incomplete, and may destroy file system information on the SD in severe cases, so that the terminal device cannot identify the SD card, and the user is lost to a certain extent.
Disclosure of Invention
The embodiment of the application provides a data processing method and device, which are used for solving the problem of data damage caused by the fact that an SD card is not removed according to correct operation in the prior art.
In a first aspect, an embodiment of the present application provides a data processing method, including: when the removable data storage device is detected to be removed from the terminal equipment in the process of writing first data on the terminal equipment into a removable data storage device coupled with the terminal equipment, storing second data, which are not written into the removable data storage device, in the first data, in a preset storage medium of the terminal equipment; upon detecting that the removable data storage device is coupled to the terminal device again, writing second data stored in the storage medium to the removable data storage device.
Through the design, when the removable data storage device is detected to be accidentally removed in the process of writing data into the removable data storage device, the unwritten part is stored into the preset storage medium, so that when the removable data storage device is detected to be coupled to the terminal equipment again, the unwritten part is continuously written into the removable data storage device, and the integrity of the data is guaranteed to a certain extent and the data is prevented from being damaged.
In one possible design, before writing the second data stored in the storage medium to the removable data storage device, the method further includes: determining that the removable data storage device is detected to be coupled to the terminal device again within a first preset time period after the removable data storage device is detected to be removed from the terminal device; or, when the time for detecting that the removable data storage device is coupled to the terminal device again is determined as detecting that the removable data storage device is removed from the terminal device, prompting a user that the removable data storage device is not safely removed within a second preset time period.
Through the design, when the fact that the movable data storage device is coupled to the terminal equipment again is detected within a first preset time after the movable data storage device is removed from the terminal equipment, second data stored in the storage medium are written into the movable data storage device, when the user movable data storage device is not coupled to the terminal equipment for a long time, the terminal equipment does not detect whether the movable data storage device is coupled to the terminal equipment again, and the consumption of the electric quantity of the terminal equipment can be reduced to a certain extent.
In one possible design, after detecting that the removable data storage device is removed from the terminal device, before writing the second data stored in the storage medium to the removable data storage device, the method may further include: the user is prompted that the removable data storage device is not securely removed and a user-triggered instruction confirming that there is no secure removal is detected.
Through the design, after the removable data storage device is detected to be removed from the terminal equipment, the user is prompted that the removable data storage device is not safely removed, the removable data storage device is detected to be coupled to the terminal equipment again, and when an instruction for confirming that the removable data storage device is not safely removed, which is triggered by the user, is detected, the second data stored in the storage medium is written into the removable data storage device, so that the user can be prompted that the removable data storage device removed by the user is unsafe, the user can timely connect the removable data storage device to the terminal equipment again, the second data stored in the storage medium is timely written into the removable data storage device, the integrity of the data is guaranteed to a certain extent, and the data is prevented from being damaged.
In one possible design, the method may further include: not detecting that the removable data storage device is coupled to the terminal device for a second predetermined duration after prompting the user that the removable data storage device is not securely removed; and deleting the second data from the storage medium, or when the storage medium is a volatile storage medium, moving the second data from the volatile storage medium to a permanent storage medium.
Through the design, within a second preset time length after the movable data storage device is not safely removed, the fact that the movable data storage device is coupled to the terminal equipment is not detected, the second data are timely deleted from the storage medium, and the second data are prevented from occupying the storage medium for a long time to a certain extent. In addition, when the storage medium is a volatile storage medium, the second data is moved from the volatile storage medium to a persistent storage medium, so that the unwritten useful data can be prevented from being lost after the terminal device is powered off, and the data security is ensured to a certain extent.
In one possible design, the method may further include: and within a third preset time length after the movable data storage device is not safely removed, the user is prompted that the movable data storage device is coupled to the terminal equipment, the user is prompted that the movable data storage device is not safely removed again, so that the user can timely connect the movable data storage device to the terminal equipment under the condition that the user can timely know that the movable data storage device is not safely removed, the terminal equipment can timely continuously write the unwritten data into the movable data storage device, the integrity of the data is ensured to a certain extent, and the data is prevented from being damaged.
Based on the same inventive concept as the method embodiment, the embodiment of the present application further provides a data processing apparatus, where the apparatus is applied to a terminal device, and the apparatus includes:
a communication interface, a processor, and a memory; the communication interface for coupling the removable data storage device with the terminal device; the memory is used for storing first data; the processor is used for storing second data which is not written into the removable data storage device in the first data in a preset storage space of the memory when the removable data storage device is detected to be removed from the terminal equipment in the process of writing the first data stored in the memory into the removable data storage device; and when the movable data storage device is detected to be coupled to the terminal equipment again, writing second data stored in the preset storage space into the movable data storage device.
In one possible design, the memory includes a first storage medium for storing the first data and a second storage medium;
the processor, when storing second data, which has not been written into the removable data storage device, in the first data in a preset storage space of the memory, is specifically configured to store the second data in the preset storage space of the second storage medium.
In one possible design, the processor is further configured to determine, before writing the second data stored in the storage medium to the removable data storage device, that the removable data storage device is detected to be coupled to the terminal device again within a first preset time period after detecting that the removable data storage device is removed from the terminal device; or, when the time for detecting that the removable data storage device is coupled to the terminal device again is determined as detecting that the removable data storage device is removed from the terminal device, prompting a user that the removable data storage device is not safely removed within a second preset time period.
In one possible design, the processor is further configured to prompt a user that the removable data storage device is not securely removed and detect a user-triggered instruction to confirm that the removable data storage device is not securely removed before writing the second data stored in the storage medium to the removable data storage device after detecting that the removable data storage device is removed from the terminal device.
In one possible design, the processor is further configured to not detect that the removable data storage device is coupled to the terminal device for a second predetermined duration after prompting the user that the removable data storage device is not securely removed; and deleting the second data from the storage space, or moving the second data from the volatile storage medium to a permanent storage medium when the storage medium corresponding to the preset storage space is the volatile storage medium.
In one possible design, the processor is further configured to, within a third predetermined duration after prompting the user that the removable data storage device is not securely removed, not detect that the removable data storage device is coupled to the terminal equipment, and again prompt the user that the removable data storage device is not securely removed.
In one possible design, the device further comprises a display or a speaker; the processor is specifically configured to prompt the user that the removable data storage device is not safely removed through a display interface of the display, or prompt the user that the removable data storage device is not safely removed through the speaker, when prompting the user that the removable data storage device is not safely removed.
In a third aspect, an embodiment of the present application provides a data processing apparatus, including:
a write module for writing first data on a terminal device to a removable data storage device coupled to the terminal device;
a detection module for detecting whether the removable data storage device is removed from the terminal device;
the storage module is used for storing second data which is not written into the removable data storage device in the first data into a preset storage medium of the terminal equipment when the detection module detects that the removable data storage device is removed from the terminal equipment in the process that the writing module writes the first data on the terminal equipment into the removable data storage device coupled with the terminal equipment;
a detection module for detecting whether the removable data storage device is coupled to the terminal device;
the writing module is further configured to write the second data stored in the storage medium into the removable data storage device when the detecting module detects that the removable data storage device is coupled to the terminal device again.
In one possible design, the detecting module is further configured to determine that the removable data storage device is detected to be coupled to the terminal device again within a first preset time period after the removable data storage device is detected to be removed from the terminal device before the writing module writes the second data stored in the storage medium to the removable data storage device.
In one possible design, the terminal device further includes a prompting module for prompting a user that the removable data storage device is not safely removed when the detection module detects that the removable data storage device is removed from the terminal device. The detection module is further configured to determine, before the writing module writes the second data stored in the storage medium into the removable data storage device, that when it is detected that the removable data storage device is coupled to the terminal device again, the indication module indicates to a user that the removable data storage device is not safely removed within a second preset time period after it is detected that the removable data storage device is removed from the terminal device.
In one possible design, the prompting module prompts a user that the removable data storage device is not safely removed after the detection module detects that the removable data storage device is removed from the terminal device; the detection module detects that the removable data storage device is coupled to the terminal equipment again and detects a user-triggered instruction for confirming that there is no secure removal, the write module writes second data stored in the storage medium to the removable data storage device.
In one possible design, the apparatus further includes:
a deletion module for deleting the second data from the storage medium if the detection module detects that the removable data storage device is coupled to the terminal device within a second preset duration after the prompt module prompts the user that the removable data storage device is not safely removed.
In a possible design, when the storage medium is a volatile storage medium, the storage module is further configured to, within a second preset time period after the prompting module prompts a user that the removable data storage device is not safely removed, detect that the removable data storage device is coupled to the terminal device, and then move the second data from the volatile storage medium to a volatile storage medium.
In one possible design, the prompting module is further configured to, within a third preset time period after prompting the user that the removable data storage device is not safely removed, not detect that the removable data storage device is coupled to the terminal equipment, and again prompt the user that the removable data storage device is not safely removed.
In a fourth aspect, this embodiment of the present application further provides a computer storage medium, where a software program is stored, and when the software program is read and executed by one or more processors, the software program may implement the method provided by the first aspect or any one of the designs of the first aspect.
In a fifth aspect, embodiments of the present application provide a computer program product containing instructions, which when executed on a computer, cause the computer to perform the method provided by the first aspect or any one of the first aspects.
Drawings
Fig. 1 is a schematic structural diagram of a terminal device provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of a data processing system according to an embodiment of the present application;
fig. 3 is a flowchart of a data processing method according to an embodiment of the present application;
FIG. 4 is a flow chart of another data processing method provided by the embodiments of the present application;
FIG. 5 is a flow chart of another data processing method provided in the embodiments of the present application;
fig. 6 is a flowchart of another data processing method provided in an embodiment of the present application;
fig. 7 is a schematic diagram illustrating a terminal device displaying prompt information of a user according to an embodiment of the present application;
fig. 8 is a schematic diagram of a data processing apparatus according to an embodiment of the present application.
Detailed Description
Hereinafter, some terms in the present application are explained to be understood by those skilled in the art.
A removable data storage device includes a memory configured to store data. The Removable data storage device may be a Subscriber Identity Module (SIM), a Secure Digital (SD) Memory Card, an Integrated Circuit (IC) Memory, a Universal Serial Bus (USB) driver, a Universal Integrated Circuit Card (UICC), a Removable User Identity Module (Removable User Identity Module, R-UIM), a thumb drive, a flash Memory drive, a solid state Memory device, and so on.
The terminal devices include, but are not limited to, personal computers, server computers, hand-held or laptop devices, mobile devices (such as cell phones, mobile phones, tablets, personal digital assistants, pagers, media players, cameras, audio recorders, and the like), consumer electronics, minicomputers, mainframe computers, and the like.
"coupled" means that two elements are joined to each other either directly or indirectly. The combination may be fixed or movable, which may allow flowing fluid, electrical or other types of signals to be communicated between the two components. For example, if the removable data storage device is an SD card and the terminal device is a personal computer, a recessed member is provided on the personal computer, and the SD card can be mounted on the recessed member to couple the SD card with the personal computer, or the SD card can be coupled with the personal computer through an SD card reader.
A persistent storage medium, meaning: data stored in the storage medium is not lost after power is turned off. Such as Read Only Memory (ROM), Flash Memory (Flash Memory), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc.
Volatile storage media, refers to: data stored in the storage medium is lost after power is turned off. Such as a Random Access Memory (RAM).
Plural means two or more.
In addition, it is to be understood that the terms first, second, etc. in the description of the present application are used for distinguishing between the descriptions and not necessarily for describing a sequential or chronological order.
Fig. 1 is a schematic diagram of a hardware structure of a terminal device applied in the embodiment of the present application. As shown in fig. 1, the terminal device 100 includes a display device 110, a processor 120, and a memory 130. The memory 130 may be used to store software programs and data, and the processor 120 executes various functional applications and data processing of the terminal device 100 by operating the software programs and data stored in the memory 130. The memory 130 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program (such as an image capturing function) required by at least one function, and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the terminal device 100, and the like. Further, the memory 130 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device, among others. The processor 120 is a control center of the terminal device 100, connects various parts of the entire terminal device by various interfaces and lines, and performs various functions of the terminal device 100 and processes data by running or executing software programs and/or data stored in the memory 130, thereby performing overall monitoring of the terminal device. The Processor 120 may include one or more general-purpose processors, and may further include one or more Digital Signal Processors (DSPs) for performing related operations to implement the technical solutions provided in the embodiments of the present application.
A camera 160 for taking pictures or videos may also be included in the terminal device 100. The terminal device 100 may further include an input device 140 for receiving input numerical information, character information, or contact touch operation/non-contact gesture, and generating signal input related to user setting and function control of the terminal device 100, and the like. Specifically, in the embodiment of the present application, the input device 140 may include a touch panel 141. The touch panel 141, also referred to as a touch screen, may collect touch operations of a user (e.g., operations of the user on the touch panel 141 or on the touch panel 141 using any suitable object or accessory such as a finger or a stylus) thereon or nearby, and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 141 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 120, and can receive and execute commands sent by the processor 120. For example, when the user clicks an icon or legend corresponding to an application with a finger on the touch panel 141, the touch detection device detects the signal caused by the click and transmits the signal to the touch controller, the touch controller converts the signal into coordinates and transmits the coordinates to the processor 120, and the processor 120 determines the operation (open) to be performed on the icon or legend according to the coordinates and the type of the signal (single click or double click).
The touch panel 141 can be implemented by various types, such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 141, the input device 140 may include other input devices 142, and the other input devices 142 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display device 110 includes a display panel 111 for displaying information input by a user or information provided to the user, various menu interfaces of the terminal device 100, and the like, and in the embodiment of the present application, is mainly used for displaying a picture captured by a camera in the terminal device 100. Alternatively, the Display panel 111 may be configured by a Liquid Crystal Display (LCD) or an Organic Light-Emitting Diode (OLED). In some other embodiments, the touch panel 141 can cover the display panel 111 to form a touch display screen.
In addition to the above, the terminal device 100 may further include a power supply 150 for supplying power to other modules. The terminal device 100 may also include one or more sensors 170, such as an acceleration sensor, a light sensor, a GPS sensor, an infrared sensor, a laser sensor, a position sensor, or a lens pointing angle sensor, among others. The terminal device 100 may further include a Radio Frequency (RF) circuit 180 for performing network communication with a wireless network device, a WiFi module 190 for performing WiFi communication with other devices, and a speaker 210 for playing music, voice prompt, or making a prompt sound. The terminal device 100 further comprises a communication interface 220, the communication interface 220 being adapted for coupling to a removable data storage means.
The following is a method for removing a removable data storage device according to a specification operation for a user, which is referred to in the embodiments of the present application. Taking the removable data storage device as an SD card as an example:
if the SD card is removed according to the standard operation of the SD card, the data damage problem can not occur, and the standard action is as follows: before the user pulls out the SD card, the SD card is unloaded in the device, and after the unloading is successful (at the moment, the system of the terminal equipment does not have any SD card reading and writing operation any more), the SD card can be taken out safely.
If the removable data storage device is not removed as per the above specification, data corruption, or even removable data storage device corruption, may result. The embodiment of the application provides a data processing method and device, which can avoid the problem of data damage caused by the fact that a movable data storage device is not removed according to the operation of the specification to a certain extent. The method and the device are based on the same inventive concept, and because the principles of solving the problems of the method and the device are similar, the implementation of the device and the method can be mutually referred, and repeated parts are not repeated.
Referring to fig. 2, the data processing system provided by the embodiment of the present application includes a removable data storage device 200 and a terminal device 100. The removable data storage device 200 is coupled with the terminal apparatus 100. Referring to fig. 3, the data processing method includes:
when it is detected that the removable data storage device 200 is removed from the terminal device 100 in the process of writing the first data on the terminal device 100 to the removable data storage device 200, the second data, which has not been written to the removable data storage device 200 in the first data, is stored in the storage medium of the terminal device 100 (S301). Upon detecting that the removable data storage device 200 is coupled to the terminal apparatus 100 again, second data stored in the storage medium is written to the removable data storage device 200 (S302).
In S301, the second data that is not written in the removable data storage device 200 is saved to a storage medium of the terminal device 100, which may be a volatile storage medium or a persistent storage medium. The second data is stored in association with the identification information of the removed removable data storage device 200. Information such as the starting address of the second data in the removable data storage device, and the data size of the second data may also be saved. Wherein, when it is detected that the removable data storage device 200 is coupled to the terminal device 100 again, it may be determined that the removable data storage device 200 is coupled to the terminal device 100 again by determining that the identification information of the removable data storage device coupled to the terminal device 100 again is the same as the identification information of the removable data storage device stored in the storage medium.
In a possible embodiment, in addition to writing the second data stored in the storage medium to the removable data storage apparatus 200 when it is detected that the removable data storage apparatus 200 is coupled to the terminal device 100 again, the second data stored in the storage medium may be written to the removable data storage apparatus 200 when any one of the following timings is reached:
the first method comprises the following steps:
determining that the removable data storage device 200 is coupled to the terminal device 100 again within a first preset time period after the removable data storage device 200 is removed from the terminal device 100.
And the second method comprises the following steps:
determining that the time for detecting the removable data storage device 200 being coupled to the terminal device 100 again is within a second preset time period after the removable data storage device 200 is not safely removed when the removable data storage device 200 is detected to be removed from the terminal device 100.
And the third is that:
after prompting the user that the removable data storage device has not been securely removed, detecting that the removable data storage device 200 is coupled to the terminal device 100 again, and detecting a user-triggered instruction to confirm that there is no secure removal.
The first preset time period and the second preset time period may be the same or different. The embodiment of the present application is not particularly limited to this.
With reference to fig. 4, a data processing method is specifically described based on a first opportunity provided in the embodiment of the present application:
s401, it is detected that the removable data storage device 200 is removed from the terminal device 100.
S402, determining whether data is being written to the removable data storage device 200, if yes, determining to write the first data on the terminal device 100 to the removable data storage device 200, executing S403, if no, ending the flow.
S403, storing second data, which is not written in the removable data storage device 200, in the first data in the storage medium of the terminal device 100. S404 is performed.
S404, detecting that the removable data storage device 200 is coupled to the terminal device 100 again within a first preset time period after detecting that the removable data storage device 200 is removed from the terminal device 100.
S405, writing the second data stored in the storage medium into the removable data storage device 200.
The flow ends.
With reference to fig. 5, a data processing method is specifically described based on a second opportunity provided in the embodiment of the present application:
s501, detecting that the removable data storage device 200 is removed from the terminal device 100.
S502, determining whether data is being written to the removable data storage device 200, if yes, determining to write the first data on the terminal device 100 to the removable data storage device 200, executing S503, if no, ending the flow.
S503, storing second data, which is not written in the removable data storage device 200, in the first data in the storage medium of the terminal device 100. S504 is performed.
S504, the user is prompted that the removable data storage device 200 is not securely removed.
S505, detecting that the removable data storage device 200 is coupled to the terminal device 100 again within a second preset time period that prompts the user that the removable data storage device 200 is not safely removed.
S506, writing the second data stored in the storage medium into the removable data storage device 200.
The flow ends.
Optionally, if it is not detected that the removable data storage device 200 is coupled to the terminal device 100 when the user is prompted at step S504 that the removable data storage device 200 is not safely removed and the second preset duration is reached, the second data is deleted from the storage medium.
If the storage medium is a volatile storage medium, if it is not detected that the removable data storage device 200 is coupled to the terminal device 100 within a second preset time period after the user is prompted at step S505 that the removable data storage device 200 is not safely removed, the second data may be moved from the volatile storage medium to a persistent storage medium.
Optionally, if S504 reaches a third preset time period after prompting the user that the removable data storage device 200 is not safely removed, it is not detected that the removable data storage device 200 is coupled to the terminal device 100, and the user is again prompted that the removable data storage device 200 is not safely removed. If the user is prompted again that the third predetermined duration of time has elapsed since the removable data storage device 200 was not securely removed, and it has not been detected that the removable data storage device 200 is coupled to the terminal device 100, the second data may be deleted from the storage medium.
With reference to fig. 6, a data processing method is specifically described based on a third opportunity provided in the embodiment of the present application:
s601, detecting that the removable data storage device 200 is removed from the terminal device 100.
S602, determining whether data is being written to the removable data storage device 200, if yes, determining to write the first data on the terminal device 100 to the removable data storage device 200, executing S603, if no, ending the flow.
S603, storing second data, which has not been written into the removable data storage device 200, in the storage medium of the terminal device 100. S604 is performed.
S604, the user is prompted that the removable data storage device 200 is not securely removed. S605 is executed.
S605, it is detected that the removable data storage 200 is coupled to the terminal device 100 again. S606 or S607 is executed.
S606, a user-triggered instruction for confirming that there is no secure removal is detected. S608 is performed.
S607, detecting the user triggered canceling the instruction without safe removal. The flow ends.
S608, writing the second data stored in the storage medium into the removable data storage device 200.
The flow ends.
Alternatively, if it is not detected that the removable data storage device 200 is coupled to the terminal device 100 after the user is prompted to reach a second preset duration after the removable data storage device 200 is not safely removed in step S604, the second data is deleted from the storage medium.
If the storage medium is a volatile storage medium, if it is not detected that the removable data storage device 200 is coupled to the terminal device 100 within a second preset time period after the user is prompted at step S605 that the removable data storage device 200 is not safely removed, the second data may be moved from the volatile storage medium to a persistent storage medium.
Alternatively, if S604 reaches a third preset time period after prompting the user that the removable data storage device 200 is not safely removed, it is not detected that the removable data storage device 200 is coupled to the terminal device 100, and the user is again prompted that the removable data storage device 200 is not safely removed. If the user is prompted again that the third predetermined duration of time has elapsed since the removable data storage device 200 was not securely removed, and it has not been detected that the removable data storage device 200 is coupled to the terminal device 100, the second data may be deleted from the storage medium.
In any of the embodiments provided herein, after writing the second data stored in the storage medium to the removable data storage device 200, the user may be prompted to operate to remove the removable data storage device 200 according to the specification.
In addition, in any of the embodiments provided herein, the user may be prompted by a warning sound (e.g., a beep, an alarm, etc.) that may be heard by the user, or a warning that may be seen by the user (e.g., an illumination light, a flashing light, an image on a display, a prompt text on a display, etc.), or an alarm (e.g., a vibration) that may be felt by the user when prompting the user that the removable data storage device 200 is not safely removed. For example, referring to fig. 7, it is exemplarily shown that the user is prompted on the display of the terminal device 100 (taking a mobile phone as an example) that the removable data storage device 200 (taking an SD card as an example) is not safely removed by prompting text "the SD card is not safely removed, part of the legacy data is stored, and please insert the SD card to restore the legacy data immediately".
Based on the same inventive concept as the method embodiment, the embodiment of the present application further provides a data processing apparatus, where the apparatus is applied to a terminal device, and may be specifically implemented by the processor 120 in the terminal device 100. As shown in fig. 8, the apparatus may include:
a writing module 801 for writing first data on a terminal device to a removable data storage device coupled to the terminal device;
a detecting module 802, configured to detect whether the removable data storage device is removed from the terminal device;
a storage module 803, configured to, when the detection module 802 detects that the removable data storage apparatus is removed from the terminal device during a process that the writing module 801 writes first data on the terminal device into a removable data storage apparatus coupled to the terminal device, store second data, which is not written into the removable data storage apparatus, in a preset storage medium of the terminal device;
a detecting module 802, further configured to detect whether the removable data storage device is coupled to the terminal equipment;
the writing module 801 is further configured to write the second data stored in the storage medium to the removable data storage device when the detecting module 802 detects that the removable data storage device is coupled to the terminal device again.
In a possible implementation manner, the detecting module 802 is further configured to determine that the removable data storage device is detected to be coupled to the terminal device again within a first preset time period after the removable data storage device is detected to be removed from the terminal device before the writing module 801 writes the second data stored in the storage medium to the removable data storage device.
In a possible implementation manner, the apparatus further includes a prompting module 804, configured to prompt a user that the removable data storage device is not safely removed when the detecting module 802 detects that the removable data storage device is removed from the terminal device. The detecting module 802 is further configured to determine, before the writing module 801 writes the second data stored in the storage medium into the removable data storage device, that when it is detected that the removable data storage device is coupled to the terminal equipment again, the removable data storage device is detected to be removed from the terminal equipment, and then the prompting module prompts the user that the removable data storage device is not safely removed for a second preset time period.
In one possible implementation, after the detection module 802 detects that the removable data storage device is removed from the terminal device, the prompting module 804 prompts a user that the removable data storage device is not safely removed; the detection module 802 detects that the removable data storage device is coupled to the terminal device again and detects a user-triggered instruction to confirm that there is no secure removal, the write module 801 writes the second data stored in the storage medium to the removable data storage device.
In one possible implementation, the apparatus further includes:
a deleting module 805, configured to delete the second data from the storage medium when the detecting module 802 does not detect that the removable data storage device is coupled to the terminal device within a second preset time period after the prompting module 804 prompts the user that the removable data storage device is not safely removed.
In a possible implementation manner, when the storage medium is a volatile storage medium, the storage module 803 is further configured to, within a second preset time duration after the prompting module 804 prompts a user that the removable data storage device is not safely removed, detect that the removable data storage device is coupled to the terminal device by the detection module 802, and move the second data from the volatile storage medium to a volatile storage medium.
In a possible implementation manner, the prompting module 804 is further configured to, within a third preset time period after prompting the user that the removable data storage device is not safely removed, not detect that the removable data storage device is coupled to the terminal device by the detecting module 802, and again prompt the user that the removable data storage device is not safely removed.
The division of the modules in the embodiments of the present application is schematic, and only one logical function division is provided, and in actual implementation, there may be another division manner, and in addition, each functional module in each embodiment of the present application may be integrated in one processor, may also exist alone physically, or may also be integrated in one module by two or more modules. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
When the hardware implementation is adopted, the hardware implementation of the terminal device may refer to fig. 1 and the related description thereof.
The communication interface 220 for coupling the removable data storage device with the terminal device;
the memory 130 is used for storing first data;
the processor 120 is configured to, when it is detected that the removable data storage device is removed from the terminal device during writing of the first data stored in the memory 130 into the removable data storage device, store second data, which is not written into the removable data storage device, in the preset storage space of the memory; and when the movable data storage device is detected to be coupled to the terminal equipment again, writing second data stored in the preset storage space into the movable data storage device.
In one possible implementation, the memory 130 may include a first storage medium and a second storage medium, where the first storage medium is used for storing the first data;
the processor 120, when storing second data, which has not been written into the removable data storage device, in the first data in a preset storage space of the memory, is specifically configured to store the second data in the preset storage space of the second storage medium.
In a possible implementation, the processor 120 is further configured to determine, before writing the second data stored in the storage medium to the removable data storage device, that the removable data storage device is detected to be coupled to the terminal device again within a first preset time period after detecting that the removable data storage device is removed from the terminal device; or, when the time for detecting that the removable data storage device is coupled to the terminal device again is determined as detecting that the removable data storage device is removed from the terminal device, prompting a user that the removable data storage device is not safely removed within a second preset time period.
In one possible implementation, the processor is further configured to prompt a user that the removable data storage device is not securely removed and detect a user-triggered instruction to confirm that the removable data storage device is not securely removed before writing the second data stored in the storage medium to the removable data storage device after detecting that the removable data storage device is removed from the terminal device.
In one possible implementation, the processor is further configured to not detect that the removable data storage device is coupled to the terminal device for a second preset duration after prompting the user that the removable data storage device is not securely removed; and deleting the second data from the storage space, or moving the second data from the volatile storage medium to a permanent storage medium when the storage medium corresponding to the preset storage space is the volatile storage medium.
In one possible implementation, the processor is further configured to, within a third preset duration after prompting the user that the removable data storage device is not securely removed, not detect that the removable data storage device is coupled to the terminal equipment, and again prompt the user that the removable data storage device is not securely removed.
In a possible implementation manner, the processor is specifically configured to prompt the user that the removable data storage device is not safely removed through a display interface of the display, or prompt the user that the removable data storage device is not safely removed through the speaker when prompting the user that the removable data storage device is not safely removed.
According to the embodiment of the application, in the process of writing data into the removable data storage device, when the removable data storage device is detected to be accidentally removed, the unwritten part is stored into the preset storage medium, so that when the removable data storage device is detected to be coupled to the terminal equipment again, the unwritten part is continuously written into the removable data storage device, and therefore the integrity of the data is guaranteed to a certain extent and the data is prevented from being damaged.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application 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 application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. 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.
It will be apparent to those skilled in the art that various changes and modifications may be made in the embodiments of the present application without departing from the scope of the embodiments of the present application. Thus, if such modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to encompass such modifications and variations.

Claims (10)

1. A data processing method, comprising:
when the removable data storage device is detected to be removed from the terminal equipment in the process of writing first data on the terminal equipment into a removable data storage device coupled with the terminal equipment, storing second data, which are not written into the removable data storage device, in a preset storage medium of the terminal equipment, wherein the preset storage medium is a non-permanent storage medium;
and after prompting the user that the removable data storage device is not safely removed, writing second data stored in the storage medium into the removable data storage device when the removable data storage device is detected to be coupled to the terminal equipment again.
2. The method of claim 1, wherein prior to writing the second data stored in the storage medium to the removable data storage device, the method further comprises:
determining that the removable data storage device is detected to be coupled to the terminal device again within a first preset time period after the removable data storage device is detected to be removed from the terminal device; or,
and determining that the opportunity for detecting that the removable data storage device is coupled to the terminal equipment again is within a second preset time length after the removable data storage device is not safely removed when the removable data storage device is detected to be removed from the terminal equipment.
3. The method of claim 2, wherein the method further comprises:
not detecting that the removable data storage device is coupled to the terminal device for a second predetermined duration after prompting the user that the removable data storage device is not securely removed;
and deleting the second data from the storage medium, or when the storage medium is a volatile storage medium, moving the second data from the volatile storage medium to a permanent storage medium.
4. The method of claim 2, wherein the method further comprises:
and within a third preset time period after prompting the user that the removable data storage device is not safely removed, not detecting that the removable data storage device is coupled to the terminal equipment, and prompting the user that the removable data storage device is not safely removed again.
5. A data processing apparatus, wherein the apparatus is applied to a terminal device, and comprises:
a communication interface, a processor, and a memory;
the communication interface for coupling the removable data storage device with the terminal device;
the memory is used for storing first data;
the processor is used for storing second data which is not written into the removable data storage device in the first data in a preset storage space of the memory when the removable data storage device is detected to be removed from the terminal equipment in the process of writing the first data stored in the memory into the removable data storage device, wherein the preset storage space belongs to a non-permanent storage medium; and after prompting the user that the removable data storage device is not safely removed, writing second data stored in the preset storage space into the removable data storage device when detecting that the removable data storage device is coupled to the terminal equipment again.
6. The apparatus of claim 5, wherein the memory comprises a first storage medium to store the first data and a second storage medium;
the processor, when storing second data, which has not been written into the removable data storage device, in the first data in a preset storage space of the memory, is specifically configured to store the second data in the preset storage space of the second storage medium.
7. The apparatus of claim 5 or 6, wherein the processor is further configured to determine, prior to writing the second data stored in the storage medium to the removable data storage device, that the removable data storage device is detected to be coupled to the terminal device again within a first predetermined time period after detecting that the removable data storage device is removed from the terminal device; or, when the time for detecting that the removable data storage device is coupled to the terminal device again is determined as detecting that the removable data storage device is removed from the terminal device, prompting a user that the removable data storage device is not safely removed within a second preset time period.
8. The apparatus of claim 7, wherein the processor is further configured to not detect that the removable data storage device is coupled to the terminal device for a second predetermined length of time after prompting a user that the removable data storage device is not securely removed;
and deleting the second data from the storage space, or moving the second data from the volatile storage medium to a permanent storage medium when the storage medium corresponding to the preset storage space is the volatile storage medium.
9. The apparatus of claim 7, wherein the processor is further configured to not detect the removable data storage device being coupled to the terminal device for a third predetermined length of time after prompting the user that the removable data storage device has not been securely removed, and to again prompt the user that the removable data storage device has not been securely removed.
10. The apparatus of claim 5 or 6, wherein the apparatus further comprises a display or a speaker;
the processor is specifically configured to prompt the user that the removable data storage device is not safely removed through a display interface of the display, or prompt the user that the removable data storage device is not safely removed through the speaker, when prompting the user that the removable data storage device is not safely removed.
CN201780012551.1A 2017-03-13 2017-05-27 Data processing method and device Active CN109074301B (en)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
CN201710147617 2017-03-13
CN201710147617X 2017-03-13
PCT/CN2017/086277 WO2018166072A1 (en) 2017-03-13 2017-05-27 Method and device for data processing

Publications (2)

Publication Number Publication Date
CN109074301A CN109074301A (en) 2018-12-21
CN109074301B true CN109074301B (en) 2021-10-08

Family

ID=63521688

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201780012551.1A Active CN109074301B (en) 2017-03-13 2017-05-27 Data processing method and device

Country Status (2)

Country Link
CN (1) CN109074301B (en)
WO (1) WO2018166072A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101604547A (en) * 2009-07-07 2009-12-16 中兴通讯股份有限公司 A kind of disk array hot-swap data Write-protect system and method
CN102750202A (en) * 2012-06-06 2012-10-24 宇龙计算机通信科技(深圳)有限公司 Data protection method and device
CN102866964A (en) * 2012-09-18 2013-01-09 北京奇虎科技有限公司 Method and device for protecting data on storage equipment
CN103577124A (en) * 2013-11-15 2014-02-12 华为终端有限公司 Method and device for prompting read-write state of external storage equipment
CN104346241A (en) * 2013-08-07 2015-02-11 希捷科技有限公司 Torn write mitigation
CN105138280A (en) * 2015-07-31 2015-12-09 成都华为技术有限公司 Data write-in method, apparatus and system

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5734894A (en) * 1995-04-25 1998-03-31 Honeywell Inc. Methods and apparatus for protecting the integrity of process data stored on a removable storage medium
JP4078010B2 (en) * 2000-03-03 2008-04-23 株式会社日立グローバルストレージテクノロジーズ Magnetic disk apparatus and information recording method
JP2006115095A (en) * 2004-10-13 2006-04-27 Kyocera Mita Corp Image forming apparatus and computer-readable storage medium
JP4881856B2 (en) * 2005-03-28 2012-02-22 パナソニック株式会社 Storage device
JP4419989B2 (en) * 2005-08-19 2010-02-24 セイコーエプソン株式会社 DATA PROCESSING DEVICE, DATA PROCESSING METHOD, CONTROL PROGRAM, AND RECORDING MEDIUM CONTAINING THE PROGRAM
CN101458672B (en) * 2007-12-10 2011-08-24 联想(北京)有限公司 Hot plug equipment, computer and data-transmission indicating method
CN101566992A (en) * 2008-04-24 2009-10-28 扬智科技股份有限公司 System and method for data storage
US7937529B2 (en) * 2008-06-23 2011-05-03 International Business Machines Corporation Detection of frequent improper removals of and changing writing policies to prevent data loss in memory sticks
KR20110039416A (en) * 2008-07-22 2011-04-18 엘에스아이 코포레이션 Data storage method, apparatus and system for interrupted write recovery
CN102087623A (en) * 2010-12-02 2011-06-08 东方口岸科技有限公司 Data protection method during power-fail of special USB (Universal Serial Bus) storage equipment in data updating
US8527693B2 (en) * 2010-12-13 2013-09-03 Fusion IO, Inc. Apparatus, system, and method for auto-commit memory
US9003103B2 (en) * 2011-09-12 2015-04-07 Microsoft Technology Licensing, Llc Nonvolatile media dirty region tracking
CN104699413B (en) * 2013-12-09 2019-02-22 群联电子股份有限公司 Data managing method, memory storage apparatus and memorizer control circuit unit
CN105700971A (en) * 2014-11-28 2016-06-22 东莞宇龙通信科技有限公司 Data backup method and device
CN104503703B (en) * 2014-12-16 2018-06-05 华为技术有限公司 The treating method and apparatus of caching
US9858078B2 (en) * 2015-06-02 2018-01-02 International Business Machines Corporation Speculative load data in byte-write capable register file and history buffer for a multi-slice microprocessor

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101604547A (en) * 2009-07-07 2009-12-16 中兴通讯股份有限公司 A kind of disk array hot-swap data Write-protect system and method
CN102750202A (en) * 2012-06-06 2012-10-24 宇龙计算机通信科技(深圳)有限公司 Data protection method and device
CN102866964A (en) * 2012-09-18 2013-01-09 北京奇虎科技有限公司 Method and device for protecting data on storage equipment
CN104346241A (en) * 2013-08-07 2015-02-11 希捷科技有限公司 Torn write mitigation
CN103577124A (en) * 2013-11-15 2014-02-12 华为终端有限公司 Method and device for prompting read-write state of external storage equipment
CN105138280A (en) * 2015-07-31 2015-12-09 成都华为技术有限公司 Data write-in method, apparatus and system

Also Published As

Publication number Publication date
WO2018166072A1 (en) 2018-09-20
CN109074301A (en) 2018-12-21

Similar Documents

Publication Publication Date Title
US11556241B2 (en) Apparatus and method of copying and pasting content in a computing device
CN102375597B (en) Signal conditioning package and information processing method
CN104536848B (en) Firmware restoration method, apparatus and terminal
CN105094903A (en) Method and device for upgrading firmware
CN109446832B (en) Screen capturing method and device
CN105574388A (en) Touch screen terminal based unlocking method and apparatus and touch screen terminal
US11941910B2 (en) User interface display method of terminal, and terminal
CN105117137A (en) Photographing method and device used in terminal standby state and mobile terminal
CN106445362A (en) Application control method and device, and terminal equipment
KR102337157B1 (en) Electronic blackboard apparatus and the controlling method thereof
CN106776908B (en) Data cleaning method and device and terminal
CN104395873A (en) Apparatus including a touch screen and screen change method thereof
CN105224207A (en) A kind of end application is every empty control method and mobile terminal
US20120287063A1 (en) System and method for selecting objects of electronic device
CN105187654A (en) Recording method and apparatus when terminal is under the standby state
CN105117135A (en) Photographing method and device used in terminal standby state
CN104503786A (en) Method and device for refreshing firmware
CN104898818A (en) Information processing method and electronic equipment
CN109074301B (en) Data processing method and device
US11175821B2 (en) Pressure touch method and terminal
US9904322B2 (en) Mass storage device
US9753933B2 (en) Electronic device and method for mounting file system using virtual block device
CN105446835A (en) Method and device for repairing system file
CN105404454A (en) Notification processing method and notification processing device
CN105095026A (en) Superblock repair method and apparatus for EXT file system and intelligent device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20210428

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Applicant after: Honor Device Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Applicant before: HUAWEI TECHNOLOGIES Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant