CN103034561A - Command transmission method and relevant device for universal serial bus (USB) - Google Patents

Command transmission method and relevant device for universal serial bus (USB) Download PDF

Info

Publication number
CN103034561A
CN103034561A CN2011102964811A CN201110296481A CN103034561A CN 103034561 A CN103034561 A CN 103034561A CN 2011102964811 A CN2011102964811 A CN 2011102964811A CN 201110296481 A CN201110296481 A CN 201110296481A CN 103034561 A CN103034561 A CN 103034561A
Authority
CN
China
Prior art keywords
slave computer
order bag
command
computer
order
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.)
Granted
Application number
CN2011102964811A
Other languages
Chinese (zh)
Other versions
CN103034561B (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.)
Spreadtrum Communications Shanghai Co Ltd
Original Assignee
Chongqing Cyit Communication Technologies 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 Chongqing Cyit Communication Technologies Co Ltd filed Critical Chongqing Cyit Communication Technologies Co Ltd
Priority to CN201110296481.1A priority Critical patent/CN103034561B/en
Publication of CN103034561A publication Critical patent/CN103034561A/en
Application granted granted Critical
Publication of CN103034561B publication Critical patent/CN103034561B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The invention discloses a command transmission method and a relevant device for a universal serial bus (USB). By utilizing the command transmission method and the relevant device for the universal serial bus (USB), when a lower computer does not complete the command from a upper computer in an outrage circumstance, the lower computer is capable of completing the unfinished operation after the electricity is turned on. The command transmission method for the USB includes the following steps. The upper computer sends command packet to a first lower computer. At preset intervals, the upper computer reads the command interaction area of the first lower computer, and if the reading fails, an interruption log is generated and saved. The interruption log comprises an identity label of the first lower computer and a label of the first command packet. If access of a second lower computer is detected, the identity label of the second lower computer is identified. If an interruption log of the identity label of the second lower computer is saved, the second lower computer is activated to continue the operating execution of the second command packet marked in the interruption log corresponding to the second lower computer.

Description

