Device detection method, detection device and computer readable storage medium

By periodically restarting the testing device and sending testing commands, and receiving return information to generate documents, the problems of low efficiency and poor reliability in USB device testing are solved, realizing automatic testing and result recording, and reducing costs.

CN113220510BActive Publication Date: 2024-11-29SHENZHEN YIHUA COMP +2
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010070026.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-21
Publication Date
2024-11-29
Estimated Expiration
2040-01-21

AI Technical Summary

Technical Problem

Existing USB device testing methods rely on manual testing, which is labor-intensive, not available 24/7, prone to missed detections, and highly dependent on external devices, resulting in low testing efficiency, poor reliability, and high costs.

Method used

The testing equipment restarts and sends testing commands according to a preset cycle, receives return information from the device under test, generates testing documents, automatically records testing results, calculates the failure probability, and achieves automatic testing and recording.

Benefits of technology

It improves testing efficiency and reliability, reduces testing costs, and decreases reliance on external equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113220510B_ABST
    Figure CN113220510B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a device detection method, which includes: restarting the detection device according to a preset cycle and sending a detection instruction to the device under test after starting, the detection instruction is used to make the device under test send return information to the detection device; judging whether the detection device receives the return information sent by the device under test; if the return information is received, generating a detection document according to the return information; wherein the device under test is connected to the detection device through a detection interface. The present invention can improve detection efficiency, improve detection reliability, and reduce detection costs. The present invention also discloses a detection device and a computer-readable storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automatic detection technology, and in particular to a device detection method, a detection device and a computer-readable storage medium. Background Art

[0002] As more and more products use USB (Universal Serial Bus) interfaces to communicate with external devices, in order to ensure that USB devices can be properly identified, a large number of USB function tests are usually required, that is, the enumeration reliability of USB devices needs to be tested under various operating systems, so the workload is huge.

[0003] At present, most USB device detection methods are manual detection, which involves repeatedly plugging and unplugging USB devices manually to connect to an external host for detection. The detection workload is huge, and it is impossible to detect all day. It is easy for product abnormalities to not be detected due to insufficient detection, and it is difficult to count the number of detections.

[0004] If other external devices are used to control the connection of the USB device, so as to implement the detection of the USB device, it is necessary to rely on the external device, which is highly dependent on the detection environment. Summary of the invention

[0005] Based on this, it is necessary to propose a device detection method, a detection device and a computer-readable storage medium to address the above problems.

[0006] A device detection method, the method comprising: restarting a detection device according to a preset cycle and sending a detection instruction to a device under test after restarting, the detection instruction being used to make the device under test send return information to the detection device; judging whether the detection device has received the return information sent by the device under test; if the return information is received, generating a detection document according to the return information; wherein the device under test is connected to the detection device via a detection interface.

[0007] Wherein, after the step of judging whether the detection device has received the return information sent by the device under test, the method further comprises: if the return information is not received, stopping the restarting of the detection device and subsequent steps.

[0008] Wherein, after the step of stopping the execution of the restarting detection device and subsequent steps, it includes: counting the number of the detection documents, and calculating the failure probability of the device under test according to the number.

[0009] The step of generating a detection document according to the returned information includes: obtaining a receiving time of the returned information, and naming the detection document according to the receiving time.

[0010] Wherein, after the step of generating the detection document according to the returned information, the method further comprises: storing the detection document in a folder named after the identifier of the device to be tested.

[0011] Wherein, before the step of restarting the detection device according to the preset period, the step includes: reading a detection file in the startup directory, wherein the detection file includes the preset period.

[0012] The detection instruction includes a version query instruction, and the returned information includes firmware version information of the device under test.

[0013] A detection device comprises: a sending module, which is used to restart the detection device according to a preset cycle and send a detection instruction to the device under test after starting, so that the device under test can respond to the detection instruction and send return information to the detection device; a judgment module, which is used to judge whether the return information sent by the device under test is received; and a generation module, which is used to generate a detection document according to the return information if the return information is received; wherein the device under test is connected to the detection device through a detection interface.

[0014] A detection device includes: a processor, a memory and a communication circuit, wherein the processor is coupled to the memory and the communication circuit, the memory stores a computer program, and the processor executes the computer program to implement the method described above.

[0015] A computer-readable storage medium stores a computer program, wherein the computer program can be executed by a processor to implement the method as described above.

[0016] The embodiments of the present invention have the following beneficial effects:

[0017] The detection device is restarted according to a preset cycle and the device under test sends a detection instruction after startup. The detection instruction is used to enable the device under test to send return information to the detection device. If the return information is received, it means that the device under test functions normally in this round of detection. A detection document is generated to record this detection. The detection device can automatically detect the device under test and automatically record the detection results without relying on external devices. It can effectively improve the efficiency of detection, improve the reliability of detection, and reduce the cost of detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] in:

