CN108062281B - Method for solving disconnection of data copying between mass storage device and PC terminal - Google Patents

Method for solving disconnection of data copying between mass storage device and PC terminal Download PDF

Info

Publication number
CN108062281B
CN108062281B CN201711083137.8A CN201711083137A CN108062281B CN 108062281 B CN108062281 B CN 108062281B CN 201711083137 A CN201711083137 A CN 201711083137A CN 108062281 B CN108062281 B CN 108062281B
Authority
CN
China
Prior art keywords
storage device
data
mass storage
timer
disconnection
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
CN201711083137.8A
Other languages
Chinese (zh)
Other versions
CN108062281A (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.)
Zhuhai Vyagoo Technology Co ltd
Original Assignee
Zhuhai Vyagoo Technology 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 Zhuhai Vyagoo Technology Co ltd filed Critical Zhuhai Vyagoo Technology Co ltd
Priority to CN201711083137.8A priority Critical patent/CN108062281B/en
Publication of CN108062281A publication Critical patent/CN108062281A/en
Application granted granted Critical
Publication of CN108062281B publication Critical patent/CN108062281B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/22Handling requests for interconnection or transfer for access to input/output bus using successive scanning, e.g. polling

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The technical scheme of the invention comprises a method for solving the problem of disconnection of data copying between a mass storage device and a PC terminal, which comprises the following steps: when the mass storage device and the PC terminal copy data, a timer is established in the storage device; when the time for processing the PC end command by the equipment end does not exceed the disconnection threshold value of the PC end, directly sending the CSW, and if the time exceeds the disconnection threshold value, replying the CSW by using a timer; and resetting the timer after the completion of the reply, and receiving the subsequent operation instruction of the PC terminal. The invention has the beneficial effects that: under the condition of not modifying the existing data writing mechanism of the equipment end, the disconnection caused by data writing can be effectively avoided, and the integrity of data can be ensured.

Description