Command transfer method and the relevant apparatus of USB (universal serial bus)
Technical field
The present invention relates to field of data transmission, relate in particular to a kind of command transfer method and relevant apparatus of USB (universal serial bus).
Background technology
Traditional common universal serial bus (USB, Universal Serial BUS Mass Storage) equipment of mass storage (Mass Storage) is commonly called as USB flash disk, it is plug-and-play apparatus, use existing " standard " device driver, namely can be used for system's row so need not to install any device drives.When operating system is checked through the USB device and inserts, will automatically inquire this device correlation parameter understanding its ability and requirement, and automatically suitable driver is loaded in the operating system that the user just can normally use this equipment.When the USB interface to the USB device from computing machine was transferred to, the operating system of computing machine will automatically stop the use of this equipment and unload its driver.The USB device is sold with the software (firmware) of its storage inside, be used for the operation of control data storage ends (being slave computer), the general standard driver of its general employing, relevant criterion orders such as reading, write, wipe that only computer terminal (being host computer) is issued responds.
In the prior art, proposed a kind ofly will order bag and the packet of the corresponding execution of this order etc. to be packaged into the mode that generic USB reads and writes data to pass to slave computer, and slave computer is after having received packet, unpack by stipulated form, the order bag and the data message that take out are wherein carried out, execution result for slave computer, also be to write a reading order by host computer, thus slave computer just can with last time command execution the packet that namely responds of result return to the implementation that host computer has been realized whole order.
The way that prior art sends explosion command by packet has realized the function by the order of standard USB device transmitting extended, but, the interactive relation of replying between host computer and the slave computer can not be correctly complete in the situation of slave computer dial-out, accident power-off, whole command execution process can be interrupted, and is unfavorable for the reliability of command execution.And slave computer itself is just supported hot plug, the possibility that exists the user not according to the normal running flow process slave computer to be transferred to, and a lot of key orders, as: if incorrect complete just by user's accident power-off of the operations such as user cipher device data, USB flash disk firmware upgrade in the format, deletion USB flash disk then may cause user's loss of data.
Summary of the invention
The embodiment of the invention provides a kind of command transfer method and relevant apparatus of USB (universal serial bus), is used for still can continuing to carry out not complete operation after powering on next time in the situation of cutting off the power supply in the not complete host computer order of slave computer.
The command transfer method of USB (universal serial bus) provided by the invention comprises: host computer sends the first order bag to the first slave computer, so that described the first order bag is stored and carried out to described the first slave computer; Described host computer is every the command interaction district of presetting duration and reading described the first slave computer, if describedly read failure, then generate and store the operation disruption daily record, described operation disruption daily record comprises: the sign of the identify label of described the first slave computer and described the first order bag; If described upper computer detection is to the access of the second slave computer is arranged, then identify the identify label of described the second slave computer, if described host computer has operation disruption daily record corresponding to the identify label of described the second slave computer, then trigger the operation that described the second slave computer continues to carry out the second order bag of mark in operation disruption daily record corresponding to described the second slave computer.
The command transfer method of USB (universal serial bus) provided by the invention comprises: slave computer receives the order bag that host computer sends; Described slave computer deposits described order bag the command interaction district of described slave computer in, and carries out corresponding operation according to described order bag; If before the operation of described order bag is finished, again access after the connection breaking in described slave computer and the described host computer, then described slave computer receives the triggering command of described host computer, and continues to carry out the operation of described order bag according to described triggering command; Or described slave computer detects the described order bag of described command interaction district storage, and carries out the operation of described order bag.
The command transfer device of USB (universal serial bus) provided by the invention comprises: command sending unit is used for sending the first order bag to the first slave computer, so that described the first order bag is stored and carried out to described the first slave computer; Monitoring unit is used for the command interaction district that reads described the first slave computer every presetting duration, if describedly read failure, then triggers and interrupts the daily record generation unit; Interrupt the daily record generation unit, be used for generating and storing the operation disruption daily record, described operation disruption daily record comprises: the sign of the identify label of described the first slave computer and described the first order bag; Marking matched unit is used for identifying the identify label of described the second slave computer when having detected the access of the second slave computer, if described host computer has operation disruption daily record corresponding to the identify label of described the second slave computer, then triggers continuous performance element; Continuous performance element is used for triggering described the second slave computer and continues to carry out the operation that second of operation disruption daily record mark corresponding to described the second slave computer ordered bag.The command transfer device of USB (universal serial bus) provided by the invention comprises: the order receiving element is used for receiving the order bag that host computer sends; The command interaction district is used for storing described order bag; Command executing unit is used for carrying out corresponding operation according to the indication of described order bag; The command reception unit if be used for before the operation of described order bag is finished, with again access after the connection breaking in the described host computer, then receive the triggering command of described host computer, and triggers described command executing unit and continue complete operation.Detecting unit for detection of the described order bag of described command interaction district storage, and triggers described command executing unit and continues complete operation.
As can be seen from the above technical solutions, the embodiment of the invention has the following advantages: host computer of the present invention is after the command interaction district failure of reading slave computer, confirm to disconnect with slave computer, at this moment, can generate and store the operation disruption daily record, so that this slave computer when again being connected with host computer, can continue to finish in this operation disruption daily record for the operation of order bag.
Description of drawings
Fig. 1 is a schematic flow sheet of the command transfer method of embodiment of the invention USB (universal serial bus);
Fig. 2 is another schematic flow sheet of the command transfer method of embodiment of the invention USB (universal serial bus);
Fig. 3 is another schematic flow sheet of the command transfer method of embodiment of the invention USB (universal serial bus);
Fig. 4 is a structural representation of the command transfer device of embodiment of the invention USB (universal serial bus);
Fig. 5 is another structural representation of the command transfer device of embodiment of the invention USB (universal serial bus).
Embodiment
The embodiment of the invention provides a kind of command transfer method and relevant apparatus of USB (universal serial bus), is used for still can continuing to carry out not complete operation after powering on next time in the situation of cutting off the power supply in the not complete host computer order of slave computer.
See also Fig. 1, an embodiment of the command transfer method of USB (universal serial bus) comprises in the embodiment of the invention:
101, host computer sends the first order bag to the first slave computer;
Host computer is with after slave computer is connected, and host computer sends the first order bag to the first slave computer, so that the first slave computer storage and carry out the first order bag.
The operational order that order bag issues to slave computer for host computer, concrete operations can comprise: format (or deletion) data, software upgrading and reading and writing data.
Host computer all is encapsulated into USB standard data writing packet format (order bag and packet are as the data division of USB standard data writing bag) to order bag and the packet that slave computer sends, concrete, order bag writing address is the command interaction district of slave computer, and the writing address of packet is the data interaction district.
Above-mentioned the first slave computer is after receiving this first order bag, wrap to the first order in the storage of the command interaction district of the first slave computer, and then carry out this first order and wrap indicated operation, after the indicated operation of the first order bag is finished, this the first order bag can be replaced by the respond packet of finishing of the first order bag correspondence, finishes with the indicated operation of notice host computer the first order bag.
In embodiments of the present invention, the operation of host computer can be finished by terminal, and slave computer then can be the bulk data storage device of USB or the USB device of other supports USB normal response mode.
102, host computer is every the command interaction district of presetting duration and reading the first slave computer;
Host computer is every the command interaction district of presetting duration and reading the first slave computer, this is that host computer is to the Mission Monitor operation of slave computer, when reading above-mentioned the first order bag of being still of this command interaction district storage, illustrate that then the first slave computer is also in the indicated operation of execution the first order bag; When read the storage of this command interaction district be above-mentioned the first order bag corresponding finish respond packet the time, illustrate that then the first slave computer finished the indicated operation of the first order bag; When reading unsuccessfully, illustrate that then host computer and slave computer disconnect.
If host computer can't read the command interaction district of the first slave computer, then trigger step 103.
103, read failure, host computer generates and stores the operation disruption daily record;
Before the indicated operation of above-mentioned the first order bag is not finished, when host computer is confirmed to disconnect with slave computer, then host computer can generate the operation disruption daily record corresponding with this first order bag, is marked with the identify label of the first slave computer and the sign of the first order bag in this operation disruption daily record.
104, host computer is identified the identify label of the second slave computer;
When host computer newly has access to the second slave computer, then can identify first the identify label of this second slave computer, if store operation disruption daily record corresponding to the identify label of this second slave computer in the host computer, then trigger step 105.
Need to prove, the difference of the first slave computer and the second slave computer is to access the sequencing of host computer, namely distinguish this first slave computer and the second slave computer from turn-on time, the first slave computer is linked into first on this host computer than the second slave computer, and the first slave computer and the second slave computer might be the slave computer of same section.
105, host computer triggers the second slave computer continuation executable operations.
After host computer confirmed that the second slave computer of new access has uncompleted order bag, host computer triggered the operation that the second slave computer continues to carry out the second order bag of mark in operation disruption daily record corresponding to the second slave computer.Concrete, host computer can trigger by the mode that sends instructions down the second slave computer and continue executable operations, and detailed reciprocal process can be described in follow-up embodiment.
In actual applications, complete operation of slave computer might appear, and the situation that host computer fails in time to know, the embodiment of the invention provides corresponding solution, see also Fig. 2, another embodiment of the command transfer method of USB (universal serial bus) comprises in the embodiment of the invention:
201, host computer is identified the identify label of the second slave computer;
When the second slave computer is linked into host computer, host computer can be identified the identify label of this second slave computer, concrete, local operation disruption daily record corresponding to identify label that whether stores this second slave computer of identification, if have, illustrate that then this second slave computer when once accessing, has uncompleted task upper, need to trigger step 202; If no, then host computer can issue new order bag to this second slave computer.
202, host computer reads the command interaction district of the second slave computer;
Host computer reads the command interaction district of the second slave computer, inquires about the second order bag whether this command interaction district stores mark in operation disruption daily record corresponding to the second slave computer.
Concrete, the data-carrier store of slave computer can comprise: command interaction district and data interaction district; The command interaction district is used for the order bag that the storage host computer issues, when this order bag is complete, this order bag can be covered (i.e. order is coated with deletion, and the original memory address of this order bag is wrapped the corresponding respond packet of finishing for storage and this order) by the newly-generated respond packet of finishing; The data interaction district is used for packet corresponding to memory command bag or finishes response data corresponding to respond packet.
If the mentioned order interactive areas stores this second order bag, illustrate that then operation corresponding to the second order bag that last host computer indicates this second slave computer to carry out not yet finish, need to trigger step 203; If the mentioned order interactive areas stores the respond packet of finishing of this second order bag correspondence, illustrate that then the second slave computer finished the indicated operation of the second order bag, just host computer does not have enough time to read this and finishes respond packet and just disconnected with the second slave computer, at this moment, host computer can read this and finish respond packet, and the response data of obtaining the second order bag finishes the execution flow process of the second order bag to upgrade the related data of host computer this locality.
Optionally, if the mentioned order interactive areas stores the respond packet of finishing of this second order bag correspondence, further, obtain finish respond packet and response data after, host computer can detect first whether described to finish respond packet correct, if correct, then finishes the operating process of described the second order bag; If incorrect, then trigger step 205 and again send the second order bag to described the second slave computer.
203, host computer judges whether order bag and the data message of the storage of the second slave computer be correct;
Whether host computer is checked the second slave computer consistent with the second order bag of the local storage of host computer at the order bag of command interaction district storage, and check the second slave computer when indicated operation is wrapped in this second order of execution, check the data of storing in the data interaction district whether with the data cached coupling of host computer this locality, if coupling, then execution in step 204; If inconsistent, illustrate that then data transfer makes a mistake in the process that disconnects, need host computer to trigger step 205 and again issue this second order bag, so that the second slave computer re-executes the operation of this second order bag.
204, whether the host computer prompting user continues to carry out the operation of the second order bag;
Whether the host computer prompting user continues to carry out the operation of the second order bag, concrete, and host computer is to user's display reminding window, and whether prompting continues to carry out the operation of the second order bag, if user selection is then to trigger step 206; If user selection is no, then host computer can be deleted the related data corresponding to the second order bag of local storage, and indicates related data corresponding to described the second host computer deletion the second order bag.
Need to prove, to the optional step that is operating as of user prompting, in actual applications, confirm the order bag of the second slave computer storage and after data message wraps with the second order and data message is complementary, can directly trigger step 206 at host computer.
205, host computer issues the second order bag again;
Host computer issues above-mentioned the second order bag again, so that the second slave computer re-executes the operation of this second order bag.
206, host computer sends triggering command to the second slave computer.
Host computer sends triggering command to the second slave computer, so that this second slave computer continues to carry out the indicated operation of above-mentioned the second order bag.
Concrete, if the order bag that this second order bag writes for data then includes actuating code, command execution start address and command execution length in this second order bag; This actuating code is used for the current order of mark; This command execution start address is used to indicate the second slave computer and specifically which address begins executable operations in; This command execution length is used for carrying out the data length of this order.
The above is described from the angle of the host computer command transfer method to the USB (universal serial bus) the embodiment of the invention, the below is described again from the angle of slave computer, see also Fig. 3, another embodiment of the command transfer method of USB (universal serial bus) comprises in the embodiment of the invention:
301, slave computer receives the order bag that host computer sends;
Slave computer receives the order bag that host computer sends, and the command interaction district that deposits slave computer in is wrapped in this order, and carries out corresponding the operation according to the order bag.
Concrete, behind the order bag that gets access to the host computer transmission, confirming to load data in order bag and the effective situation of packet, and carry out this command execution code respective operations, and execution result (respond packet and response data) write in the assigned address, thereby the implementation of a complete order bag.
302, again access after slave computer and host computer disconnect;
If before the operation of mentioned order bag is finished, the indication of host computer is then waited in again access after the connection breaking in slave computer and the host computer, or triggers step 304.
303, slave computer receives the triggering command that host computer sends;
After host computer confirms that the buffered data of the command interaction district of slave computer and order bag that the data interaction district stores and data and host computer is complementary, slave computer can receive the triggering command that host computer sends, and slave computer can trigger step 306 according to this triggering command.
304, slave computer sense command interactive areas;
Slave computer detects local command interaction district, and when detecting this locality and store uncompleted order bag, then slave computer can trigger step 306 automatically.
305, slave computer receives the order bag that host computer sends again;
Optional according to actual conditions, if upper computer detection is not mated to the order bag of storing in the appointed area of slave computer and the buffered data of data and host computer, then can again send the above-mentioned order bag that does not execute to slave computer; And after slave computer receives this order bag again, trigger step 306, re-execute this order and wrap performed operation.
306, the indicated operation of slave computer fill order bag;
Slave computer is carried out the indicated operation of mentioned order bag; Concrete, if the order bag that this second order bag writes for data, then this order bag specifically can comprise: actuating code, command execution start address and command execution length; Slave computer is according to described actuating code, command execution start address and command execution length fill order.
Optionally, if the indicated action need of the second order bag writes data to slave computer, and the situation of the new order bag of losing one's life of attaching most importance to, then host computer arrives the data interaction district with Packet Generation first, send again this second order bag, slave computer according to the second order bag from data interaction district reading out data and write executive address and the length position that limit of this order wrapping.
307, slave computer generates and finishes respond packet.
Slave computer after finishing the indicated operation of this order bag, slave computer can generate this order bag corresponding finish respond packet, and use this to finish respond packet to cover this order and wrap.
Optionally, need slave computer feedback corresponding data if corresponding order is wrapped in described order, then be used to complete before respond packet covers described order bag, slave computer is first with corresponding data data writing interactive areas.
For the ease of understanding, the below is described in detail with the command transfer method of a concrete application scenarios to the USB (universal serial bus) described in the above embodiments again, is specially:
One, deletion user data:
The capacity of slave computer is larger, the operation of deletion data is consuming time also to be increased thereupon, when slave computer is received the order bag of the deletion data that host computer sends and is being carried out, if be subjected to unexpected dial-out, outage, deletion action just has been terminated, user's data is not fully deletion still, and the possibility of divulging a secret is arranged; If but after this slave computer powered on again, host computer in the embodiment of the invention can go first to check whether the order bag of storing in the command interaction district of slave computer is effective, if effectively, will trigger slave computer corresponding delete command is resolved and re-executed to the order bag, after this order is correct complete, just this order bag can be replaced with and finish respond packet; Perhaps by whether having the order bag in the slave computer active detecting command interaction district, if exist, slave computer will initiatively re-execute corresponding delete command, to order bag to replace with respond packet after finishing and for normal complete order, because coated the replacing with normally of the order in the command interaction district finished respond packet, the rear upper computer detection that powers on next time is not wrapped for order in the command interaction district, is not successfully completed deletion action last time so can not repeat.
Two, the data write operation of large file:
When the user carries out the write operation of the large small documents of 6G to the slave computer of a 8G (GB), if the explorer directly by Windows carries out, the user has transferred to slave computer when finishing front 5G because of carelessness copying, this document is not just by correct write (even losing this document) in the slave computer, next time, the user write slave computer for correct with this document, just need to again copy the large small documents of this 6G, waste time and energy.And the embodiment of the invention just can take full advantage of the situation that the repetition copy function is avoided in the record case of order bag, and concrete implementation is as follows:
When writing large file by the host computer in the embodiment of the invention to slave computer, upper computer software can be split as a plurality of FLASH data that are not more than data interaction district size according to this large file write operation of large young pathbreaker in the data interaction district of slave computer and write command operation.
When normal flow: with first data data writing interactive areas to be written, again actuating code corresponding to FLASH write operation, this start address that writes, length are assembled into the order bag and are written to the command interaction district first.After slave computer is checked through the command interaction district and has the order bag to write, will after resolving this order bag, be written to the data in data interaction district with designated length in the appointment start address.The execution result that will write at last order writes back the command interaction district with the form of finishing respond packet, and replaces corresponding order bag, writes order thereby finish this secondary data.After upper computer detection writes successfully to current data block, just with next data block data writing interactive areas to be written, and will again be packaged as the order bag to information such as writing address that should data block, length and write the command interaction district, continue next data block and write.More than operation continues to carry out to finish to the equal successful execution of whole command set always, and also namely this large file all successfully is written to slave computer.
When unusual flow process when (as transfering to when slave computer is unexpected), current block write command execution failure, host computer will should be ordered and data according to the identify label buffer memory of slave computer, if again being checked through this slave computer (by identify label identification) inserts, and know the operation that this not complete data writing is arranged, then according to user's facilities, if the user is set to automatically perform uncompleted last time of operation, host computer will be proceeded the transmission of remaining data and needn't re-start the transmission of this 6G file.Concrete implementation is divided into following several situation:
1, the storage of judgement command interaction district and data interaction district is normal command bag and packet, illustrate that the order that power down writes is effective, just can carry out and not finish the data block write command last time, after this command execution is finished, that carries out new data writes the operation of order and data distributing again, in order to proceed the write operation flow process of whole remaining data;
2, judge the storage of command interaction district for finishing normally respond packet, and finishing the entrained response address of respond packet, response length information and upper data, to write order corresponding, just finish an order before power down is described, the residue flow process that directly continues whole operation gets final product;
3, order, respond packet or its read-write process when power down, have been destroyed, host computer just writes command interaction district and the data interaction district of slave computer again according to the corresponding order bag of the identify label of this slave computer and data message, so that slave computer re-executes the order that writes of destroyed power failure data piece, after this order is finished, continue whole operation residue flow process and get final product.
Three, carry out explosion command:
The embodiment of the invention is also supported the use of explosion command, and take USB interface embedded systems debugging equipment debugging process as example, host computer sends the debug command bag to slave computer, and writes debugging code in follow-up data interaction in the data interaction district of slave computer; Slave computer is carried out this debugging code according to the debug command bag, and Debugging message is write in the storage area in data interaction district of host computer appointment, then this debug command bag in the command interaction district is replaced with respond packet.
The above only is illustrated the application scenarios in the embodiment of the invention with some examples, is understandable that, in actual applications, more application scenarios can also be arranged, and specifically is not construed as limiting herein.
The below describes the command transfer device of the USB (universal serial bus) of the present invention of the command transfer method that is used for carrying out above-mentioned USB (universal serial bus), its logical organization please refer to Fig. 4, and an embodiment of the command transfer device of USB (universal serial bus) comprises in the embodiment of the invention:
Command sending unit 401 is used for sending the first order bag to the first slave computer, so that described the first order bag is stored and carried out to described the first slave computer;
Monitoring unit 402 is used for the command interaction district that reads described the first slave computer every presetting duration, if describedly read failure, then triggers and interrupts daily record generation unit 403;
Interrupt daily record generation unit 403, be used for generating and storing the operation disruption daily record, described operation disruption daily record comprises: the sign of the identify label of described the first slave computer and described the first order bag;
Marking matched unit 404 is used for identifying the identify label of described the second slave computer when having detected the access of the second slave computer, if described host computer has operation disruption daily record corresponding to the identify label of described the second slave computer, then triggers continuous performance element 405;
Continuous performance element 405 is used for triggering described the second slave computer and continues to carry out the operation that second of operation disruption daily record mark corresponding to described the second slave computer ordered bag.
The command transfer device of the USB (universal serial bus) in the embodiment of the invention can for the host computer of USB device, specifically be realized in computing machine.
Continuous performance element 405 in the embodiment of the invention can comprise:
Reminding module 4051 is used for the operation whether prompting user continues to carry out described the second order bag, if then trigger continuous execution module 4052;
Continuous execution module 4052 is used for sending triggering command to slave computer, so that described the second slave computer continues to carry out the operation of described the second order bag.
The command transfer device of the USB (universal serial bus) in the embodiment of the invention can comprise:
State detection unit 406 for the command interaction district that reads described the second slave computer, if described command interaction district stores described the second order bag, then triggers described continuous performance element 405; If described command interaction district stores the respond packet of finishing of described the second order bag correspondence, then trigger response acquiring unit 407;
Response acquiring unit 407 is used for when having finished the operation that order wraps, obtain described order bag corresponding finish respond packet and response data, finish the execution flow process of described order bag.
Verification of data unit 408 is complementary for order bag and data message order bag and the data message that whether the operation disruption daily record corresponding with described the second slave computer recorded of checking described the second slave computer storage, if then trigger described continuous performance element 405; If not then the trigger command transmitting element 401.
The concrete reciprocal process of unit is as follows in the command transfer device of embodiment of the invention USB (universal serial bus):
Host computer is with after slave computer is connected, and command sending unit 401 sends the first order bag to the first slave computer, so that the first slave computer storage and carry out the first order bag.The operational order that order bag issues to slave computer for host computer, concrete operations can comprise: format (or deletion) data, software upgrading and reading and writing data.The order bag that host computer sends to slave computer and packet are all packed and are become USB standard data writing packet format, and concrete, order bag writing address is the command interaction district of slave computer, and the writing address of packet is the data interaction district.
After having issued the first order bag, monitoring unit 402 is every the command interaction district of presetting duration and reading the first slave computer, the situation of finishing of monitoring the first order bag; When reading above-mentioned the first order bag of being still of this command interaction district storage, illustrate that then the first slave computer is also in the indicated operation of execution the first order bag; When read the storage of this command interaction district be above-mentioned the first order bag corresponding finish respond packet the time, illustrate that then the first slave computer finished the indicated operation of the first order bag; When reading unsuccessfully, illustrate that then host computer and slave computer disconnect.If monitoring unit 402 can't be finished read operation, then trigger and interrupt daily record generation unit 403.
Before the indicated operation of above-mentioned the first order bag is not finished, when host computer is confirmed to disconnect with slave computer, then interrupt daily record generation unit 403 and can generate the operation disruption daily record corresponding with this first order bag, be marked with the identify label of the first slave computer and the sign of the first order bag in this operation disruption daily record.
When the access of the second slave computer is arranged, the identify label of marking matched unit 404 these the second slave computers of identification, if store operation disruption daily record corresponding to the identify label of this second slave computer in the host computer, then trigger continuous performance element 405 and trigger the operation that described the second slave computer continues to carry out the second order bag of mark in operation disruption daily record corresponding to described the second slave computer.
Concrete, whether continuous performance element 405 can continue to carry out by reminding module 4051 prompting users the operation of described the second order bag, if then trigger continuous execution module 4052; Send triggering command to slave computer, so that described the second slave computer continues to carry out the operation of described the second order bag.
Optionally, before triggering continuous performance element 405, the second order bag whether this command interaction district stores mark in operation disruption daily record corresponding to the second slave computer is inquired about in the command interaction district that can be read by state detection unit 406 host computers the second slave computer; If the mentioned order interactive areas stores this second order bag, illustrate that then operation corresponding to the second order bag that last host computer indicates this second slave computer to carry out not yet finish, needing trigger data to check unit 408 checks order bag and the data message whether the order bag of described the second slave computer storage and data message record in the operation disruption daily record corresponding with described the second slave computer and is complementary, if then trigger described continuous performance element 405; If not then the trigger command transmitting element 401; If the mentioned order interactive areas stores the respond packet of finishing of this second order bag correspondence, illustrate that then the second slave computer finished the indicated operation of the second order bag, just host computer does not have enough time to read this and finishes respond packet and just disconnected with the second slave computer, at this moment, response acquiring unit 407 can read this and finish respond packet, and obtain the second order bag finish data to upgrade the related data of host computer this locality, finish the execution flow process of the second order bag.
The below describes the command transfer device of another USB (universal serial bus) of the command transfer method that is used for carrying out above-mentioned USB (universal serial bus), its logical organization please refer to Fig. 5, and another embodiment of the command transfer device of USB (universal serial bus) comprises in the embodiment of the invention:
Order receiving element 501 is used for receiving the order bag that host computer sends;
Command interaction district 502 is used for storing described order bag;
Command executing unit 503 is used for carrying out corresponding operation according to the indication of described order bag;
Command reception unit 504, if be used for before the operation of described order bag is finished, again access after the connection breaking then receives the triggering command of described host computer in described slave computer and the described host computer, and triggers described command executing unit 503 and continue complete operation.
Detecting unit 505 for detection of the described order bag of described command interaction district storage, and triggers described command executing unit 503 and continues complete operation.
The command transfer device of the USB (universal serial bus) in the embodiment of the invention can be the slave computer of USB device, the USB flash disk that namely is commonly called as.
Command executing unit 503 in the embodiment of the invention can comprise:
Command analysis module 5031 is for the actuating code, command execution start address and the command execution length that read described order bag;
Data read-write module 5032, be used for storing the packet that host computer sends into data interaction district 507, and according to described actuating code, command execution start address and command execution length the data in the data interaction district 507 are sent to the position that command execution start address and command execution length limit, or according to described actuating code, command execution start address and command execution length with data data writing interactive areas 507.
The command transfer device device of the USB (universal serial bus) in the embodiment of the invention also comprises:
Response generation unit 506 is used for after the operation of finishing described order bag, generate described order bag corresponding finish respond packet, and use the described respond packet of finishing to cover described order bag.
Data interaction district 507 is used for storing the data message of described host computer read-write.
The concrete reciprocal process of unit is as follows in the command transfer device of embodiment of the invention USB (universal serial bus):
Order receiving element 501 receives the order bag that host computer sends, and the described order bag of trigger command interactive areas 502 storages, and trigger command performance element 503 is carried out corresponding operation according to the indication of order bag.Concrete, behind the order bag that gets access to the host computer transmission, confirming to load data in order bag and the effective situation of packet, and carry out this command execution code respective operations, and execution result (respond packet and response data) write in the assigned address, thereby the implementation of a complete order bag.
If before the operation of mentioned order bag is finished, again access after the connection breaking in slave computer and the host computer, and confirm that at host computer the command interaction district of slave computer and order bag that the data interaction district stores and the buffered data of data and host computer are complementary, then command reception unit 504 receives the triggering command that host computer sends, and trigger command performance element 503 is carried out corresponding operation according to the indication of order bag; Perhaps detect local command interaction district by detecting unit 505, when detecting this locality and store uncompleted order bag, then the trigger command performance element 503.
Concrete, if the order bag that this second order bag writes for data, then this order bag specifically can comprise: actuating code, command execution start address and command execution length.Read actuating code, command execution start address and command execution length in the described order bag by command analysis module 5031; Store the packet that host computer sends into data interaction district 507 by data read-write module 5032, and trigger according to described actuating code, command execution start address and command execution length and described data in the data interaction district 507 to be sent to the position that command execution start address and command execution length limit, or trigger data data writing interactive areas 507 according to described actuating code, command execution start address and command execution length.
Optional according to actual conditions, if upper computer detection is not mated to the order bag of storing in the appointed area of slave computer and the buffered data of data and host computer, then order receiving element 501 can again receive the mentioned order bag.
Slave computer after finishing the indicated operation of this order bag, response generation unit 506 generate this orders bag corresponding finish respond packet, and use this to finish respond packet to cover this order and wrap.
In several embodiment that the application provides, should be understood that disclosed apparatus and method can realize by another way.For example, device embodiment described above only is schematic, for example, the division of described unit, only be that a kind of logic function is divided, during actual the realization other dividing mode can be arranged, for example a plurality of unit or assembly can in conjunction with or can be integrated into another system, or some features can ignore, or do not carry out.Another point, the shown or coupling each other discussed or direct-coupling or communication connection can be by some interfaces, indirect coupling or the communication connection of device or unit can be electrically, machinery or other form.
Described unit as separating component explanation can or can not be physically to separate also, and the parts that show as the unit can be or can not be physical locations also, namely can be positioned at a place, perhaps also can be distributed on a plurality of network element.Can select according to the actual needs wherein some or all of unit to realize the purpose of present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in the processing unit, also can be that the independent physics of unit exists, and also can be integrated in the unit two or more unit.Above-mentioned integrated unit both can adopt the form of hardware to realize, also can adopt the form of SFU software functional unit to realize.
If described integrated unit is realized with the form of SFU software functional unit and during as independently production marketing or use, can be stored in the computer read/write memory medium.Based on such understanding, part or all or part of of this technical scheme that technical scheme of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product is stored in the storage medium, comprise that some instructions are with so that a computer equipment (can be personal computer, server, the perhaps network equipment etc.) carry out all or part of step of the described method of each embodiment of the present invention.And aforesaid storage medium comprises: USB flash disk, portable hard drive, ROM (read-only memory) (ROM, Read-Only Memory), the various media that can be program code stored such as random access memory (RAM, Random Access Memory), magnetic disc or CD.
The above; be the specific embodiment of the present invention only, but protection scope of the present invention is not limited to this, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion by described protection domain with claim.

