Summary of the invention
Given this, the invention provides a kind of detection method of electronic equipment interfaces, device and equipment, the not high and technical matters that test function is limited of the testing efficiency solving the existing exterior storage interface for electronic equipment.
According to embodiments of the invention, a kind of detection method of electronic equipment interfaces is provided, comprises: the External memory equipment of detected electrons equipment interface access; By hot plug mechanism, the External memory equipment detected is tied to default binding catalogue; Described default binding catalogue and device path are saved in specified file; Described default binding catalogue and device path is read to confirm whether described External memory equipment exists from described specified file; And when described External memory equipment confirms to exist, detected writing speed and the reading speed of described electronic equipment interfaces by sense command.
Preferably, described being tied to by the External memory equipment detected by hot plug mechanism is preset binding catalogue step and is comprised: call hot plug events process function, and read the device node of described External memory equipment and the system format of partitioned file according to implementor name and environmental variance; And bind described device node to presetting binding catalogue according to the system format select command of described partitioned file.
Preferably, the described system format select command according to described partitioned file is bound described device node and is also comprised to presetting binding catalogue step: whether the system format judging described partitioned file is new technology file system; When the system format of described partitioned file is judged as new technology file system, select device node described in ntfs-3g command binding to presetting binding catalogue; And when the system format of described partitioned file judges not as new technology file system, select device node described in mount command binding to presetting binding catalogue.
Preferably, describedly the writing speed of the interface of described electronic equipment is detected when described External memory equipment confirms to exist by sense command and reading speed step comprises: the writing speed being detected the interface of described electronic equipment by sense command; Judge that whether the writing speed detected is up to standard; And when said write speed is up to standard, detected the reading speed of the interface of described electronic equipment by sense command; And when said write speed is below standard, export said write speed and dependence test failure information.
Preferably, the described writing speed step being detected the interface of described electronic equipment by sense command is comprised: write the null character (NUL) stream file of default file size by dd order to described default binding catalogue and record the beginning and ending time; And calculate writing speed according to the default file size of described null character (NUL) stream file and beginning and ending time.
Preferably, the described reading speed step being detected the interface of described electronic equipment by sense command is comprised: in described default binding catalogue, read the data file of default file size by dd order and record the beginning and ending time; And calculate reading speed according to the default file size of described data file and beginning and ending time.
Preferably, described detected the reading speed step of the interface of described electronic equipment by sense command when said write speed is up to standard after also comprise: judge that whether the reading speed that detects up to standard; And when described reading speed is up to standard, export the writing speed of described electronic equipment interfaces, reading speed and dependence test successful information.
Preferably, said write speed, reading speed and dependence test failure information is exported when described reading speed is below standard.
Preferably, also comprised before the External memory equipment of described detected electrons equipment interface access: at the hot plug events of the kernel registration External memory equipment of described electronic equipment.
Preferably, also comprise after the writing speed being detected the interface of described electronic equipment by sense command described and reading speed step: export the writing speed of described electronic equipment interfaces, reading speed and dependence test successful information.
According to another embodiment of the present invention, a kind of pick-up unit of electronic equipment interfaces is provided, comprises: detecting unit, for the External memory equipment of detected electrons equipment interface access; Binding unit, for being tied to default binding catalogue by hot plug mechanism by the External memory equipment that described detecting unit detects; Storage unit, for being saved in specified file by described default binding catalogue and device path; Confirmation unit, for reading described default binding catalogue and device path to confirm whether described External memory equipment exists from described specified file; And read or write speed detecting unit, during for confirming that when described confirmation unit described External memory equipment confirms to exist, detected writing speed and the reading speed of described electronic equipment interfaces by sense command.
Preferably, described binding unit comprises: hot plug processing unit, for calling hot plug events process function, and reads the device node of described External memory equipment and the system format of partitioned file according to implementor name and environmental variance; And binding processing unit, the system format select command for the described partitioned file read according to described hot plug processing unit binds described device node to presetting binding catalogue.
Preferably, described binding processing unit comprises: zoned format judging unit, for judging whether the system format of described partitioned file is new technology file system; Select binding unit, for when the system format that described zoned format judging unit judges described partitioned file is new technology file system, select device node described in ntfs-3g command binding to presetting binding catalogue, and when described zoned format judging unit judges the system format of described partitioned file not as new technology file system, select device node described in mount command binding to presetting binding catalogue.
Preferably, described read or write speed detecting unit comprises: writing speed detecting unit, for being detected the writing speed of the interface of described electronic equipment by sense command; Judging unit, whether up to standard for judging the writing speed that said write speed detection unit detects; Reading speed detecting unit, for detecting the reading speed of the interface of described electronic equipment by sense command when described judging unit judges that said write speed is up to standard; And output unit, for exporting said write speed and dependence test failure information when described judging unit judges that writing speed is below standard.
Preferably, said write speed detection unit comprises: writing unit, for being write the null character (NUL) stream file of default file size by dd order to described default binding catalogue and record the beginning and ending time; And writing speed computing unit, calculate writing speed for the default file size of described null character (NUL) stream file that writes according to said write unit and beginning and ending time.
Preferably, described reading speed detecting unit comprises: reading unit, for reading the data file of default file size by dd order in described default binding catalogue and recording the beginning and ending time; And reading speed computing unit, calculate reading speed for the default file size of described data file that reads according to described reading unit and beginning and ending time.
Preferably, whether described judging unit is also up to standard for judging the reading speed that described reading speed detecting unit detects, when described judging unit judges that described reading speed is up to standard, described output unit is also for exporting the writing speed of described electronic equipment interfaces, reading speed and dependence test successful information.
Preferably, when described judging unit judges that described reading speed is below standard, described output unit is also for exporting said write speed, reading speed and dependence test failure information.
Preferably, the pick-up unit of described electronic equipment interfaces also comprises hot plug events registering unit, for the hot plug events of the kernel registration External memory equipment at described electronic equipment.
Preferably, the pick-up unit of described electronic equipment interfaces also comprises output unit, for exporting the writing speed of described electronic equipment interfaces, reading speed and dependence test successful information.
According to further embodiment of this invention, also provide a kind of electronic equipment, described electronic equipment comprises the pick-up unit of above-mentioned electronic equipment interfaces.
The detection method of electronic equipment interfaces provided by the invention, device and equipment, by the External memory equipment of hot plug mechanism binding access, and writing speed and the reading speed of the interface of described electronic equipment is detected by test instruction, with existing test for electronic equipment interfaces time need manual input test order to compare with limited test function, achieve the writing speed of electronic equipment interfaces and the test of reading speed, improve the efficiency of electronic equipment interfaces test and the comprehensive of test.
Embodiment
Below in conjunction with the drawings and specific embodiments, more detailed description is further done to technical scheme of the present invention.Obviously, described embodiment is only a part of embodiment of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under the prerequisite of not making creative work, all should belong to the scope of protection of the invention.
In describing the invention, it is to be appreciated that term " first ", " second " etc. are only for describing object, and instruction or hint relative importance can not be interpreted as.In describing the invention, it should be noted that, unless otherwise clearly defined and limited, term " is connected ", " connection " should be interpreted broadly, such as, can be fixedly connected with, also can be removably connect, or connect integratedly; Can be mechanical connection, also can be electrical connection; Can be directly be connected, also indirectly can be connected by intermediary.For the ordinary skill in the art, above-mentioned term concrete meaning in the present invention can be understood in conjunction with concrete condition.In addition, in describing the invention, except as otherwise noted, the implication of " multiple " is two or more.
Describe and can be understood in process flow diagram or in this any process otherwise described or method, represent and comprise one or more for realizing the module of the code of the executable instruction of the step of specific logical function or process, fragment or part, and the scope of the preferred embodiment of the present invention comprises other realization, wherein can not according to order that is shown or that discuss, comprise according to involved function by the mode while of basic or by contrary order, carry out n-back test, this should understand by embodiments of the invention person of ordinary skill in the field.
Fig. 1 is the schematic flow sheet of the detection method of electronic equipment interfaces in first embodiment of the invention.As shown in the figure, the detection method of the electronic equipment interfaces that the present embodiment provides, comprising:
Step S101: the External memory equipment of detected electrons equipment interface access.
Wherein, described electronic equipment interfaces can be the physical interface of accessible External memory equipment arbitrarily, such as USB interface, SD card interface, TF card interface etc., for realizing the expansion storage of electronic equipment and the electronic data transfer with External memory equipment.In described electronic equipment kernel, register the hot plug events of External memory equipment in advance, the such as hot plug events of SD card or USB flash disk, can be accessed by interface when not closing described electronic equipment and read and write External memory equipment like this.
Step S102: the External memory equipment detected is tied to default binding catalogue by hot plug mechanism.
Concrete, Fig. 2 is the schematic flow sheet of the binding External memory equipment of the detection method of electronic equipment interfaces in first embodiment of the invention.As shown in the figure, the method for the binding External memory equipment of the detection method of electronic equipment interfaces described in step S102, comprising:
Step S201: call hot plug events process function, and read the device node of described External memory equipment and the system format of partitioned file according to implementor name and environmental variance.
Wherein, when electronic equipment has detected that External memory equipment accesses, the process function udevd of the hot plug events that the External memory equipment of Lunix system kernel invoke user layer registered in advance is corresponding, and transmit implementor name and the environmental variance of External memory equipment, udevd reads sys system file by libsysfs, the partition table of the described External memory equipment of such reading and device node, and obtain the file system format of each subregion.
Step S202: whether the system format judging described partitioned file is new technology file system.
Step S203: when the system format of described partitioned file is judged as new technology file system, selects device node described in ntfs-3g command binding to presetting binding catalogue.
Wherein, described default binding catalogue is the catalogue identical with zone name that kernel creates automatically, binds described device node to presetting binding catalogue according to the system format select command of described partitioned file.
Step S204: when the system format of described partitioned file judges not as new technology file system, selects device node described in mount command binding to presetting binding catalogue.
Step S103: described default binding catalogue and device path are saved in specified file.
By hot plug mechanism, the External memory equipment detected is tied to default binding catalogue like this, electronic equipment by the described default binding catalogue in the described specified file of reading and device path, can carry out follow-up reading and write test to the described External memory equipment of access.
Step S104: read described default binding catalogue and device path to confirm whether described External memory equipment exists from described specified file.
Step S105: when described External memory equipment confirms to exist, detected writing speed and the reading speed of described electronic equipment interfaces by sense command.
Concrete, Fig. 3 is the writing speed of detected electrons equipment interface and the schematic flow sheet of reading speed of the detection method of electronic equipment interfaces in first embodiment of the invention.As shown in the figure, the described writing speed of detected electrons equipment interface and the method for reading speed, specifically comprise:
Step S301: read described default binding catalogue and device path from described specified file.
The present embodiment is when carrying out electronic equipment interfaces test, electronic equipment can be connected computing machine by serial ports, to be checked by serial ports or to print relevant detecting information, such as testing apparatus designation number, test duration, writing speed, reading speed and test success failure information etc.
Step S302: confirm whether described External memory equipment exists.
Wherein, when described default binding catalogue and device path can be read in step S301, determine that described External memory equipment exists, continue follow-up writing speed and reading speed test; When described default binding catalogue and device path can not be read, determine that described External memory equipment does not exist, perform the non-existent test crash information of step S310 direct output detections equipment, exported or print the information of dependence test failure by serial ports of computers.
Step S303: write the null character (NUL) stream file of default file size by dd order to described default binding catalogue and record the beginning and ending time.
Step S304: according to default file size and the beginning and ending time calculating writing speed of described null character (NUL) stream file.
Like this, in step S303 and step S304, according to size and the time of dd order copy writing in files data, be easy to the writing speed of the interface calculating described electronic equipment.
Step S305: judge that whether the writing speed detected is up to standard.
Wherein, for dissimilar electronic equipment interfaces, the standard of writing speed is also not quite similar.In the present embodiment, the test of follow-up reading speed is then continued when writing speed is up to standard, perform step S310 when writing speed is not up to standard and directly export writing speed and test crash information, exported or print the information of relevant writing speed and test crash by serial ports of computers.
Step S306: read the data file of default file size by dd order in described default binding catalogue and record the beginning and ending time.
Step S307: according to default file size and the beginning and ending time calculating reading speed of described data file.
Like this, in step S306 and step S307, according to size and the time of dd order copy file reading data, be easy to the reading speed of the interface calculating described electronic equipment.
Step S308: judge that whether the reading speed detected is up to standard.
Wherein, for dissimilar electronic equipment interfaces, the standard of reading speed is also not quite similar.In the present embodiment, perform step S310 when reading speed is not up to standard and directly export writing speed, reading speed and test crash information, exported or print the information of relevant writing speed, reading speed and test crash by serial ports of computers.
Step S309: when described reading speed is up to standard, exports the writing speed of described electronic equipment interfaces, reading speed and dependence test successful information.
Fig. 4 is the structural representation of the pick-up unit of the electronic equipment interfaces of second embodiment of the invention, as shown in the figure, on the basis of said method embodiment, the pick-up unit 10 of the electronic equipment interfaces that the present embodiment provides, comprises detecting unit 101, binding unit 102, storage unit 103, confirmation unit 104 and read or write speed detecting unit 105.
Described detecting unit 101, for the External memory equipment of detected electrons equipment interface access.Wherein, described electronic equipment interfaces can be the physical interface of accessible External memory equipment arbitrarily, such as USB interface, SD card interface, TF card interface etc., for realizing the expansion storage of electronic equipment and the electronic data transfer with External memory equipment.In the present embodiment, in described electronic equipment kernel, the hot plug events of External memory equipment is registered in advance by hot plug events registering unit, the such as hot plug events of SD card or USB flash disk, can be accessed by interface when not closing described electronic equipment and read and write External memory equipment like this.
Described binding unit 102, for being tied to default binding catalogue by hot plug mechanism by the External memory equipment that described detecting unit 101 detects.Fig. 5 is the structural representation of the binding unit 102 of the pick-up unit of the electronic equipment interfaces of the embodiment of the present invention.As shown in the figure, described binding unit 102 comprises hot plug processing unit 1021 and binding processing unit 1022.
Described hot plug processing unit 1021, for calling hot plug events process function, and reads the device node of described External memory equipment and the system format of partitioned file according to implementor name and environmental variance.Concrete, when the detecting unit 101 of electronic equipment has detected that External memory equipment accesses, the process function udevd of the hot plug events that the External memory equipment of the described hot plug processing unit 1021 invoke user layer registered in advance of Lunix system kernel is corresponding, and transmit implementor name and the environmental variance of External memory equipment, udevd reads sys system file by libsysfs, the partition table of the described External memory equipment of such reading and device node, and obtain the file system format of each subregion.
Described binding processing unit 1022 comprises zoned format judging unit 10221 and selects binding unit 10222, and the system format select command for the described partitioned file read according to described hot plug processing unit 1021 binds described device node to presetting binding catalogue.Described zoned format judging unit 10221, for judging whether the system format of described partitioned file is new technology file system.Described selection binding unit 10222, for when the system format that described zoned format judging unit 10221 judges described partitioned file is new technology file system, select device node described in ntfs-3g command binding to presetting binding catalogue, and when described zoned format judging unit 10221 judges the system format of described partitioned file not as new technology file system, select device node described in mount command binding to presetting binding catalogue.Wherein, described default binding catalogue is the catalogue identical with zone name that kernel creates automatically, binds described device node to presetting binding catalogue according to the system format select command of described partitioned file.
Described storage unit 103, for being saved in described default binding catalogue and device path in specified file.The External memory equipment detected is tied to default binding catalogue by hot plug mechanism by described like this binding unit 102, electronic equipment by the described default binding catalogue in the described specified file of reading and device path, can carry out follow-up reading and write test to the described External memory equipment of access by described read or write speed detecting unit 105.
Described confirmation unit 104, for reading described default binding catalogue and device path to confirm whether described External memory equipment exists from described specified file.The present embodiment is when carrying out electronic equipment interfaces test, electronic equipment can be connected computing machine by serial ports, to be checked by serial ports or to print relevant detecting information, such as testing apparatus designation number, test duration, writing speed, reading speed and test success failure information etc.When described confirmation unit 104 reads described default binding catalogue and device path, determine that described External memory equipment exists, writing speed and reading speed test can be carried out subsequently through read or write speed test cell 105; When described confirmation unit 104 can not read described default binding catalogue and device path, determine that described External memory equipment does not exist, then the direct non-existent test crash information of output detections equipment, exports or prints the information of dependence test failure by serial ports of computers.
Described read or write speed detecting unit 105, during for confirming that when described confirmation unit 104 described External memory equipment confirms to exist, detects writing speed and the reading speed of described electronic equipment interfaces by sense command.Fig. 6 is the structural representation of the read or write speed detecting unit of the pick-up unit of the electronic equipment interfaces of second embodiment of the invention, as shown in the figure, described read or write speed detecting unit 105 comprises writing speed detecting unit 1051, judging unit 1052, reading speed detecting unit 1053 and output unit 1054.
Wherein, said write speed detection unit 1051, for detecting the writing speed of the interface of described electronic equipment by sense command.Fig. 7 is the structural representation of the writing speed detecting unit of the pick-up unit of the electronic equipment interfaces of the embodiment of the present invention.As shown in the figure, said write speed detection unit 1051 comprises writing unit 10511 and writing speed computing unit 10512 further.
Said write unit 10511, for being write the null character (NUL) stream file of default file size by dd order to described default binding catalogue and record the beginning and ending time.Said write speed computing unit 10512, calculates writing speed for the default file size of described null character (NUL) stream file that writes according to said write unit 10511 and beginning and ending time.Like this, said write speed detection unit 1051, according to the size of dd order copy writing in files data and time, is easy to the writing speed of the interface calculating described electronic equipment.
Described judging unit 1052, whether up to standard for judging the writing speed that said write speed detection unit 1051 detects.Wherein, for dissimilar electronic equipment interfaces, the standard of writing speed is also not quite similar.In the present embodiment, the test carrying out reading speed subsequently through described reading speed detecting unit 1053 is then continued when writing speed is up to standard, when described judging unit 1052 judges that writing speed is not up to standard, direct output writing speed and test crash information, export or print the information of relevant writing speed and test crash by serial ports of computers.
Described reading speed detecting unit 1053, for detecting the reading speed of the interface of described electronic equipment by sense command when described judging unit 1052 judges that said write speed is up to standard.Fig. 8 is the structural representation of the reading speed detecting unit of the pick-up unit of the electronic equipment interfaces of second embodiment of the invention.As shown in the figure, described reading speed detecting unit 1053 comprises reading unit 10531 and reading speed computing unit 10532.
Described reading unit 10531, for reading the data file of default file size by dd order and recording the beginning and ending time in described default binding catalogue.Described reading speed computing unit 10532, for default file size and the beginning and ending time calculating reading speed of the described data file according to described reading unit 10531 reading.Like this, described reading speed detecting unit 1053, according to the size of dd order copy file reading data and time, is easy to the reading speed of the interface calculating described electronic equipment.
Preferably, described judging unit 1052 also can be used for judging that whether the reading speed that described reading speed detecting unit 1053 detects is up to standard.When described judging unit 1052 judges that described reading speed is up to standard, described output unit 1054 also can be used for exporting the writing speed of described electronic equipment interfaces, reading speed and dependence test successful information; When described judging unit 1052 judges that described reading speed is below standard, described output unit 1054 is also for exporting said write speed, reading speed and dependence test failure information.When described judging unit 1052 judges that writing speed is below standard, described output unit 1054 exports said write speed and dependence test failure information.When described confirmation unit 104 can not read described default binding catalogue and device path, described output unit 1054 is the non-existent test crash information of output detections equipment directly.
Based on above-described embodiment, the present invention also provides a kind of electronic equipment, and described electronic equipment comprises the pick-up unit of above-mentioned electronic equipment interfaces.
In sum, the detection method of electronic equipment interfaces provided by the invention, device and equipment, by the External memory equipment of hot plug mechanism binding access, and writing speed and the reading speed of the interface of described electronic equipment is detected by test instruction, with existing test for electronic equipment interfaces time need manual input test order to compare with limited test function, achieve the writing speed of electronic equipment interfaces and the test of reading speed, improve the efficiency of electronic equipment interfaces test and the comprehensive of test.
Should be appreciated that each several part of the present invention can realize with hardware, software, firmware or their combination.In the above-described embodiment, multiple step or method can with to store in memory and the software performed by suitable instruction execution system or firmware realize.Such as, if realized with hardware, the same in another embodiment, can realize by any one in following technology well known in the art or their combination: the discrete logic with the logic gates for realizing logic function to data-signal, there is the special IC of suitable combinational logic gate circuit, programmable gate array (PGA), field programmable gate array (FPGA) etc.
In the description of this instructions, reference term " embodiment ", " some embodiments ", " example ", " concrete example " or " some examples " etc. describe the specific features, structure, material or the feature that mean to describe in conjunction with this embodiment or example and are contained at least one embodiment of the present invention or example.In this manual, identical embodiment or example are not necessarily referred to the schematic representation of above-mentioned term.And the specific features of description, structure, material or feature can combine in an appropriate manner in any one or more embodiment or example.
Although illustrate and describe embodiments of the invention, those having ordinary skill in the art will appreciate that: can carry out multiple change, amendment, replacement and modification to these embodiments when not departing from principle of the present invention and aim, scope of the present invention is by claim and equivalents thereof.