CN102801582B - Device and method for realizing automatic power failure of USB (Universal Serial Bus) device - Google Patents

Device and method for realizing automatic power failure of USB (Universal Serial Bus) device Download PDF

Info

Publication number
CN102801582B
CN102801582B CN201210253758.7A CN201210253758A CN102801582B CN 102801582 B CN102801582 B CN 102801582B CN 201210253758 A CN201210253758 A CN 201210253758A CN 102801582 B CN102801582 B CN 102801582B
Authority
CN
China
Prior art keywords
instruction
power down
byte
address
usb device
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
CN201210253758.7A
Other languages
Chinese (zh)
Other versions
CN102801582A (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.)
Feitian Technologies Co Ltd
Beijing Feitian Technologies Co Ltd
Original Assignee
Feitian 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 Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201210253758.7A priority Critical patent/CN102801582B/en
Publication of CN102801582A publication Critical patent/CN102801582A/en
Application granted granted Critical
Publication of CN102801582B publication Critical patent/CN102801582B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a device and a method for realizing the automatic power failure of a USB (Universal Serial Bus) device, belonging to the technical field of communication. The device provided by the invention is connected with the USB device and a host machine, the address of the device is set to be identical to that of the USB device, and a power failure instruction issued by the host machine is received, so that the power failure of the USB device is controlled automatically. According to the method provided by the invention, the instruction meeting the filter conditions, which is issued by the host machine, is received, so that the automatic power failure of a target device is controlled; and the filter conditions can be set flexibly in advance. According to the method and the device, which can accurately control the power failure of the USB device, provided by the invention, the production test efficiency and the test efficiency can be improved, and the simultaneous large-batch production test of the device can be met.

Description