Claims (18)

1. the command transfer method of a USB (universal serial bus) is characterized in that, comprising:
Host computer sends the first order bag to the first slave computer, so that described the first order bag is stored and carried out to described the first slave computer;
Described host computer is every the command interaction district of presetting duration and reading described the first slave computer, if describedly read failure, then generate and store the operation disruption daily record, described operation disruption daily record comprises: the sign of the identify label of described the first slave computer and described the first order bag;
If described upper computer detection is to the access of the second slave computer is arranged, then identify the identify label of described the second slave computer, if described host computer has operation disruption daily record corresponding to the identify label of described the second slave computer, then trigger the operation that described the second slave computer continues to carry out the second order bag of mark in operation disruption daily record corresponding to described the second slave computer.
2. method according to claim 1 is characterized in that, described triggering the second slave computer continues to carry out the operation of the second order bag of mark in operation disruption daily record corresponding to described the second slave computer, comprising:
Whether prompting user continues to carry out the operation of described the second order bag, if then send triggering command to described the second slave computer, so that described the second slave computer continues to carry out the operation of described the second order bag;
Or,
Send triggering command to slave computer, so that described the second slave computer continues to carry out the operation of described the second order bag.
3. method according to claim 1 and 2 is characterized in that, described triggering the second slave computer continues to carry out before the operation of the second order bag of mark in operation disruption daily record corresponding to described the second slave computer, comprising:
Read the command interaction district of described the second slave computer;
If described command interaction district stores described the second order bag, then trigger the operation that the second slave computer continues to carry out the second order bag of mark in operation disruption daily record corresponding to described the second slave computer;
If described command interaction district stores the respond packet of finishing of described the second order bag correspondence, then obtain described respond packet and the response data finished, finish the execution flow process of described the second order bag.
4. method according to claim 3, it is characterized in that, if the command interaction district of described the second slave computer stores described the second order bag, described triggering the second slave computer continues to carry out before the operation of the second order bag of mark in operation disruption daily record corresponding to described the second slave computer, comprising:
Checking order bag and the data message whether the order bag of described the second slave computer storage and data message record in the operation disruption daily record corresponding with described the second slave computer is complementary, if then trigger the operation that the second slave computer continues to carry out the second order bag of mark in operation disruption daily record corresponding to described the second slave computer, if not, then again send the second order bag to described the second slave computer.
5. method according to claim 1 and 2 is characterized in that, if described the first order bag is for sending to described slave computer the order of data, before then described host computer sends the first order bag to the first slave computer, comprising:
Host computer sends data message to the data interaction district of the first slave computer.
6. method according to claim 3 is characterized in that, if described command interaction district stores the respond packet of finishing of described the second order bag correspondence, then described obtaining finished after respond packet and the response data, comprising:
Detect whether described to finish respond packet correct, if correct, then finish the operating process of described the second order bag; If incorrect, then again send the second order bag to described the second slave computer.
7. method according to claim 1 and 2 is characterized in that, described order bag comprises:
Actuating code, command execution start address and command execution length.
8. the command transfer method of a USB (universal serial bus) is characterized in that, comprising:
Slave computer receives the order bag that host computer sends;
Described slave computer deposits described order bag the command interaction district of described slave computer in, and carries out corresponding operation according to described order bag;
If before the operation of described order bag is finished, again access after the connection breaking in described slave computer and the described host computer,
Then described slave computer receives the triggering command of described host computer, and continues to carry out the operation of described order bag according to described triggering command; Or described slave computer detects the described order bag of described command interaction district storage, and carries out the operation of described order bag.
9. method according to claim 8 is characterized in that, described operation according to the described order bag of triggering command continuation execution comprises:
Read actuating code, command execution start address and command execution length in the described order bag;
According to described actuating code, command execution start address and command execution length fill order.
10. according to claim 8 or 9 described methods, it is characterized in that, describedly continue to carry out after the operation of described order bag according to triggering command, comprising:
After the operation of finishing described order bag, generate described order bag corresponding finish respond packet, and use the described respond packet of finishing to cover described order bag.
11. method according to claim 10 is characterized in that, the described respond packet that is used to complete covers before the described order bag, comprising:
Described slave computer is with data data writing interactive areas.
12. the command transfer device of a USB (universal serial bus) is characterized in that, comprising:
Command sending unit is used for sending the first order bag to the first slave computer, so that described the first order bag is stored and carried out to described the first slave computer;
Monitoring unit is used for the command interaction district that reads described the first slave computer every presetting duration, if describedly read failure, then triggers and interrupts the daily record generation unit;
Interrupt the daily record generation unit, be used for generating and storing the operation disruption daily record, described operation disruption daily record comprises: the sign of the identify label of described the first slave computer and described the first order bag;
Marking matched unit is used for identifying the identify label of described the second slave computer when having detected the access of the second slave computer, if described host computer has operation disruption daily record corresponding to the identify label of described the second slave computer, then triggers continuous performance element;
Continuous performance element is used for triggering described the second slave computer and continues to carry out the operation that second of operation disruption daily record mark corresponding to described the second slave computer ordered bag.
13. device according to claim 12 is characterized in that, described continuous performance element comprises:
Reminding module is used for the operation whether prompting user continues to carry out described the second order bag, if then trigger continuous execution module;
Continuous execution module is used for sending triggering command to slave computer, so that described the second slave computer continues to carry out the operation of described the second order bag.
14. according to claim 12 or 13 described devices, it is characterized in that described device also comprises:
State detection unit for the command interaction district that reads described the second slave computer, if described command interaction district stores described the second order bag, then triggers described continuous performance element; If described command interaction district stores the respond packet of finishing of described the second order bag correspondence, then trigger the response acquiring unit;
The response acquiring unit is used for when having finished the operation that order wraps, obtain described order bag corresponding finish respond packet and response data, finish the execution flow process of described order bag.
15. device according to claim 14 is characterized in that, described device also comprises:
The verification of data unit is complementary for order bag and data message order bag and the data message that whether the operation disruption daily record corresponding with described the second slave computer recorded of checking described the second slave computer storage, if then trigger described continuous performance element; If not, trigger command transmitting element then.
16. the command transfer device of a USB (universal serial bus) is characterized in that, comprising:
The order receiving element is used for receiving the order bag that host computer sends;
The command interaction district is used for storing described order bag;
Command executing unit is used for carrying out corresponding operation according to the indication of described order bag;
The command reception unit if be used for before the operation of described order bag is finished, with again access after the connection breaking in the described host computer, then receive the triggering command of described host computer, and triggers described command executing unit and continue complete operation.
Detecting unit for detection of the described order bag of described command interaction district storage, and triggers described command executing unit and continues complete operation.
17. device according to claim 16 is characterized in that,
Described device also comprises:
The data interaction district is used for storing the data message of described host computer read-write;
Described command executing unit comprises:
The command analysis module is for the actuating code, command execution start address and the command execution length that read described order bag;
Data read-write module, be used for storing the packet that host computer sends into the data interaction district, and trigger according to described actuating code, command execution start address and command execution length the data in the data interaction district are sent to the position that command execution start address and command execution length limit, or trigger data data writing interactive areas according to described actuating code, command execution start address and command execution length.
18. according to claim 16 or 17 described devices, it is characterized in that described device also comprises:
The response generation unit is used for after the operation of finishing described order bag, generate described order bag corresponding finish respond packet, and use the described respond packet of finishing to cover described order bag.
CN201110296481.1A 2011-09-29 2011-09-29 Command transfer method and the relevant apparatus of USB Active CN103034561B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110296481.1A CN103034561B (en) 2011-09-29 2011-09-29 Command transfer method and the relevant apparatus of USB

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110296481.1A CN103034561B (en) 2011-09-29 2011-09-29 Command transfer method and the relevant apparatus of USB