[0020] Figure 1 is a schematic flow chart of a first embodiment of a device detection method provided by the present invention;

[0021] Figure 2 is a flow chart of a second embodiment of the device detection method provided by the present invention;

[0022] Figure 3 is a flow chart of a third embodiment of the device detection method provided by the present invention;

[0023] Figure 4 is a schematic structural diagram of a first embodiment of a detection device provided by the present invention;

[0024] Figure 5 is a structural schematic diagram of a second embodiment of a detection device provided by the present invention;

[0025] Figure 6 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION

[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0027] At present, most USB device detection methods are manual detection, manually repeatedly plugging and unplugging USB devices to connect to an external host for detection. The detection workload is huge, and it is impossible to detect all day. It is easy to fail to detect product abnormalities due to insufficient detection, and it is difficult to count the number of detections. If other external devices are used to control the connection of USB devices to achieve USB device detection, it is necessary to rely on the external device, which is highly dependent on the detection environment.

[0028] In this embodiment, in order to solve the above problems, a device detection method is provided, which can improve detection efficiency, increase detection reliability, and reduce detection costs.

[0029] See also Figure 1 , Figure 1 1 is a flow chart of a first embodiment of a device detection method provided by the present invention. The device detection method provided by the present invention comprises the following steps:

[0030] S101: Restarting the detection device according to a preset cycle and sending a detection instruction to the device under test after restarting.

[0031] In a specific implementation scenario, the detection device and the device under test are connected via a detection interface. In this implementation scenario, the detection interface is a USB (Universal Serial Bus) interface, and the device under test is a password-based keyboard. In other implementation scenarios, the detection interface can also be other data transmission interfaces, such as a Lightning Dock interface, and the device under test can also be an external device such as a mobile hard disk or a mouse.

[0032] The detection device is restarted according to a preset period to realize power supply and power off of the device to be tested within the preset period. In this implementation scenario, the preset period is 50s, and in other implementation scenarios it can also be 30s, 40s or 60s.

[0033] After startup, the detection device sends a detection instruction to the device under test, so that the device under test can respond to the detection instruction and send return information to the detection device. In this implementation scenario, the detection instruction is a version instruction, and the return information is the firmware version information of the device under test. In other implementation scenarios, the detection instruction can also be other query instructions, such as a file query instruction, and the return information is file query result information.

[0034] S102: Determine whether the detection device has received the return information sent by the device under test. If yes, execute step S103.

[0035] In this implementation scenario, if the detection interface functions normally and is connected to the device under test normally, the detection instruction can be successfully transmitted to the device under test. If the device under test functions normally, it will respond to the detection instruction and send return information to the detection device. The return information is sent to the detection device through the detection interface, and the detection device successfully receives the return information. If one of the detection interface function, the connection between the detection interface and the device under test, and the function of the device under test is abnormal, the detection device will not be able to receive the return information.

[0036] Therefore, in this implementation scenario, it is determined whether the return information sent by the device under test is received. If it is successfully received, it means that the device under test functions normally in this round of detection. If the return information is not received, it means that the device under test may have a fault in this round of detection.

[0037] S103: Generate a test document according to the returned information.

[0038] In this implementation scenario, the detection device successfully receives the return information, indicating that the device under test functions normally in this round of detection, and generates a detection document based on the return information. For example, the content of the return information is saved in the form of a document, or a blank document is generated. The detection document is used to indicate that the device under test functions normally in this round of detection.

[0039] In other implementation scenarios, other methods may be used to record whether the function of the device under test in this round of testing is normal. For example, a counter is set, and when the testing device successfully receives the return information, the count of the counter is increased by one.

[0040] It can be seen from the above description that in this embodiment, the detection device is restarted according to a preset cycle and the device under test sends a detection instruction after startup. The detection instruction is used to enable the device under test to send return information to the detection device. If the return information is received, it means that the device under test functions normally in this round of detection, and a detection document is generated to record this detection. The detection device can automatically detect the device under test and automatically record the detection results without relying on external devices. The detection efficiency can be effectively improved, the reliability of detection can be improved, and the detection cost can be reduced.

[0041] See also Figure 2 , Figure 2 1 is a flow chart of a second embodiment of the device detection method provided by the present invention. The device detection method provided by the present invention comprises the following steps:

[0042] S201: Restarting the detection device according to a preset cycle and sending a detection instruction to the device under test after restarting, where the detection instruction is used to enable the device under test to send return information to the detection device.