A kind of device and method realizing USB device automatic power down
Technical field
The present invention relates to communication technical field, particularly relate to a kind of USB device automatic power down device and method.
Background technology
The reperformance test of communication equipment power on and off can leak the stability problem of product design fully cruelly, find the hidden danger in product design, if the upper surge of power unit is on the impact of product, the reliability of electrification reset and system are in normal operating conditions, can return to normal after power on and off, and the test of this part completes by manual type usually, the repeatability of work, the continuation of time, the test frequency is difficult to ensure card, the easy damage equipment interface of manual plug etc. is all the weakness of manual testing, there is significantly limitation and deficiency in conventional test methodologies and means.
Summary of the invention
For solving the defect existed in prior art, the present invention proposes a kind of method and apparatus that can control USB device power down accurately.
The technical scheme that the present invention takes is: a kind of method realizing USB device automatic power down, comprising:
Step S1: equipment receives the instruction that host computer issues;
Step S2: judging whether to arrange address, is perform step S3, otherwise perform step S5;
Step S3: judge whether described instruction meets filter condition, is, performs step S4, otherwise return execution step S1;
Step S4: power-down operation is performed to target device, then returns step S1;
Step S5: decision instruction type;
When described instruction then performs arrange filter condition operation for arranging filter condition order, and return to host computer and be provided with response, then return step S1;
When described instruction then returns reception success response to host computer for arranging address command, and current device address being set to destination device address, then returning step S1;
When described instruction other operations corresponding for other operational orders then perform, and return other operation responses corresponding to host computer, then return step S1.
Judge whether described in step S2 that having arranged address is specially, and judges that whether current device address is consistent with destination device address.Or be specially, judge whether to there is address change mark; Comprise after current device address being set to destination device address described in step S5 and change mark in address is set.
Comprise after step S1, start the first timer when the data of described instruction all finish receiving, or start the first timer when the data receiver of the length of making an appointment of described instruction completes.Corresponding described step S4 is, judges whether present timing reaches the first Preset Time, is then perform power-down operation to target device and reset by the first timer, then returns step S1, otherwise is in wait state and repeating said steps S4.
Judge described in step S3 whether described instruction meets filter condition and be specially, judge that whether the default specified bytes of described instruction is consistent with default filtration byte; Execution described in step S5 arranges filter condition operation and is specially, and instruction is filtered byte and is set to preset filtration byte.
Or judge described in step S3 whether described instruction meets filter condition and be, judge that whether the default byte of described instruction is consistent with default filtration byte, and/or whether the current metering judging described instruction is default value; Execution described in step S5 arranges filter condition operation and is specially, and instruction is filtered byte and is set to preset filtration byte, and/or the metering value of described instruction is set to default value.
Wherein, arrange filter condition operation described in step S5 also to comprise the power down stand-by period is set to the first Preset Time.
Or judge described in step S3 whether described instruction meets filter condition and be specially, judge whether the value of the default byte of described instruction meets preset range, is meet filter condition, otherwise does not meet filter condition; Comprise before step S4 after step S3: the value according to the default byte of described instruction searches the power down stand-by period corresponding with the value of described default byte in the filter list prestored, and the described power down stand-by period found is recorded as the first Preset Time; Perform described in step S5 and arrange filter condition operation and be specially, arrange filter list and preserve, described filter list is by filtering byte and the power down stand-by period corresponding with described filtration byte forms.
According to the content of the length of described instruction, form or preset field, substantive examination step S3 judges whether described instruction meets filter condition; Perform described in step S5 and the operation that filter condition is operating as the content performing the length, form or the preset field that arrange instruction is set.
Comprise after power-down operation being performed to target device described in step S4, judge whether present timing reaches the second Preset Time, then power on operation is performed to target device and described first timer is reset, then return step S1, otherwise be in wait state and repeat to judge whether present timing reaches the second Preset Time.
Described in step S4, power-down operation performed to target device and comprise after described first timer clearing, start the second timer, judge whether present timing reaches the second Preset Time, then power on operation is performed to target device and described second timer is reset, then return step S1, otherwise be in wait state and repeat to judge whether present timing reaches the second Preset Time.
Arrange filter condition operation described in step S5 also to comprise the stand-by period that powers on is set to the second Preset Time.
Also comprise after power-down operation being performed to target device described in step S4, current device address is reduced to equipment original address.
Comprise after current device address being set to destination device address described in step S5, start the 3rd timer, when the timing of described 3rd timer reaches the 3rd Preset Time, then current device address automatic reduction is equipment original address.
Other operational orders described in step S5 comprise opens port command, the instruction of acquisition equipment state, overcurrent parameter setting instruction, LED status idsplay order.
A kind of device realizing USB device automatic power down, comprise: USB HUB chip 2, main control chip 3, device port control circuit 4 and indicator light circuit 5, wherein, described device is connected with PC 1 by the port of USB HUB chip 2, be connected with USB device 7 by the port of device port control circuit 4, main control chip 3 and device port control circuit 4 are connected to USB HUB chip 2, and device port control circuit 4 and indicator light circuit 5 are connected to main control chip 3.
Described USB HUB chip 2, for expanding USB passage, provides the interface that PC 1 is connected with USB device 7 by device port control circuit 4, for providing the data transmission channel of PC 1 with main control chip 3;
Described main control chip 3, for receiving the next data of USB HUB chip 2 transmission and making respective handling, and returns respective handling result to USB HUB chip 2; For control appliance port control circuit 4 and indicator light circuit 5;
Device port control circuit 4, is directly connected with USB device 7 and main control chip 3, opens or closes USB device port for controlling;
Indicator light circuit 5, is used to indicate the running status of USB device 7.
Described main control chip 3 comprises:
Transceiver module 301, for receiving the instruction that PC 1 sends, for sending instruction response to PC 1;
Judge module 302, being provided with address for judging whether, whether meeting filter condition when arranging address for decision instruction, when not arranging instruction for decision instruction type; For judging whether timing reaches the power down stand-by period, for judging whether timing reaches the stand-by period that powers on;
Module 303 being set, for filtering byte when described instruction for arranging when arranging filter condition order and arrange the power down stand-by period, powering on the stand-by period for arranging; For when described instruction is setting command, arranging current device address is destination device address;
Operational module 304, for resolving the instruction received, performs power-down operation to USB device during for reaching the power down stand-by period when timing, also for performing power on operation to USB device when timing reaches and powers on the stand-by period time.
Described device also comprises current converter circuit, is connected with device port control circuit 4 with described main control chip 3, for the current value flowing to described USB device 7 is converted to magnitude of voltage.
Described device also comprises overcurrent warning circuit, is connected with described main control chip 3, for giving the alarm when the port current of described USB device 7 exceedes rated current, for triggering indicator light prompting mistake.
The invention has the beneficial effects as follows: the automatic power down device and method that the present invention proposes, the validity of production test efficiency and test can be improved, system equipment can also be met and produce test in enormous quantities simultaneously.
Accompanying drawing explanation
Fig. 1 is a kind of method flow diagram realizing USB device automatic power down that embodiment one proposes;
Fig. 2 is a kind of device schematic diagram realizing USB device automatic power down that embodiment two provides.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
Embodiment one
As shown in Figure 1, a kind of method realizing USB device automatic power down comprises the following steps:
Step 101: the instruction that equipment wait-receiving mode host computer issues;
Step 102: first equipment judge whether after receiving instruction to have arranged address, is perform step 103, otherwise perform step 110;
In the present embodiment particularly, equipment judges after receiving instruction that whether current device address is consistent with destination device address, is, represents and arranges address; Or equipment judges whether to there is address change mark after receiving instruction, if there is address change mark, represent and arrange address; Otherwise represent and address is not set.
Step 103: whether decision instruction meets filter condition, is, performs step 104, otherwise return execution step 101;
In the present embodiment, whether described decision instruction meets filter condition is specially: whether the default byte of decision instruction is consistent with default filtration byte, and be meet filter condition, described instruction is power down instructions, perform step 104, otherwise return next instruction of step 101 wait-receiving mode.
In addition, can also using content of the length of described instruction, form, predetermined field etc. as the basis for estimation whether meeting filter condition.
In the present embodiment, for predetermined generation double secret key instruction.This instruction is specially
00460000020400;
If front 4 bytes of the instruction received are consistent with predetermined generation double secret key instruction, then perform step 104.
Or whether described decision instruction meets filter condition is: whether the current metering of decision instruction is default value, is meet filter condition, otherwise does not meet filter condition.Such as, when the instruction received is amendment PIN instruction, then meet filter condition when the number of times receiving amendment PIN instruction of current record is 2, perform power-down operation.
Further, whether decision instruction meets filter condition and can also be:
A1: whether the default byte of decision instruction is consistent with default filtration byte, is perform next step, otherwise returns step 101;
Described default byte is the first two byte of described instruction.
A2: whether the current metering judging described instruction is preset value, is meet filter condition, otherwise returns step 101.
Described preset value be more than or equal to 1 integer, such as, described preset value is 3, then meet the first two byte that filter condition is specially described instruction and meet that to filter byte and meet the number of times receiving described instruction be 3.
Or above-mentioned steps 103 is specially:
Step 103-1: whether the value of the default byte of decision instruction meets preset range, is perform next step, otherwise return execution step 101;
Step 103-2: the value presetting byte according to described instruction searches the corresponding power down stand-by period, and the described power down stand-by period found is recorded as the first Preset Time, then performs step 104;
Further, the value can also presetting byte according to described instruction searches corresponding powering on the stand-by period, and the stand-by period that powers on described in finding is recorded as the second Preset Time.
Step 104: start the first timer;
In the present embodiment particularly, can be start to start the first timer when the data of described instruction all finish receiving, also can be start when receiving a part of data of described instruction to start the first timer.
Step 105: judge whether the timing of the first timer reaches the first Preset Time, is perform next step, otherwise is in wait state;
Further, in the present embodiment, described first Preset Time can be arranged according to the content of described power down instructions.Such as, in the present embodiment, if the power down instructions received is
00460000020400
Then receiving instruction after 1.5 seconds to target device execution power-down operation.
If the power down instructions received is
00460000020200
Then receiving instruction after 0.5 second to target device execution power-down operation.
Step 106: reset by the first timer, performs power-down operation to target device;
Above-mentioned steps 104-106 can also replace with following operation: perform power-down operation to target device.Accordingly, can be when the data of described instruction all finish receiving execution power down, also can be perform power down when receiving a part of data of described instruction.
Such as, when the instruction received is for reading binary command, the first two byte of described instruction meets filters byte, performs power-down operation when finishing receiving front 2 byte datas of described instruction.
In the present embodiment, can also comprise the following steps after step 106:
Step 107: start the second timer;
Step 108: judge whether the timing of the second timer reaches the second Preset Time, is perform next step, otherwise is in wait state;
Step 109: reset by the second timer, performs power on operation to target device, returns step 101.
Above-mentioned steps 104-step 109 can also use following steps 104 '-step 108 ' scheme replace:
Step 104 ': start the first timer;
Step 105 ': judge whether the timing of the first timer reaches the first Preset Time, is perform next step, otherwise is in wait state;
Step 106 ': power-down operation is performed to target device;
Step 107 ': judge whether the timing of the first timer reaches the 3rd Preset Time, is perform next step, otherwise is in wait state;
Step 108 ': the first timer is reset, power on operation is performed to target device, returns step 101.
Further, step 106 or step 106 ' in power-down operation is performed to target device after also comprise the operation of being reduced current device address, be specially and more change back original address by current device address.
Or step 109 or step 108 ' in power on operation is performed to target device after perform the operation of being reduced current device address.
Step 110: decision instruction type, if described instruction is for performing step 111-step 114 when arranging filter condition order, if described instruction is for performing step 115-step 116 when arranging address command; If other operational orders then perform step 117-step 118; If invalid data, then return the error code of agreement in advance to host computer;
In the present embodiment, described decision instruction type is specially:
According to the first two byte decision instruction type of instruction, and whether effective according to instruction type decision instruction, if invalid, return the error code of agreement in advance to host computer;
Particularly, in the present embodiment, determination methods is:
Steps A: if the first two byte of instruction is the 0x6801 made an appointment, then described instruction is for arranging filter condition instruction, if instruction only comprises instruction head and data field, described instruction is effective, otherwise invalid, described data field comprises predetermined word sections, the first preset time period and the second preset time period;
Step B: if the first two byte of instruction is the 0x6802 made an appointment, then described instruction is for arranging address instruction, if instruction only comprises instruction head and data field, described instruction is effective, otherwise invalid;
Step C: if the first character joint of instruction is the numerical value of making an appointment, then described instruction is other operational orders, and other operational orders described comprise opens port command, the instruction of acquisition equipment state, overcurrent parameter setting instruction, LED status idsplay order etc.
In the present embodiment particularly, when the first character joint of described instruction is 0x02, then described instruction is for opening port command, second corresponding port of byte representation of described instruction; When the first character joint of described instruction is 0x2a, then described instruction is for obtaining equipment state instruction; When the first character joint of described instruction is 0x1b, then described instruction is for arranging overcurrent parameter instruction; When the first character joint of described instruction is for 0x1c or 0x2c or 0x3c, described instruction is LED status idsplay order, wherein, first character joint is that the instruction control green indicating lamp of 0x1c is bright, first character joint is bright for 0x2c controls yellow indicator lamp, and first character joint is bright for 0x3c controls yellow indicator lamp.
Other situations are likely other instructions effective, are also likely invalid datas, to the process of these instructions not within the scope of this programme.
In the present embodiment, can also comprise before step 110:
Check that whether described instruction is complete, if complete, continue step 110, otherwise return the error code of agreement in advance to host computer;
Check that whether described instruction is complete to be specially:
Step C1: whether decision instruction length is more than two bytes, and be that then instruction is complete, ELSE instruction is imperfect;
For ease of describing, the first two byte of instruction is designated as instruction head.
Step C2: if command length is more than 3 bytes, then obtain data length from the 3rd byte, checks whether the remainder of described data length and instruction mates.
In the present embodiment, using the value of the 3rd byte of instruction as the value of data field length, in addition, can also using the value of the value of the 3rd to the 5th byte as data field length.Correspondingly, in this case, if the value of the 3rd byte is not 0, then instruction is imperfect; Otherwise the value of the 4th byte is as the high byte of data field length value, the 5th byte is as low byte.
Such as, the value of the 3rd to the 5th byte is 0x001234, then data field length value is 0x1234.
For ease of describing, the field that acquisition data field length uses is designated as the first length section.
Whether the remainder of the described data length and instruction of described inspection mates, and checks as follows:
If the length of remaining data is less than described data length, then instruction is imperfect, if the length of remaining data conforms to described data length, then instruction is complete, start in remaining data after the first length section, the part that length conforms to described length value is designated as data field; If the length of remaining data is larger than described data length, then the data segment from instruction except instruction head, the first length section and data field obtains length value, for ease of describing, the field that this acquisition length value uses is designated as the second length section.If instruction also has remaining data except instruction head, the first length section, data field and the second length section, then instruction is imperfect, and ELSE instruction is complete.
Step 111: filtration byte is set to default byte;
Step 112: the power down stand-by period is set to the first Preset Time;
Step 113: the stand-by period that will power on is set to the second Preset Time;
Step 114: return to host computer and be provided with response, return step 101.
Above-mentioned steps 111-114 can also replace with following operation: filtration byte is set to default byte, returns and is provided with response, return step 101 to host computer;
Or: the number of times receiving instruction is set to default value, returns to host computer and be provided with response, return step 101;
Or: filtration byte is set to default byte, the power down stand-by period is set to the first Preset Time, return to host computer and be provided with response, return step 101.
Further in the present embodiment, when described instruction is for arranging filter condition order, can also be perform following steps:
Step 111 ': filter condition is set;
Particularly, described filter condition is, the first byte of described instruction is the satisfied preset range of value of the 68, second byte.Such as, described preset range is 03-08, then when the first two byte of described instruction to meet in 0x6803,0x6804,0x6805,0x6806,0x6807,0x6808 any one, described instruction meets filter condition.
Step 112 ': the power down stand-by period is set to the first Preset Time;
Step 113 ': return to host computer and be provided with response, return step 101.
Or, directly perform after performing step 111 ' arrange filter condition step 113 '.
Or, step 111 ' described in filter condition is set can for arranging a filter list, described filter list can be made up of filtration byte and power down stand-by period, such as, filtration byte is the power down stand-by period that 0x6803 is corresponding is 1s, and filtration byte is the power down stand-by period that 0x6804 is corresponding is 2s etc.Then correspondingly, step 111 ' can omit afterwards step 112 ' directly perform step 113 '.
Or, step 111 ' described in filter condition be set be specially: the default specified bytes arranging described instruction meets filters byte and the number of times receiving described instruction is default value; Such as: when the first two byte of described instruction meets 0x6803, and the current metering receiving described instruction is 1, then perform power-down operation.
Or, step 111 ' described in filter condition be set be specially: the value arranging the default specified bytes of described instruction is greater than or less than the value of filtering byte.Described default specified bytes can be specified in advance from the data head of described instruction or data field.
Step 115: return to host computer and successfully receive response;
Step 116: current device address is set to destination device address, returns and performs step 101.
Particularly, this step can also be: current device address is set to destination device address, arranges address change mark, returns step 101.
Further, can start to start timing after current device address is set to destination device address, when timing reaches the 3rd Preset Time, then current device address automatic reduction is original address.
Step 117: perform corresponding operating;
Particularly, when described instruction is for opening port command, perform the operation of being opened the corresponding port of equipment, the first two byte of such as described instruction is that 0x0280 then performs the operation of being opened by the port 0 of equipment, and the first two byte is that 0x0287 then performs the operation of being opened by the port 7 of equipment.When described instruction is for obtaining equipment state instruction, perform the operation of the information such as a current value high position, current value low level, port status, a upper current limit high position, upper current limit low level of acquisition equipment; When described instruction is for arranging overcurrent parameter instruction, perform the operation that a upper current limit high position and upper current limit low level are set.
Step 118: return operation response to host computer, return and perform step 101.
In the present embodiment particularly, the first byte that the operation returned to host computer responds is 0x5a.
Embodiment two
A kind of USB device automatic power down device 6 as shown in Figure 2, comprise USB HUB chip 2, main control chip 3, device port control circuit 4 and indicator light circuit 5, wherein, described device 6 is connected with PC 1 by the port of USBHUB chip 2, be connected with USB device 7 by the port of device port control circuit 4, main control chip 3 and device port control circuit 4 are connected to USB HUB chip 2, and device port control circuit 4 and indicator light circuit 5 are connected to main control chip 3.
Described device provides the operating voltage of 5V by power supply, and the voltage that the operating voltage of 5V forms 3.3V through voltage transitions is that USB HUB chip 2 is powered.
USB HUB chip 2, for expanding USB passage, provides the interface that PC 1 is connected with USB device 7 by device port control circuit 4, for providing the data transmission channel of PC 1 with main control chip 3;
Main control chip 3, for receiving the next data of USB HUB chip 2 transmission and making respective handling, and returns respective handling result to USB HUB chip 2; For control appliance port control circuit 4 and indicator light circuit 5;
Described main control chip 3 comprises transceiver module 301, judge module 302, arranges module 303, operational module 304 and timing module 305, wherein:
Transceiver module 301, for receiving the instruction that PC 1 sends, for sending instruction response to PC 1;
Judge module 302, being provided with address for judging whether, whether meeting filter condition when arranging address for decision instruction, when not arranging instruction for decision instruction type; For judging whether timing reaches the power down stand-by period, can also be used for judging whether timing reaches the stand-by period that powers on;
Module 303 is set, for filtering byte when described instruction for arranging when arranging filter condition order and arrange the power down stand-by period, further can also be set the stand-by period that power on; For when described instruction is setting command, arranging current device address is destination device address;
Operational module 304, for resolving the instruction received, performs power-down operation to USB device during for reaching the power down stand-by period when timing, further also for performing power on operation to USB device when timing reaches and powers on the stand-by period time.
Device port control circuit 4, is directly connected with USB device 7 and main control chip 3, opens or closes USB device port for controlling;
Particularly, whether main control chip 3 controls the power on and off operation of USB device by the conducting of the triode in control appliance port control circuit 4, when triode ON, USB device port opens device power, USB device port shutdown and device looses power when triode not conducting.
Indicator light circuit 5, is used to indicate the running status of USB device 7, and such as amber light is pointed out in operation, red light prompting makes mistakes, and green light prompting runs successfully.
Further, described USB device automatic power down device 6 can also comprise:
Current converter circuit, is connected with device port control circuit 4 with main control chip 3, for the current value flowing to USB device 7 is converted to magnitude of voltage;
Overcurrent warning circuit can also be comprised, be connected with main control chip 3, for giving the alarm when the port current of USB device 7 exceedes rated current, for triggering indicator light prompting mistake.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; change can be expected easily or replace, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should described be as the criterion with the protection range of claim.