Publications (2)

Publication Number Publication Date
CN103034561A true CN103034561A (en) 2013-04-10
CN103034561B CN103034561B (en) 2016-05-04

Family

ID=48021481

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110296481.1A Active CN103034561B (en) 2011-09-29 2011-09-29 Command transfer method and the relevant apparatus of USB

Country Status (1)

Country Link
CN (1) CN103034561B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105187274A (en) * 2015-08-27 2015-12-23 浪潮软件集团有限公司 Method for judging port state and selecting good port communication
CN106657332A (en) * 2016-12-22 2017-05-10 深圳市麦积电子科技有限公司 Breakpoint continuous transmission method
CN107808074A (en) * 2017-11-03 2018-03-16 武汉资联虹康科技股份有限公司 A kind of slave computer runtime and method
CN110737483A (en) * 2019-10-12 2020-01-31 重庆邮电大学 Signaling and data transmission method based on Windows USB MassStorage class
CN114125073A (en) * 2020-06-29 2022-03-01 株洲中车时代电气股份有限公司 Data interaction method, storage medium and electronic device
CN116047336A (en) * 2023-03-27 2023-05-02 深圳市铂纳特斯自动化科技有限公司 Battery formation monitoring method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
赵念强等: "基于Soc单片机C8051F的码头供给监控系统", 《微计算机信息》 *
黄丽霞等: "热处理加热炉智能模糊控制系可靠性问题研究", 《微计算机信息》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105187274A (en) * 2015-08-27 2015-12-23 浪潮软件集团有限公司 Method for judging port state and selecting good port communication
CN106657332A (en) * 2016-12-22 2017-05-10 深圳市麦积电子科技有限公司 Breakpoint continuous transmission method
CN107808074A (en) * 2017-11-03 2018-03-16 武汉资联虹康科技股份有限公司 A kind of slave computer runtime and method
CN110737483A (en) * 2019-10-12 2020-01-31 重庆邮电大学 Signaling and data transmission method based on Windows USB MassStorage class
CN110737483B (en) * 2019-10-12 2023-02-24 重庆邮电大学 Signaling and data transmission method based on Windows USB MassStorage class
CN114125073A (en) * 2020-06-29 2022-03-01 株洲中车时代电气股份有限公司 Data interaction method, storage medium and electronic device
CN114125073B (en) * 2020-06-29 2023-06-13 株洲中车时代电气股份有限公司 Data interaction method, storage medium and electronic device
CN116047336A (en) * 2023-03-27 2023-05-02 深圳市铂纳特斯自动化科技有限公司 Battery formation monitoring method and device