[0043] S202: Determine whether the return information sent by the device under test is received. If yes, execute step S203; if no, execute step S203.

[0044] S203: Generate a test document according to the returned information.

[0045] In a specific implementation scenario, steps S201-S203 are substantially consistent with steps S101-S103 of the first embodiment of the device detection method provided by the present invention, and are not described in detail herein.

[0046] S204: Stop executing the restart detection device and subsequent steps.

[0047] In this implementation scenario, if the detection device does not receive the return information, it means that the device under test may have a fault in this round of detection, and the restart and subsequent steps after the restart are stopped. Since no return information is received, no detection document will be generated.

[0048] In other implementation scenarios, an alarm message may also be sent to the user to inform the user of the result of this round of detection.

[0049] S205: Count the number of test documents, and calculate the failure probability of the device under test according to the number.

[0050] In this implementation scenario, the number of test documents generated by the test before the current round of test is counted. Each test document represents a successful round of test. The failure probability of the device under test is calculated based on the number of test documents. For example, if the number of test documents before the current round of test is 199, the failure probability of the device under test is 1 / 200.

[0051] According to the above description, in this embodiment, the detection device is restarted according to a preset cycle and the device to be tested sends a detection instruction after the restart. The detection instruction is used to enable the device to be tested to send return information to the detection device. If no return information is received, it means that this round of detection has failed, and the restart and subsequent steps are stopped. The number of detection documents generated by the detection before the current round of detection is counted, and the failure probability of the device to be tested is calculated according to the number of detection documents. The detection device can automatically detect the device to be tested, and automatically record and count the detection results, and calculate the failure probability without relying on external devices. The efficiency of detection can be effectively improved, the reliability of detection can be improved, and the detection cost can be reduced.

[0052] See also Figure 3 , Figure 3 1 is a flow chart of a third embodiment of the device detection method provided by the present invention. The device detection method provided by the present invention comprises the following steps:

[0053] S301: Read the detection file in the startup directory.

[0054] In a specific implementation scenario, the user writes a detection file according to the test requirements. In this implementation scenario, the detection file is a VBS script file, which is placed in the startup directory of the detection device. The VBS script file contains a preset cycle for restarting the detection device.

[0055] S302: Restart the detection device according to a preset period and send a detection instruction to the device under test after restarting.

[0056] In this implementation scenario, the detection device restarts according to the preset cycle in the VBS script file, and sends a detection instruction to the device under test after restarting. The detection instruction is used to make the device under test send return information to the detection device. Specifically, step S101 in the first embodiment of the device detection method provided by the present invention is not repeated here.

[0057] In this implementation scenario, the detection device can be connected to multiple devices under test at the same time, and the detection device sends detection instructions to the multiple devices under test at the same time after startup.

[0058] S303: Determine whether the return information sent by the device under test is received. If yes, execute step S304, if not, execute step S306.

[0059] In this implementation scenario, if the detection interface functions normally and is connected to the device under test normally, the detection instruction can be successfully transmitted to the device under test. If the device under test functions normally, it will respond to the detection instruction and send return information to the detection device. The return information is sent to the detection device through the detection interface, and the detection device successfully receives the return information. If one of the detection interface function, the connection between the detection interface and the device under test, and the function of the device under test is abnormal, the detection device will not be able to receive the return information.

[0060] In this implementation scenario, the detection device is connected to multiple devices under test at the same time. If the detection device does not receive the return information from at least one device under test, step S306 is performed for the device under test. If the detection device receives the return information sent by at least one device under test, step S304 is performed for the at least one device under test. Since the reaction speed and operation speed of multiple devices under test, as well as the delay of sending and receiving information are different, a waiting time can be preset. After the detection device sends the detection instruction, if the detection device still does not receive the return information sent by the device under test after the preset waiting time, it is determined that the return information sent by the device under test has not been received. The preset waiting time is less than the length of the preset cycle.

[0061] S304: Generate a detection document according to the returned information, obtain the receiving time of the returned information, and name the detection document according to the receiving time.

[0062] In this implementation scenario, the detection device receives a detection document sent by at least one device to be tested, and generates a corresponding detection document according to each return message. The receiving time of the return message is obtained, and the detection document is named after the receiving time. In this implementation scenario, the detection document is a blank document in txt format. In other implementation scenarios, the detection document can also be in other file formats, such as word, excel, etc. For example, if the receiving time is 13:54 on November 24, 2019, the detection document is named 20191124_1354_685.txt. Among them, 685 can be an identifier for distinction, such as the 685th return message received by the detection device, to prevent the inability to distinguish when multiple return messages are received at the same time.