Claims (18)

1. realize a method for USB device automatic power down, it is characterized in that comprising:
Step S1: equipment receives the instruction that host computer issues;
Step S2: judging that whether current device address is consistent with destination device address, is perform step S3, otherwise perform step S5;
Step S3: judge whether described instruction meets filter condition, is, performs step S4, otherwise return execution step S1;
Step S4: power-down operation is performed to target device, then returns step S1;
Step S5: decision instruction type;
When described instruction then performs arrange filter condition operation for arranging filter condition order, and return to host computer and be provided with response, then return step S1;
When described instruction then returns reception success response to host computer for arranging address command, and current device address being set to destination device address, then returning step S1;
When described instruction other operations corresponding for other operational orders then perform, and return other operation responses corresponding to host computer, then return step S1.
2. a kind of method realizing USB device automatic power down according to claim 1, is characterized in that: described step S2 replaces with: judge whether to there is address change mark, be perform step S3, otherwise perform step S5;
Comprise after current device address being set to destination device address described in step S5 and change mark in address is set.
3. a kind of method realizing USB device automatic power down according to claim 1, it is characterized in that: comprise after step S1, start the first timer when the data of described instruction all finish receiving, or start the first timer when the data receiver of the length of making an appointment of described instruction completes.
4. a kind of method realizing USB device automatic power down according to claim 3, it is characterized in that: described step S4 is, judge whether present timing reaches the first Preset Time, then power-down operation is performed to target device and the first timer is reset, then return step S1, otherwise be in wait state and repeating said steps S4.
5. a kind of method realizing USB device automatic power down according to claim 1, is characterized in that: judge described in step S3 whether described instruction meets filter condition and be specially, judges that whether the default specified bytes of described instruction is consistent with default filtration byte;
Execution described in step S5 arranges filter condition operation and is specially, and instruction is filtered byte and is set to preset filtration byte.
6. a kind of method realizing USB device automatic power down according to claim 1, it is characterized in that: described in step S3, judge whether described instruction meets filter condition and be, judge that whether the default byte of described instruction is consistent with default filtration byte, and/or whether the current metering judging described instruction is default value;
Execution described in step S5 arranges filter condition operation and is specially, and instruction is filtered byte and is set to preset filtration byte, and/or the metering value of described instruction is set to default value.
7. a kind of method realizing USB device automatic power down according to claim 5 or 6, is characterized in that: arrange filter condition operation described in step S5 and also comprise the power down stand-by period is set to the first Preset Time.
8. a kind of method realizing USB device automatic power down according to claim 1, it is characterized in that: described in step S3, judge whether described instruction meets filter condition and be specially, judge whether the value of the default byte of described instruction meets preset range, be meet filter condition, otherwise do not meet filter condition;
Comprise before step S4 after step S3: the value according to the default byte of described instruction searches the power down stand-by period corresponding with the value of described default byte in the filter list prestored, and the described power down stand-by period found is recorded as the first Preset Time;
Perform described in step S5 and arrange filter condition operation and be specially, arrange filter list and preserve, described filter list is by filtering byte and the power down stand-by period corresponding with described filtration byte forms.
9. a kind of method realizing USB device automatic power down according to claim 1, is characterized in that: according to the content of the length of described instruction, form or preset field, step S3 judges whether described instruction meets filter condition;
Perform described in step S5 and the operation that filter condition is operating as the content performing the length, form or the preset field that arrange instruction is set.
10. a kind of method realizing USB device automatic power down according to claim 3, it is characterized in that: comprise after power-down operation being performed to target device described in step S4, judge whether present timing reaches the second Preset Time, then power on operation is performed to target device and described first timer is reset, then return step S1, otherwise be in wait state and repeat to judge whether present timing reaches the second Preset Time.
11. a kind of methods realizing USB device automatic power down according to claim 4, it is characterized in that: described in step S4, power-down operation performed to target device and comprise after described first timer clearing, start the second timer, judge whether present timing reaches the second Preset Time, then power on operation is performed to target device and described second timer is reset, then return step S1, otherwise be in wait state and repeat to judge whether present timing reaches the second Preset Time.
12. according to claim 10 or 11 a kind of method realizing USB device automatic power down, it is characterized in that: filter condition operation is set described in step S5 and also comprises the stand-by period that powers on is set to the second Preset Time.
13. a kind of methods realizing USB device automatic power down according to claim 1, is characterized in that: also comprise after performing power-down operation to target device described in step S4, current device address is reduced to equipment original address.
14. a kind of methods realizing USB device automatic power down according to claim 1, it is characterized in that: comprise after current device address being set to destination device address described in step S5, start the 3rd timer, when the timing of described 3rd timer reaches the 3rd Preset Time, then current device address automatic reduction is equipment original address.
15. a kind of methods realizing USB device automatic power down according to claim 1, is characterized in that: other operational orders described in step S5 comprise to be opened port command, obtain equipment state instruction, overcurrent parameter setting instruction, LED status idsplay order.
16. 1 kinds of devices realizing USB device automatic power down, it is characterized in that comprising: USB HUB chip (2), main control chip (3), device port control circuit (4) and indicator light circuit (5), wherein, described device is connected with PC (1) by the port of USB HUB chip (2), be connected with USB device (7) by the port of device port control circuit (4), main control chip (3) and device port control circuit (4) are connected to USB HUB chip (2), device port control circuit (4) and indicator light circuit (5) are connected to main control chip (3),
Described USB HUB chip (2), for expanding USB passage, there is provided the interface that PC (1) is connected with USB device (7) by device port control circuit (4), for providing the data transmission channel of PC (1) with main control chip (3);
Described main control chip (3), for receiving the next data of USB HUB chip (2) transmission and making respective handling, and returns respective handling result to USB HUB chip (2); For control appliance port control circuit (4) and indicator light circuit (5);
Described device port control circuit (4), is directly connected with USB device (7) and main control chip (3), opens or closes USB device port for controlling;
Described indicator light circuit (5), is used to indicate the running status of USB device (7);
Described main control chip (3) comprising:
Transceiver module (301), for receiving the instruction that PC (1) sends, for sending instruction response to PC (1);
Judge module (302), for judging that whether current device address is consistent with destination device address, and be used for decision instruction when described current device address is consistent with destination device address and whether meet filter condition, when described current device address and destination device address are inconsistent for decision instruction type; For judging whether timing reaches the power down stand-by period, for judging whether timing reaches the stand-by period that powers on;
Module (303) being set, for filtering byte when described instruction for arranging when arranging filter condition order and arrange the power down stand-by period, powering on the stand-by period for arranging; For when described instruction is setting command, arranging current device address is destination device address;
Operational module (304), for resolving the instruction received, performs power-down operation to USB device during for reaching the power down stand-by period when timing, also for performing power on operation to USB device when timing reaches and powers on the stand-by period time.
17. devices according to claim 16, it is characterized in that: described device also comprises current converter circuit, be connected with device port control circuit (4) with described main control chip (3), for the current value flowing to described USB device (7) is converted to magnitude of voltage.
18. devices according to claim 16, it is characterized in that: described device also comprises overcurrent warning circuit, be connected with described main control chip (3), for giving the alarm when the port current of described USB device (7) exceedes rated current, for triggering indicator light prompting mistake.
CN201210253758.7A 2012-07-20 2012-07-20 Device and method for realizing automatic power failure of USB (Universal Serial Bus) device Active CN102801582B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210253758.7A CN102801582B (en) 2012-07-20 2012-07-20 Device and method for realizing automatic power failure of USB (Universal Serial Bus) device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210253758.7A CN102801582B (en) 2012-07-20 2012-07-20 Device and method for realizing automatic power failure of USB (Universal Serial Bus) device