Also Published As

Publication number Publication date
CN103034561B (en) 2016-05-04

Similar Documents

Publication Publication Date Title
CN103034561A (en) Command transmission method and relevant device for universal serial bus (USB)
DK3179359T3 (en) PROCEDURE FOR SENDING DATA, PROCEDURE FOR RECEIVING DATA AND STORAGE UNIT
EP2652599B1 (en) System reset
CN102722443B (en) Bad block management method for flash memory
JP2007193804A (en) System, method and computer program for backing up data of data storage device in computing device
JP4712102B2 (en) Storage device, data processing method, and data processing program
CN110399247B (en) Data recovery method, device and equipment and computer readable storage medium
CN104156298A (en) Application monitoring method and device
CN104679542A (en) Server staring method and computer system
CN104166605A (en) Data backup method and system based on incremental data files
CN101883135A (en) Selective mirroring method
CN101587522A (en) Method and system for identifying script virus
WO2013101176A1 (en) Apparatus and method for managing operation of a mobile device
CN101366006A (en) Emulation component for data backup applications
CN102355568A (en) Method and device for carrying out charged uninstallation and installation of hard disk for digital video recorder
CN101447982A (en) Storage emulator and method thereof
CN109741786A (en) A kind of solid state hard disk monitoring method, device and equipment
US7600151B2 (en) RAID capacity expansion interruption recovery handling method and system
CN110737483B (en) Signaling and data transmission method based on Windows USB MassStorage class
CN111209132B (en) Embedded system, power-down protection method, electronic device and storage medium
CN103116471A (en) Image processing apparatus
CN102819471A (en) Software backup system and software backup method of equipment terminal
US11550506B2 (en) Systems and methods for accessing hybrid storage devices
KR101272802B1 (en) Computer fault processing system and method with mobile device
US11755223B2 (en) Systems for modular hybrid storage devices

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20170427