[0063] S305: Storing the detection document in a folder named after the identifier of the device to be tested.

[0064] In this implementation scenario, since the detection device is connected to multiple devices to be tested, it is necessary to store the detection documents generated according to the return information sent by different detection devices in folders named after the identifiers of the corresponding detection devices.

[0065] In this implementation scenario, before or at the start of the first round of testing, the identification of each device under test is obtained, and a folder is created for each device under test. Each folder is named after the identification of the device under test corresponding to it. The identification of the device under test can be manually input by the user or automatically obtained by the detection device.

[0066] S306: Stop executing the restart detection device and subsequent steps.

[0067] In this implementation scenario, if the device under test does not receive the return information of at least one device under test, the restart of the detection device and subsequent steps are stopped. In this implementation scenario, if the return information of one device under test is not received, the restart of the detection device and subsequent steps are stopped. In other implementation scenarios, only the detection of the device under test can be stopped, and the detection device continues to execute the restart and the subsequent steps to continue to detect other devices under test.

[0068] In other implementation scenarios, since there may be multiple devices under test whose return information is not received, a prompt message is generated, which includes the identifier of the device under test that has not received the return information. The prompt message is fed back to the user so that the user can understand which specific device or devices under test may have a fault.

[0069] S307: Count the number of test documents, and calculate the failure probability of the device under test according to the number.

[0070] In this implementation scenario, the number of test documents in the folder corresponding to the device under test that has not received any return information, that is, the folder named after the identification of the device under test, is counted, and the failure probability of the device under test corresponding to the folder is calculated according to the number of documents in each folder.

[0071] In other implementation scenarios, since all the devices under test are tested at the same time, the failure probability of only one device under test may be calculated, and the failure probabilities of the other devices under test are the same.

[0072] In other implementation scenarios, the failure probability is fed back to the user, so that the user can obtain the failure probability of the device under test and perform further analysis.

[0073] It can be seen from the above description that in this embodiment, if return information is received from at least one device under test, a detection document is generated based on the return information and saved in a file corresponding to the device under test; if return information is not received from at least one device under test, the execution of restarting the detection device and subsequent steps is stopped, and the number of detection documents in the folder corresponding to the device under test is counted, and the failure probability of the device under test is calculated based on the number, so that automatic detection of multiple devices under test can be achieved at the same time without relying on external devices, which can effectively improve the efficiency of detection, improve the reliability of detection, and reduce the cost of detection.

[0074] See also Figure 4 , Figure 4 It is a structural schematic diagram of the first embodiment of the detection device provided by the present invention. The detection device 10 includes a sending module 11, a judging module 12 and a generating module 13. The sending module 11 is used to restart the detection device according to a preset period and send a detection instruction to the device under test after starting, so that the device under test can respond to the detection instruction and send return information to the detection device. The judging module 12 is used to determine whether the return information sent by the device under test is received. The generating module 13 is used to generate a detection document according to the return information if the return information is received. Among them, the device under test is connected to the detection device through a detection interface.

[0075] The detection device 10 further includes a stopping module 14, which is used to stop executing the restart and subsequent steps if no return information is received.

[0076] The stop module 14 is also used to count the number of test documents and calculate the failure probability of the device under test according to the number.

[0077] The generating module 13 is further used to obtain the receiving time of the returned information and name the detection document according to the receiving time.

[0078] The generating module 13 is further used to store the detection document in a folder named after the identification of the device to be tested.

[0079] The sending module 11 is further used to read a detection file in the startup directory, where the detection file includes a preset period.

[0080] The detection instruction includes a version query instruction, and the returned information includes the firmware version information of the device under test.

[0081] It can be seen from the above description that in this embodiment, the detection device restarts according to a preset cycle and sends a detection instruction to the device under test after restarting. If the return information sent by the device under test is received, it means that the device under test functions normally in this round of detection, and a detection document is generated to record this detection. If the return information sent by the device under test is not received, it means that the device under test may have a fault, and the restart and subsequent steps are stopped. The failure probability of the device under test is calculated according to the number of detection documents. The detection device can automatically detect the device under test and automatically record the detection results without relying on external devices. The efficiency of detection can be effectively improved, the reliability of detection can be improved, and the detection cost can be reduced.

[0082] See also Figure 5 , Figure 5 2 is a schematic diagram of the structure of the second embodiment of the detection device provided by the present invention. The detection device 20 includes a processor 21, a memory 22 and a communication circuit 23. The processor 21 is coupled to the memory 22 and the communication circuit 23. The memory 22 stores a computer program, and the processor 21 executes the computer program when working to implement the following Figure 1-Figure 3 The detailed method can be found in the above, which will not be described here.