Method for solving disconnection of data copying between mass storage device and PC terminal
Technical Field
The invention relates to a method for solving the problem of broken lines in data copying between a mass storage device and a PC (personal computer), belonging to the field of computer data interaction processing.
Background
Many mobile devices, especially some multimedia playing devices, need to be connected to a PC for data transmission, which is a common function, after the devices are connected to the PC through a USB cable, a mobile disk is popped up from the PC, and after the disk is opened, files on the PC can be copied to the device side for use.
The prior art scheme is as follows: in the prior art, data reading and writing are generally completed according to a Bulk-Only protocol, in this way, all commands are encapsulated in a CBW for transmission, a device end receives the CBW and then resolves the commands, and then executes corresponding commands, for example, if a command of write operation is received, data is written into a designated storage, and after the command is executed, the CSW is returned, and after receiving the CSW, the PC continues to send the CBW to execute the next command. After sending the CBW, the PC waits for the return of the CSW, and after a certain time, the PC considers that the communication is abnormal, and resets the device. That is, the processing time of the device is required, and many mass storage devices are disconnected when being connected to a PC for data copying, which results in data writing failure and the connection must be reestablished.
The prior art has the defects that CSW is returned to a PC after the write operation is finished, the write time of each stroke is different, a plurality of current mobile operating systems have read-write data cache, data are written into the cache firstly and then written back to equipment for storage, the write operation return time is relatively fast, but when the number of dirty pages of the system reaches a certain threshold value, the write-back storage operation is triggered, and the time required by the write operation is relatively long under the condition. For the PC, if the time waiting for CSW is long, about 9 seconds, the PC does not receive CSW yet, and sends a reset signal to the device. At this time, the situation that copying is not completed normally and the PC end prompts failure of disk writing is easy to occur.
Bulk-Only: USB organizations have developed a block storage class protocol for mass storage devices.
Command Block Wrapper (CBW): a data packet containing command blocks and associated information.
Command Status Wrapper (CSW): a data packet containing the status of the execution of the command block.
Disclosure of Invention
Aiming at the defects in the prior art, the technical scheme of the invention provides a method for solving the problem of disconnection in data copying between a mass storage device and a PC (personal computer) terminal, which is used for solving the defects in the prior art.
The technical scheme of the invention comprises a method for solving the problem of disconnection of data copying between a mass storage device and a PC terminal, and is characterized in that the method comprises the following steps: s1, when the mass storage device and the PC terminal copy data, a timer is established in the storage device; s2, when the time of the PC end command processing by the equipment end does not exceed the disconnection threshold value of the PC end, directly sending the CSW, and if the time exceeds the disconnection threshold value, replying the CSW by using a timer; and S3, clearing the timer after the completion of the reply, and receiving the subsequent operation instruction of the PC terminal.
According to the method for solving the problem of disconnection in data copying between the mass storage device and the PC, step S1 further includes: the data copying sizes of the equipment end and the PC end are detected, if the data to be copied exceed a specified threshold value, a corresponding timer is established for the equipment end, the timing time is set, and the timer needs to be initialized when a command is received.
According to the method for solving the problem that the data copying between the mass storage device and the PC terminal is broken, the device terminal initializes the timer after receiving the CBW sent by the PC terminal.
According to the method for solving the problem that the data copying between the mass storage device and the PC terminal is broken, the timing time does not exceed the broken line threshold value of the PC terminal.
According to the method for solving the problem that the data copying between the mass storage device and the PC end is broken, the broken line threshold value of the PC end is set to be 8-10 s, 8s is compatibility setting, and 9-10 s is general setting.
According to the method for solving the problem of disconnection in data copying between the mass storage device and the PC, step S2 further includes: and the equipment side analyzes the command in the CBW and further executes the corresponding command, if the time of the executed command does not exceed the disconnection threshold value of the PC side, the CSW is replied, and if the time of the executed command exceeds the disconnection threshold value of the PC side, the action of replying the CSW is executed by using a callback function in a timer.
According to the method for solving the problem of disconnection in data copying between the mass storage device and the PC, step S3 further includes: and after the CSW is replied, clearing the timer and continuously receiving the next command of the PC side processed by the CBW.
The method for solving the problem of disconnection of the data copy between the mass storage device and the PC terminal is characterized by further comprising the following steps: the data copying between the mass storage device and the PC terminal refers to transmitting the storage data of the mass storage device to the PC terminal through a data connection line, and may also refer to storing the data suitable for the mass storage device to store in the PC terminal to the mass storage device through the data connection line.
The invention has the beneficial effects that: under the condition of not modifying the existing data writing mechanism of the equipment end, the disconnection caused by data writing can be effectively avoided, and the integrity of data can be ensured.
Drawings
FIG. 1 shows a general flow diagram according to an embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments. The method for solving the problem of disconnection of the data copying between the mass storage device and the PC terminal is suitable for the data copying between the mass storage device and the PC terminal.
Fig. 1 is a general structural view illustrating an embodiment according to the present invention.
(1) When the device enters a mass storage mode, a timer is newly established.
(2) And when the equipment end receives the CBW, initializing the timer, and setting the timing time of the timer at 8 seconds.
(3) The device terminal parses the command, and then executes the corresponding command, for example, the write data calls a write file interface of the system, and then waits for the return.
(4) After the device executes the command, the CSW is replied, and the timer is cleared.
(5) If the timing of 8 seconds is up during the execution of the command, indicating that the CSW can not return in time, the device executes the action of replying to the CSW in the callback function of the timer.
(6) And resetting the timer after the CSW is recovered.
(7) The next command for CBW to process the PC continues to be received.
The above description is only a preferred embodiment of the present invention, and the present invention is not limited to the above embodiment, and the present invention shall fall within the protection scope of the present invention as long as the technical effects of the present invention are achieved by the same means. The invention is capable of other modifications and variations in its technical solution and/or its implementation, within the scope of protection of the invention.

Claims (8)

1. A method for solving the problem of disconnection of data copying between a mass storage device and a PC (personal computer) terminal is characterized by comprising the following steps:
s1, when the mass storage device and the PC terminal copy data, a timer is established in the storage device;
s2, when the time of the PC end command processing by the equipment end does not exceed the disconnection threshold value of the PC end, directly sending the CSW, and if the time exceeds the disconnection threshold value, replying the CSW by using a timer;
and S3, clearing the timer after the completion of the reply, and receiving the subsequent operation instruction of the PC terminal.
2. The method according to claim 1, wherein the step S1 further includes:
the data copying sizes of the equipment end and the PC end are detected, if the data to be copied exceed a specified threshold value, a corresponding timer is established for the equipment end, the timing time is set, and the timer needs to be initialized when a command is received.
3. The method as claimed in claim 2, wherein the timer is initialized when the device receives the CBW from the PC.
4. The method as claimed in claim 2, wherein the timing time does not exceed the disconnection threshold of the PC.
5. The method for solving the problem of disconnection of data copy between mass storage device and PC according to claim 4, wherein the disconnection threshold of PC is set to 8-10 s, where 8s is compatibility setting and 9-10 s is general setting.
6. The method according to claim 1, wherein the step S2 further includes:
and the equipment side analyzes the command in the CBW and further executes the corresponding command, if the time of the executed command does not exceed the disconnection threshold value of the PC side, the CSW is replied, and if the time of the executed command exceeds the disconnection threshold value of the PC side, the action of replying the CSW is executed by using a callback function in a timer.
7. The method according to claim 1, wherein the step S3 further includes:
and after the CSW is replied, clearing the timer and continuously receiving the next command of the PC side processed by the CBW.
8. The method for solving the problem of disconnection of the data copy between the mass storage device and the PC side according to any one of claims 1 to 7, wherein the method further comprises:
the data copying between the mass storage device and the PC terminal refers to transmitting the storage data of the mass storage device to the PC terminal through a data connection line, and may also refer to storing the data suitable for the mass storage device to store in the PC terminal to the mass storage device through the data connection line.
CN201711083137.8A 2017-11-07 2017-11-07 Method for solving disconnection of data copying between mass storage device and PC terminal Active CN108062281B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711083137.8A CN108062281B (en) 2017-11-07 2017-11-07 Method for solving disconnection of data copying between mass storage device and PC terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711083137.8A CN108062281B (en) 2017-11-07 2017-11-07 Method for solving disconnection of data copying between mass storage device and PC terminal