Address after: Nanping Street 400060 Chongqing Nan'an District Nancheng Road No. 199 left attached to the floor 403

Patentee after: Keen (Chongqing) Microelectronics Technology Co.,Ltd.

Address before: 400065 Chongqing Nan'an District huangjuezhen pass Fort Park No. 1

Patentee before: CHONGQING CYIT COMMUNICATION TECHNOLOGIES Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20181108

Address after: 201203 Building 1, exhibition hall, 2288 lane, 2288 Chong, road, Zhangjiang hi tech park, Shanghai

Patentee after: SPREADTRUM COMMUNICATIONS (SHANGHAI) Co.,Ltd.

Address before: 400060 Nanping Road 199, Nanping Street, Nan'an District, Chongqing, 403

Patentee before: Keen (Chongqing) Microelectronics Technology Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20190327

Address after: 361006 Xiamen Free Trade Pilot Area, Xiamen, Fujian Province, Unit X, 8th Floor, Unit 05, Building D, Xiamen International Shipping Center, 97 Xiangyu Road, Xiamen Section

Patentee after: Xinxin Finance Leasing (Xiamen) Co.,Ltd.

Address before: 201203 Building 1, exhibition hall, 2288 lane, 2288 Chong, road, Zhangjiang hi tech park, Shanghai

Patentee before: SPREADTRUM COMMUNICATIONS (SHANGHAI) Co.,Ltd.

TR01 Transfer of patent right
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20130410

Assignee: SPREADTRUM COMMUNICATIONS (SHANGHAI) Co.,Ltd.

Assignor: Xinxin Finance Leasing (Xiamen) Co.,Ltd.

Contract record no.: X2021110000009

Denomination of invention: Command transmission method and related devices of universal serial bus

Granted publication date: 20160504

License type: Exclusive License

Record date: 20210317

EE01 Entry into force of recordation of patent licensing contract
TR01 Transfer of patent right

Effective date of registration: 20221018

Address after: 201203 Shanghai city Zuchongzhi road Pudong New Area Zhangjiang hi tech park, Spreadtrum Center Building 1, Lane 2288

Patentee after: SPREADTRUM COMMUNICATIONS (SHANGHAI) Co.,Ltd.

Address before: 361006 Xiamen Free Trade Pilot Area, Xiamen, Fujian Province, Unit X, 8th Floor, Unit 05, Building D, Xiamen International Shipping Center, 97 Xiangyu Road, Xiamen Section

Patentee before: Xinxin Finance Leasing (Xiamen) Co.,Ltd.

TR01 Transfer of patent right