[0083] From the above description, it can be seen that the detection device in this embodiment restarts according to a preset cycle and sends a detection instruction to the device under test after restarting. If the return information sent by the device under test is received, it means that the device under test functions normally in this round of detection, and a detection document is generated to record this detection. If the return information sent by the device under test is not received, it means that the device under test may have a fault, and the restart and subsequent steps are stopped. The failure probability of the device under test is calculated according to the number of detection documents. The detection device can automatically detect the device under test and automatically record the detection results without relying on external devices. The efficiency of detection can be effectively improved, the reliability of detection can be improved, and the detection cost can be reduced.

[0084] See also Figure 6 , Figure 6 30 is a schematic diagram of a computer readable storage medium according to an embodiment of the present invention. The computer readable storage medium 30 stores at least one computer program 31, which is executed by a processor to implement the following Figure 1-Figure 3 In one embodiment, the computer readable storage medium 30 may be a storage chip, a hard disk, a mobile hard disk, a USB flash drive, an optical disk, or other readable and writable storage tools in the terminal, or a server, etc.

[0085] From the above description, it can be seen that in this embodiment, the computer program stored in the computer-readable storage medium can be used to restart the detection device according to a preset period and send a detection instruction to the device under test after restarting. If the return information sent by the device under test is received, it means that the device under test functions normally in this round of detection, and a detection document is generated to record this detection. If the return information sent by the device under test is not received, it means that the device under test may have a fault, and the restart and subsequent steps are stopped. The failure probability of the device under test is calculated according to the number of detection documents, which can realize automatic detection of the device under test by the detection device and automatic recording of the detection results without relying on external devices. The efficiency of detection can be effectively improved, the reliability of detection can be improved, and the detection cost can be reduced.

[0086] Different from the prior art, the present invention restarts the detection device according to a preset cycle and the device to be tested sends a detection instruction after startup. The detection instruction is used to enable the device to be tested to send return information to the detection device. If the return information is received, it means that the device to be tested functions normally in this round of detection. A detection document is generated to record this detection, so that the detection device can automatically detect the device to be tested and automatically record the detection results without relying on external devices. The detection efficiency can be effectively improved, the reliability of detection can be improved, and the detection cost can be reduced.

[0087] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A device detection method, It is characterized in that The method comprises: Restarting the detection device according to a preset period and sending a detection instruction to the device under test after restarting, wherein the detection instruction is used to make the device under test send return information to the detection device; Determine whether the detection device receives the return information sent by the device under test; If the return information is received, generating a test document according to the return information; Wherein, the device under test is connected to the detection device via a detection interface; Wherein, after the step of determining whether the detection device has received the return information sent by the device under test, the following steps are included: If the return information is not received, stopping the restart detection device and subsequent steps; Wherein, after the step of stopping the execution of the restart detection device and subsequent steps, it includes: The number of the detection documents is counted, and the failure probability of the device under test is calculated according to the number.

2. The device detection method according to claim 1, It is characterized in that The step of generating a detection document according to the returned information comprises: The receiving time of the returned information is obtained, and the detection document is named according to the receiving time.

3. The device detection method according to claim 1, It is characterized in that After the step of generating a detection document according to the returned information, the method further comprises: The detection document is stored in a folder named after the identification of the device to be tested.

4. The device detection method according to claim 1, It is characterized in that Before the step of restarting the detection device according to a preset period, the method includes: The detection file in the startup directory is read, wherein the detection file includes the preset period.

5. The device detection method according to claim 1, It is characterized in that The detection instruction includes a version query instruction, and the returned information includes firmware version information of the device under test.

6. A detection device, It is characterized in that include: A sending module, used for restarting the detection device according to a preset period and sending a detection instruction to the device under test after restarting, so that the device under test can send return information to the detection device in response to the detection instruction; A judging module, used for judging whether the return information sent by the device under test is received; A generating module, configured to generate a detection document according to the returned information if the returned information is received; Wherein, the device under test is connected to the detection device via a detection interface; The detection device is further configured to stop executing the restarting detection device and subsequent steps if the return information is not received; The number of the detection documents is counted, and the failure probability of the device under test is calculated according to the number.

7. A detection device, It is characterized in that include: A processor, a memory and a communication circuit, wherein the processor is coupled to the memory and the communication circuit, a computer program is stored in the memory, and the processor executes the computer program to implement the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, It is characterized in that A computer program is stored, and the computer program can be executed by a processor to implement the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method for testing code keyboard and code keyboard test machine

    CN103678065A

  • Communication link testing method and system

    CN105553782A

  • File management method and system of image data

    CN1591423A