The content of the invention
In consideration of it, the present invention provides detection method, device and the equipment of a kind of electronic equipment interface, solve existing for electricity
The technical problem that the testing efficiency of the external storage interface of sub- equipment is not high and test function is limited.
According to an embodiment of the invention, there is provided the detection method of a kind of electronic equipment interface, including:Detection electronic equipment connects
The External memory equipment of mouth access;The External memory equipment detected is tied to by default binding catalogue by hot plug mechanism;
The default binding catalogue and device path are saved in specified file;The default binding is read from the specified file
Catalogue and device path are to confirm that the External memory equipment whether there is;And when the External memory equipment confirms exist
When, the writing speed and reading speed of the electronic equipment interfaces are detected by sense command.
Preferably, it is described that the External memory equipment detected is tied to by default binding catalogue step by hot plug mechanism
Including:Call hot plug events processing function, and the equipment that the External memory equipment is read according to implementor name and environmental variance
The system format of node and partitioned file;And the equipment section is bound according to the system format select command of the partitioned file
Point binds catalogue to default.
Preferably, it is described to be tied up according to the system format select command of the partitioned file binding device node to default
Determining catalogue step also includes:Whether the system format for judging the partitioned file is new technology file system;When the partitioned file
System format when being judged as new technology file system, select device node described in ntfs-3g command bindings to bind catalogue to default;
And when the system format of the partitioned file judge not be new technology file system when, selection mount command bindings described in set
Slave node binds catalogue to default.
Preferably, it is described that the electronic equipment is detected by sense command in the presence of the External memory equipment confirms
The writing speed and reading speed step of interface include:The write-in speed of the interface of the electronic equipment is detected by sense command
Degree;Whether the writing speed that judgement detects is up to standard;And when said write speed is up to standard, detected by sense command described in
The reading speed of the interface of electronic equipment;And when said write speed is below standard, export said write speed and correlation
Test crash information.
Preferably, the writing speed step of the interface that the electronic equipment is detected by sense command includes:Pass through
Dd orders write the NUL stream file of default file size to the default binding catalogue and record the beginning and ending time;And according to
The default file size of the NUL stream file and beginning and ending time calculate writing speed.
Preferably, the reading speed step of the interface that the electronic equipment is detected by sense command includes:Pass through
Dd orders read the data file of default file size in the default binding catalogue and record the beginning and ending time;And according to institute
The default file size and beginning and ending time for stating data file calculate reading speed.
Preferably, in the interface for detecting the electronic equipment by sense command when said write speed is up to standard
Also include after reading speed step:Whether the reading speed that judgement detects is up to standard;And when the reading speed is up to standard,
Export writing speed, reading speed and the dependence test successful information of the electronic equipment interfaces.
Preferably, said write speed, reading speed and dependence test are exported when the reading speed is below standard to lose
Lose information.
Preferably, also include before the External memory equipment of the detection electronic equipment interfaces access:In the electronics
The hot plug events of the kernel registration External memory equipment of equipment.
Preferably, walked in the writing speed and reading speed of the interface that the electronic equipment is detected by sense command
Also include after rapid:Export writing speed, reading speed and the dependence test successful information of the electronic equipment interfaces.
According to another embodiment of the present invention, there is provided the detection means of a kind of electronic equipment interface, including:Detection unit,
For detecting the External memory equipment of electronic equipment interfaces access;Binding unit, for by hot plug mechanism by the detection
The External memory equipment that unit detects is tied to default binding catalogue;Storage unit, for by it is described it is default binding catalogue and
Device path is saved in specified file;Confirmation unit, for read from the specified file it is described it is default binding catalogue and
Device path is to confirm that the External memory equipment whether there is;And read or write speed detection unit, for when the confirmation form
In the presence of member confirms that the External memory equipment confirms, by sense command detect the electronic equipment interfaces writing speed and
Reading speed.
Preferably, the binding unit includes:Hot plug processing unit, for calling hot plug events to handle function, and
The device node of the External memory equipment and the system format of partitioned file are read according to implementor name and environmental variance;And tie up
Processing unit is determined, for the system format select command binding of the partitioned file read according to the hot plug processing unit
The device node binds catalogue to default.
Preferably, the binding processing unit includes:Zoned format judging unit, it is for judge the partitioned file
Whether form of uniting is new technology file system;Binding unit is selected, for judging the subregion when the zoned format judging unit
When the system format of file is new technology file system, device node described in ntfs-3g command bindings is selected to bind catalogue to default,
And when the zoned format judging unit judges the system format of the partitioned file not for new technology file system, selection
Device node described in mount command bindings binds catalogue to default.
Preferably, the read or write speed detection unit includes:Writing speed detection unit, for being detected by sense command
The writing speed of the interface of the electronic equipment;Judging unit, for judging that what said write speed detection unit detected writes
Whether up to standard enter speed;Reading speed detection unit, for passing through when the judging unit judges that said write speed is up to standard
Sense command detects the reading speed of the interface of the electronic equipment;And output unit, for judging when the judging unit
Said write speed and dependence test failure information are exported when writing speed is below standard.
Preferably, said write speed detection unit includes:Writing unit, for by dd orders to the default binding
The NUL stream file of catalogue write-in default file size simultaneously records the beginning and ending time;And writing speed computing unit, for root
Writing speed is calculated according to the default file size and beginning and ending time of the NUL stream file of said write unit write-in.
Preferably, the reading speed detection unit includes:Reading unit, for by dd orders in the default binding
The data file of default file size is read in catalogue and records the beginning and ending time;And reading speed computing unit, for basis
The default file size for the data file that the reading unit is read and beginning and ending time calculate reading speed.
Preferably, the judging unit is additionally operable to judge whether is reading speed that the reading speed detection unit detects
Up to standard, when the judging unit judges that the reading speed is up to standard, the output unit is additionally operable to export the electronic equipment
Writing speed, reading speed and the dependence test successful information of interface.
Preferably, when the judging unit judges that the reading speed is below standard, the output unit is additionally operable to export
Said write speed, reading speed and dependence test failure information.
Preferably, the detection means of the electronic equipment interfaces also includes hot plug events registering unit, for described
The hot plug events of the kernel registration External memory equipment of electronic equipment.
Preferably, the detection means of the electronic equipment interfaces also includes output unit, for exporting the electronic equipment
Writing speed, reading speed and the dependence test successful information of interface.
According to further embodiment of this invention, a kind of electronic equipment is also provided, the electronic equipment is set including above-mentioned electronics
The detection means of standby interface.
Detection method, device and the equipment of electronic equipment interfaces provided by the invention, bound and accessed by hot plug mechanism
External memory equipment, and the writing speed and reading speed of the interface by testing electronic equipment described in command detection be and existing
Have and compared for needing to be manually entered test command during electronic equipment interfaces test with limited test function, realize electronics and set
The standby writing speed of interface and the test of reading speed, improve the efficiency of electronic equipment interfaces test and test comprehensive.
Embodiment
Make further more detailed description to technical scheme with reference to the accompanying drawings and detailed description.It is aobvious
So, described embodiment is only the part of the embodiment of the present invention, rather than whole embodiments.Based in the present invention
Embodiment, the every other embodiment that those of ordinary skill in the art are obtained on the premise of creative work is not made,
The scope of protection of the invention should all be belonged to.
In the description of the invention, it is to be understood that term " first ", " second " etc. are only used for describing purpose, without
It is understood that to indicate or implying relative importance.In the description of the invention, it is necessary to which explanation, is provided unless otherwise clear and definite
And restriction, term " connected ", " connection " should be interpreted broadly, for example, it may be fixedly connected or be detachably connected,
Or it is integrally connected;Can be mechanical connection or electrical connection;Can be joined directly together, intermediary can also be passed through
It is indirectly connected.For the ordinary skill in the art, concrete condition can be combined and understands above-mentioned term in the present invention
Concrete meaning.In addition, in the description of the invention, unless otherwise indicated, " multiple " are meant that two or more.
Any process or method described otherwise above description in flow chart or herein is construed as, and represents to include
Module, fragment or the portion of the code of the executable instruction of one or more the step of being used to realize specific logical function or process
Point, and the scope of the preferred embodiment of the present invention includes other realization, wherein can not press shown or discuss suitable
Sequence, including according to involved function by it is basic simultaneously in the way of or in the opposite order, carry out perform function, this should be of the invention
Embodiment person of ordinary skill in the field understood.
Fig. 1 is the schematic flow sheet of the detection method of electronic equipment interfaces in first embodiment of the invention.As illustrated, this
The detection method for the electronic equipment interfaces that embodiment provides, including:
Step S101:Detect the External memory equipment of electronic equipment interfaces access.
Wherein, the electronic equipment interfaces can connect for the physical interface of any accessible External memory equipment, such as USB
Mouth, SD card interface, TF card interface etc., the expansion for realizing electronic equipment stores and the electronic data with External memory equipment
Transmission.The hot plug events of External memory equipment are registered in the electronic equipment kernel in advance, for example SD card or the heat of USB flash disk are inserted
Event is pulled out, so can access and read and write External memory equipment by interface in the case where not closing the electronic equipment.
Step S102:The External memory equipment detected is tied to by default binding catalogue by hot plug mechanism.
Specifically, the binding external storage that Fig. 2 is the detection method of electronic equipment interfaces in first embodiment of the invention is set
Standby schematic flow sheet.As illustrated, the binding external storage of the detection method of electronic equipment interfaces described in step S102 is set
Standby method, including:
Step S201:Hot plug events processing function is called, and the outside is read according to implementor name and environmental variance and deposited
Store up the device node of equipment and the system format of partitioned file.
Wherein, when electronic equipment has detected External memory equipment access, Lunix system kernels call client layer advance
The processing function udevd of hot plug events corresponding to the External memory equipment of registration, and transmit the implementor name of External memory equipment
And environmental variance, udevd read sys system files by libsysfs, so read the partition table of the External memory equipment
And device node, and obtain the file system format of each subregion.
Step S202:Whether the system format for judging the partitioned file is new technology file system.
Step S203:When the system format of the partitioned file is judged as new technology file system, ntfs-3g orders are selected
The device node is bound to default binding catalogue.
Wherein, it is described it is default binding catalogue be kernel automatically create with zone name identical catalogue, according to the subregion
The system format select command of file binds the device node to default binding catalogue.
Step S204:When the system format of the partitioned file judge not be new technology file system when, select mount order
Order binds the device node to default binding catalogue.
Step S103:The default binding catalogue and device path are saved in specified file.
The External memory equipment detected is so tied to by default binding catalogue by hot plug mechanism, electronic equipment can
With by reading the default binding catalogue and device path in the specified file, to the External memory equipment of access
Carry out follow-up reading and write-in test.
Step S104:The default binding catalogue and device path are read from the specified file to confirm the outside
Storage device whether there is.
Step S105:In the presence of External memory equipment confirmation, the electronic equipment is detected by sense command and connect
The writing speed and reading speed of mouth.
Specifically, the detection electronic equipment that Fig. 3 is the detection method of electronic equipment interfaces in first embodiment of the invention connects
The writing speed of mouth and the schematic flow sheet of reading speed.As illustrated, it is described detection electronic equipment interfaces writing speed and
The method of reading speed, is specifically included:
Step S301:The default binding catalogue and device path are read from the specified file.
Electronic equipment can be connected computer, with logical by the present embodiment when carrying out electronic equipment interfaces test by serial ports
Cross the test information that correlation was checked or printed to serial ports, such as test equipment designation number, testing time, writing speed, reading speed
Spend and be successfully tested failure information etc..
Step S302:Confirm that the External memory equipment whether there is.
Wherein, when the default binding catalogue and device path can be read in step S301, determine that the outside is deposited
Store up equipment to exist, continue follow-up writing speed and reading speed test;Catalogue and set when the default binding can not be read
During standby path, determine that the External memory equipment is not present, perform step S310 and directly export the test that detection device is not present
Failure information, the information of dependence test failure is exported or printed by serial ports of computers.
Step S303:The NUL stream file of default file size is write simultaneously to the default binding catalogue by dd orders
Record the beginning and ending time.
Step S304:Writing speed is calculated according to the default file size of the NUL stream file and beginning and ending time.
So, in step S303 and step S304, size and the time of write-in file data are copied according to dd orders, very
The writing speed of the interface of the electronic equipment is easily calculated.
Step S305:Whether the writing speed that judgement detects is up to standard.
Wherein, also it is not quite similar for different types of electronic equipment interfaces, the standard of writing speed.In the present embodiment
In, then continue the test of follow-up reading speed when writing speed is up to standard, step S310 is performed when writing speed is not up to standard
Writing speed and test crash information are directly exported, exports or print related writing speed and test crash by serial ports of computers
Information.
Step S306:The data file and note of default file size are read in the default binding catalogue by dd orders
Record the beginning and ending time.
Step S307:Reading speed is calculated according to the default file size of the data file and beginning and ending time.
So, in step S306 and step S307, size and the time for reading file data are copied according to dd orders, very
The reading speed of the interface of the electronic equipment is easily calculated.
Step S308:Whether the reading speed that judgement detects is up to standard.
Wherein, also it is not quite similar for different types of electronic equipment interfaces, the standard of reading speed.In the present embodiment
In, when reading speed is not up to standard, execution step S310 directly exports writing speed, reading speed and test crash information, passes through
Serial ports of computers exports or printed the information of related writing speed, reading speed and test crash.
Step S309:When the reading speed is up to standard, writing speed, the reading speed of the electronic equipment interfaces are exported
With dependence test successful information.
Fig. 4 is the structural representation of the detection means of the electronic equipment interfaces of second embodiment of the invention, as illustrated,
On the basis of above method embodiment, the detection means 10 for the electronic equipment interfaces that the present embodiment provides, including detection unit
101st, binding unit 102, storage unit 103, confirmation unit 104 and read or write speed detection unit 105.
The detection unit 101, for detecting the External memory equipment of electronic equipment interfaces access.Wherein, the electronics
Equipment interface can be the physical interface of any accessible External memory equipment, such as USB interface, SD card interface, TF card interface
Deng for realizing the expansion storage of electronic equipment and electronic data transfer with External memory equipment.In the present embodiment, in advance
The hot plug events that hot plug events registering unit registers External memory equipment in the electronic equipment kernel are first passed through, such as
The hot plug events of SD card or USB flash disk, so it can access and read and write by interface in the case where not closing the electronic equipment
External memory equipment.
The binding unit 102, for being set the external storage that the detection unit 101 detects by hot plug mechanism
It is standby to be tied to default binding catalogue.Fig. 5 is the binding unit 102 of the detection means of the electronic equipment interfaces of the embodiment of the present invention
Structural representation.As illustrated, the binding unit 102 includes hot plug processing unit 1021 and binding processing unit 1022.
The hot plug processing unit 1021, for calling hot plug events to handle function, and according to implementor name and environment
Variable reads the device node of the External memory equipment and the system format of partitioned file.Specifically, when the inspection of electronic equipment
When survey unit 101 has detected External memory equipment access, the hot plug processing unit 1021 of Lunix system kernels calls
The processing function udevd of hot plug events corresponding to client layer External memory equipment registered in advance, and transmit external storage and set
Standby implementor name and environmental variance, udevd read sys system files by libsysfs, so read the external storage and set
Standby partition table and device node, and obtain the file system format of each subregion.
The binding processing unit 1022 includes zoned format judging unit 10221 and selection binding unit 10222, is used for
The system format select command of the partitioned file read according to the hot plug processing unit 1021 binds the equipment section
Point binds catalogue to default.The zoned format judging unit 10221, for judge the partitioned file system format whether
For new technology file system.The selection binding unit 10222, described in judging when the zoned format judging unit 10221
When the system format of partitioned file is new technology file system, device node described in ntfs-3g command bindings is selected to default binding
Catalogue, and when the zoned format judging unit 10221 judges the system format of the partitioned file not for NTFS files
During system, device node described in mount command bindings is selected to default binding catalogue.Wherein, the default binding catalogue is interior
Core automatically create with zone name identical catalogue, the equipment is bound according to the system format select command of the partitioned file
Node binds catalogue to default.
The storage unit 103, for the default binding catalogue and device path to be saved in specified file.So
The External memory equipment detected is tied to default binding catalogue by the binding unit 102 by hot plug mechanism, and electronics is set
It is standby can be by reading the default binding catalogue and device path in the specified file, to the external storage of access
Equipment carries out follow-up reading by the read or write speed detection unit 105 and write-in is tested.
The confirmation unit 104, for read from the specified file it is described it is default binding catalogue and device path with
Confirm that the External memory equipment whether there is.The present embodiment can lead to electronic equipment when carrying out electronic equipment interfaces test
Serial ports connection computer is crossed, so that the test information of correlation, such as test equipment designation number, test are checked or printed by serial ports
Time, writing speed, reading speed and it is successfully tested failure information etc..The confirmation unit 104 reads the default binding
When catalogue and device path, determine that the External memory equipment is present, row write can be entered subsequently through read or write speed test cell 105
Enter speed and reading speed test;When the confirmation unit 104 can not read the default binding catalogue and device path,
Determine that the External memory equipment is not present, then the test crash information that directly output detection device is not present, pass through computer
Serial ports exports or the information of printing dependence test failure.
The read or write speed detection unit 105, for confirming that the External memory equipment confirms when the confirmation unit 104
In the presence of, the writing speed and reading speed of the electronic equipment interfaces are detected by sense command.Fig. 6 is real for the present invention second
The structural representation of the read or write speed detection unit of the detection means of the electronic equipment interfaces of example is applied, as illustrated, the read-write
Speed detection unit 105 includes writing speed detection unit 1051, judging unit 1052, reading speed detection unit 1053 and defeated
Go out unit 1054.
Wherein, said write speed detection unit 1051, for detecting the interface of the electronic equipment by sense command
Writing speed.Fig. 7 is the structure of the writing speed detection unit of the detection means of the electronic equipment interfaces of the embodiment of the present invention
Schematic diagram.As illustrated, said write speed detection unit 1051 further comprises that writing unit 10511 and writing speed calculate
Unit 10512.
Said write unit 10511, for writing default file size to the default binding catalogue by dd orders
NUL stream file simultaneously records the beginning and ending time.Said write speed computing unit 10512, for according to said write unit
The default file size of the NUL stream file of 10511 write-ins and beginning and ending time calculate writing speed.So, said write
Speed detection unit 1051 copies size and the time of write-in file data according to dd orders, it is easy to the electronics is calculated
The writing speed of the interface of equipment.
The judging unit 1052, for judging whether is writing speed that said write speed detection unit 1051 detects
It is up to standard.Wherein, also it is not quite similar for different types of electronic equipment interfaces, the standard of writing speed.In the present embodiment, when
Then continue to be read out the test of speed when writing speed is up to standard subsequently through the reading speed detection unit 1053, when described
When judging unit 1052 judges that writing speed is not up to standard, writing speed and test crash information are directly exported, passes through computer string
Mouth output or the information for printing related writing speed and test crash.
The reading speed detection unit 1053, for when the judging unit 1052 judges that said write speed is up to standard
The reading speed of the interface of the electronic equipment is detected by sense command.Fig. 8 is the electronic equipment of second embodiment of the invention
The structural representation of the reading speed detection unit of the detection means of interface.As illustrated, the reading speed detection unit
1053 include reading unit 10531 and reading speed computing unit 10532.
The reading unit 10531, for reading default file size in the default binding catalogue by dd orders
Data file and record the beginning and ending time.The reading speed computing unit 10532, for according to the reading unit 10531
The default file size of the data file read and beginning and ending time calculate reading speed.So, the reading speed detection
Unit 1053 copies size and the time for reading file data according to dd orders, it is easy to connecing for the electronic equipment is calculated
The reading speed of mouth.
Preferably, the judging unit 1052 can be additionally used in the reading for judging that the reading speed detection unit 1053 detects
Take speed whether up to standard.When the judging unit 1052 judges that the reading speed is up to standard, the output unit 1054 may be used also
For exporting writing speed, reading speed and the dependence test successful information of the electronic equipment interfaces;When the judging unit
1052 when judging that the reading speed is below standard, and the output unit 1054 is additionally operable to export said write speed, reading speed
And dependence test failure information.When the judging unit 1052 judges that writing speed is below standard, the output unit 1054
Export said write speed and dependence test failure information.When the confirmation unit 104 can not read the default binding
When catalogue and device path, the output unit 1054 directly exports the test crash information that detection device is not present.
Based on above-described embodiment, the present invention also provides a kind of electronic equipment, and the electronic equipment is set including above-mentioned electronics
The detection means of standby interface.
In summary, the detection method of electronic equipment interfaces provided by the invention, device and equipment, hot plug mechanism is passed through
Bind the External memory equipment of access, and the writing speed of the interface by testing electronic equipment described in command detection and reading speed
Degree, compared with needing to be manually entered test command and limited test function when the existing test for electronic equipment interfaces, realize
The writing speed of electronic equipment interfaces and the test of reading speed, improve efficiency and the test of electronic equipment interfaces tests
It is comprehensive.
It should be appreciated that each several part of the present invention can be realized with hardware, software, firmware or combinations thereof.Above-mentioned
In embodiment, software that multiple steps or method can be performed in memory and by suitable instruction execution system with storage
Or firmware is realized.If, and in another embodiment, can be with well known in the art for example, realized with hardware
Any one of row technology or their combination are realized:With the logic gates for realizing logic function to data-signal
Discrete logic, have suitable combinational logic gate circuit application specific integrated circuit, programmable gate array (PGA), scene
Programmable gate array (FPGA) etc..
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show
The description such as example " or " some examples " means to combine specific features, structure, material or the feature that the embodiment or example describe
It is contained at least one embodiment or example of the present invention.In this manual, the schematic representation of above-mentioned term is differed
Surely identical embodiment or example are referred to.Moreover, specific features, structure, material or the feature of description can be any
Combined in an appropriate manner in one or more embodiments or example.
Although an embodiment of the present invention has been shown and described, it will be understood by those skilled in the art that:Not
In the case of departing from the principle and objective of the present invention a variety of change, modification, replacement and modification can be carried out to these embodiments, this
The scope of invention is limited by claim and its equivalent.