Publications (2)

Publication Number Publication Date
CN108062281A CN108062281A (en) 2018-05-22
CN108062281B true CN108062281B (en) 2020-06-30

Family

ID=62135672

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711083137.8A Active CN108062281B (en) 2017-11-07 2017-11-07 Method for solving disconnection of data copying between mass storage device and PC terminal

Country Status (1)

Country Link
CN (1) CN108062281B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116569127A (en) * 2020-12-18 2023-08-08 华为技术有限公司 Link reconstruction method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1385794A (en) * 2001-05-14 2002-12-18 精工爱普生株式会社 Data transmission controller, electronic device and data transmission method
CN1564001A (en) * 2004-04-09 2005-01-12 清华大学 Portable signal generating method and system based on USB mobile memory tech
CN1776588A (en) * 2004-11-16 2006-05-24 富士通株式会社 Information processing system, storage unit,and computer-readable recording medium
CN101303685A (en) * 2007-05-09 2008-11-12 瑞昱半导体股份有限公司 Method for improving read-write data speed of all-purpose sequence bus storage equipment
US9760730B2 (en) * 2015-08-28 2017-09-12 Dell Products L.P. System and method to redirect and unlock software secure disk devices in a high latency environment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1385794A (en) * 2001-05-14 2002-12-18 精工爱普生株式会社 Data transmission controller, electronic device and data transmission method
CN1564001A (en) * 2004-04-09 2005-01-12 清华大学 Portable signal generating method and system based on USB mobile memory tech
CN1776588A (en) * 2004-11-16 2006-05-24 富士通株式会社 Information processing system, storage unit,and computer-readable recording medium
CN101303685A (en) * 2007-05-09 2008-11-12 瑞昱半导体股份有限公司 Method for improving read-write data speed of all-purpose sequence bus storage equipment
US9760730B2 (en) * 2015-08-28 2017-09-12 Dell Products L.P. System and method to redirect and unlock software secure disk devices in a high latency environment

Also Published As

Publication number Publication date
CN108062281A (en) 2018-05-22

Similar Documents

Publication Publication Date Title
CN100481040C (en) Method for implementing real-time hot-plug of USB memory under TV embedded Linux system
CN104838365A (en) Methods and systems for provisioning bootable image on to external drive
CN108989432B (en) User-mode file sending method, user-mode file receiving method and user-mode file receiving and sending device
CN111444030B (en) Data storage device and method for avoiding firmware failure
CN103095686A (en) Hot metadata access control method and server
CN112825011A (en) Power-on and power-off control method and system of PCIe device
CN108572830A (en) Upgrade method, the system of a kind of embedded system and its bootstrap
CN108062281B (en) Method for solving disconnection of data copying between mass storage device and PC terminal
CN111240879B (en) SAS card firmware log collection method, system, device and storage medium
CN104460406A (en) Single-line communication method and single chip microcomputer firmware updating method based on single-line communication
CN111143898B (en) Data protection method for pluggable memory device
CN105573872B (en) The HD management method and apparatus of data-storage system
US8266330B2 (en) Method and controller for processing commands in a storage device
CN102722430B (en) Method and device for detecting hot plug of secure digital card
US20110016233A1 (en) System, method, and computer program product for inserting a gap in information sent from a drive to a host device
CN110018792B (en) Method and device for processing data to be landed, electronic equipment and storage medium
US20110208923A1 (en) Storage method and system, terminal service board, control board and storage channel board
US10409748B2 (en) Bridge device with DMA data transferring to upstream device with reset and clear feature command
CN100458724C (en) Test platform and method for testing embedded file system and protocol
CN114615527A (en) Hot-plug equipment information transmission method, computer equipment and readable medium
CN112527719B (en) PCIe link-based JBOF (just-in-File) connection method, device and system
CN104778101A (en) Mobile terminal system backup and recovery method, mobile terminal, computer and system
CN109542523B (en) Remote U disk using method and device
CN103399949B (en) A kind of database storage block state control method and device
US20140325174A1 (en) Access control apparatus, access control method, and computer program product

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
GR01 Patent grant
GR01 Patent grant