Publications (2)

Publication Number Publication Date
CN102801582A CN102801582A (en) 2012-11-28
CN102801582B true CN102801582B (en) 2015-05-27

Family

ID=47200554

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210253758.7A Active CN102801582B (en) 2012-07-20 2012-07-20 Device and method for realizing automatic power failure of USB (Universal Serial Bus) device

Country Status (1)

Country Link
CN (1) CN102801582B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109345803A (en) * 2018-09-25 2019-02-15 浙江凯耀照明股份有限公司 A kind of fast automatic method and its mechanism for generating random address code

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101170791A (en) * 2007-11-29 2008-04-30 中兴通讯股份有限公司 An industrial installation device for testing automatic power on and off
KR20090030363A (en) * 2007-09-20 2009-03-25 엠디에스테크놀로지 주식회사 System for testing embedded device and method therefor
CN101770231A (en) * 2009-12-31 2010-07-07 厦门大洋通信有限公司 Fast step control method for electric equipment
CN102222208A (en) * 2011-05-31 2011-10-19 飞天诚信科技股份有限公司 Controllable CCID (Charge Coupled Imaging Device) card reader and working method thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090030363A (en) * 2007-09-20 2009-03-25 엠디에스테크놀로지 주식회사 System for testing embedded device and method therefor
CN101170791A (en) * 2007-11-29 2008-04-30 中兴通讯股份有限公司 An industrial installation device for testing automatic power on and off
CN101770231A (en) * 2009-12-31 2010-07-07 厦门大洋通信有限公司 Fast step control method for electric equipment
CN102222208A (en) * 2011-05-31 2011-10-19 飞天诚信科技股份有限公司 Controllable CCID (Charge Coupled Imaging Device) card reader and working method thereof

Also Published As

Publication number Publication date
CN102801582A (en) 2012-11-28

Similar Documents

Publication Publication Date Title
CN101937222B (en) Board level testing system
EP2242209B1 (en) Apparatus for writing data in nonvolatile memory, and corresponding electric apparatus and ROM writer
CN103149526B (en) PCBA board test macro and method
CN112653738B (en) Internet of things network debugging system and method
CN103699112B (en) Based on avionics Autonomous test Authentication devices and the verification method thereof of I/O signal fault simulation
CN105677420A (en) Method and device for interface pin configuration
CN105955911A (en) Hot-plug control circuit and control method thereof
CN202998098U (en) Optical module port test device
CN106597156A (en) Electric submersible pump load fault determination method and device, and electric submersible pump paperless recorder
CN203352291U (en) Power terminal equipment maintenance system based on WIFI technology
CN107169388A (en) Realize the automatization test system and method for testing of SIM card hot plug function
CN106936496B (en) Hot plug device for multiple IIC communication devices
CN105676052B (en) A kind of method and system of serial ports line sequence identification
CN202693709U (en) Test tool and test system of electric equipment
CN102801582B (en) Device and method for realizing automatic power failure of USB (Universal Serial Bus) device
CN101661795A (en) Data burning method and burning system
CN105353323A (en) Detection apparatus, and fan detection system and method
CN105445533A (en) 1553B test signal monitoring module and 1553B test signal monitoring method for automatic missile test
CN204028696U (en) The proving installation of air conditioner line control machine and system
CN105223489A (en) A kind of interlock circuit testing apparatus and method of testing
CN207219048U (en) SIM card batch detecting device
CN207218682U (en) SIM card automatic detection device with protection circuit
CN102436413A (en) Debugging system and debugging method of board power supply
CN104597833A (en) PLC protection system and method
CN210199577U (en) Fault injection module and system for testing engine controller

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