USB network card testing method and related device
By detecting and switching the protocol version of the USB network card, the bandwidth performance of the USB 3.0 and USB 2.0 protocol versions are automatically detected during one plug-in and unplugging and testing, solving the problem of low efficiency in the existing technology and improving the efficiency of USB network card testing.
Patent Information
- Application Number
- CN202211538920.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-02
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2042-12-02
AI Technical Summary
When testing a USB3.0 network card, it is necessary to test whether it meets the bandwidth requirements of the USB3.0 protocol and whether it is backward compatible with the USB2.0 protocol, resulting in plug-in and unplugging and testing twice, which is not efficient.
By detecting the protocol version of the USB network card to be tested, if it is the USB3.0 protocol version, send the test data packet and calculate the bandwidth value; if the bandwidth value exceeds the preset threshold, judge that the test passes; then switch the protocol version to USB2.0, and repeat the above process to output the test results.
It realizes the bandwidth performance of USB 3.0 and USB 2.0 protocol versions of USB network card automatically detected and tested during one plug-in and unplugging process, improving the efficiency of USB network card testing.
Smart Images

Figure CN115914054B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and specifically relates to a USB network card testing method and related devices. Background Art
[0002] At present, when testing USB3.0 network cards, it is necessary not only to test whether the USB3.0 network card can meet the bandwidth requirements of the USB3.0 protocol, but also to test whether the USB3.0 network card is backward compatible with the USB2.0 protocol. Therefore, during the test, the signal lines supporting the USB2.0 and USB3.0 protocols need to be plugged and unplugged respectively, which requires plugging and unplugging twice and testing twice, which is inefficient. Summary of the invention
[0003] The embodiments of the present application provide a USB network card testing method and related devices, in order to improve the testing efficiency of the USB network card.
[0004] In a first aspect, an embodiment of the present application provides a USB network card testing method, which is applied to an electronic device in a test system, wherein the test system includes the electronic device, a USB network card to be tested, and a test server, and the USB network card to be tested is connected to the electronic device during the test, including:
[0005] Detecting that the USB network card to be tested is connected;
[0006] Determine whether the protocol version of the USB network card to be tested is a first protocol version type;
[0007] If the protocol version is the first protocol version type, sending a first test data packet to the test server through the USB network card to be tested;
[0008] Calculate the data volume of the first test data packet sent per unit time to obtain a first bandwidth value;
[0009] If the first bandwidth value is greater than a first preset threshold, determining that the first protocol version type test passes;
[0010] Sending a first switching signal to the USB network card to be tested, wherein the switching signal is used to instruct the USB network card to be tested to switch the first protocol version type to a second protocol version type;
[0011] Sending a second test data packet to the test server through the USB network card to be tested;
[0012] Calculate the data volume of the second test data packet sent per unit time to obtain a second bandwidth value;
[0013] If the second bandwidth value is greater than a second preset threshold, determining that the second protocol version type test passes;
[0014] A first test result is output, where the first test result is used to indicate that the USB network card to be tested has passed the test.
[0015] In a second aspect, an embodiment of the present application provides a USB network card testing device, characterized in that it is applied to an electronic device in a test system, the test system includes the electronic device, a USB network card to be tested and a test server, and the USB network card to be tested is connected to the electronic device during the test, including:
[0016] A detection unit, used for detecting that the USB network card to be tested is connected;
[0017] A judging unit, used to judge whether the protocol version of the USB network card to be tested is a first protocol version type;
[0018] A sending unit, configured to send a first test data packet to the test server through the USB network card to be tested when the protocol version is the first protocol version type;
[0019] A calculation unit, used for calculating the data volume of the first test data packet sent per unit time to obtain a first bandwidth value;
[0020] a determining unit, configured to determine that the first protocol version type test passes when the first bandwidth value is greater than a first preset threshold;
[0021] The sending unit is used to send a first switching signal to the USB network card to be tested, wherein the switching signal is used to instruct the USB network card to be tested to switch the first protocol version type to a second protocol version type;
[0022] The sending unit is used to send a second test data packet to the test server through the USB network card to be tested;
[0023] The calculation unit is used to calculate the data volume of the second test data packet sent per unit time to obtain a second bandwidth value;
[0024] The determining unit is configured to determine that the second protocol version type test passes when the second bandwidth value is greater than a second preset threshold;
[0025] An output unit is used to output a first test result, where the first test result is used to indicate that the USB network card to be tested has passed the test.
[0026] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps of any one of the first to second aspects of the embodiments of the present application.
[0027] In a fourth aspect, an embodiment of the present application provides a computer storage medium that stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in any one of the first to second aspects of the present embodiment.
[0028] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in any one of the first to second aspects of the embodiments of the present application. The computer program product may be a software installation package.
[0029] It can be seen that in the embodiment of the present application, first, when the USB network card to be tested is detected to be connected, it is determined whether the protocol version of the USB network card to be tested is the first protocol version type; if the protocol version is the first protocol version type, a first test data packet is sent to the test server through the USB network card to be tested; then the data volume of the first test data packet sent per unit time is calculated to obtain a first bandwidth value; if the first bandwidth value is greater than a first preset threshold, it is determined that the first protocol version type test has passed; then a first switching signal is sent to the USB network card to be tested, and the switching signal is used to instruct the USB network card to be tested to switch the first protocol version type to the second protocol version type; a second test data packet is sent to the test server through the USB network card to be tested; the data volume of the second test data packet sent per unit time is calculated to obtain a second bandwidth value; if the second bandwidth value is greater than a second preset threshold, it is determined that the second protocol version type test has passed; and a first test result is output, and the first test result is used to indicate that the USB network card to be tested has passed the test. In this way, in the process of testing the USB network card to be tested, only one plug and unplug is required to complete the entire test process, thereby improving the test efficiency of the USB network card. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present application 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1a is a structural schematic diagram of a test system provided in an embodiment of the present application;
[0032] Figure 1b It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0033] Figure 2a It is a flowchart of a USB network card testing method provided by an embodiment of the present application;
[0034] Figure 2b It is a schematic diagram of the entire process of the USB network card testing method provided in the embodiment of the present application;
[0035] Figure 3 It is a structural schematic diagram of a USB network card testing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0037] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, systems, products or devices.
[0038] References to "embodiments" in this specification mean that specific features, structures, or characteristics described in connection with the embodiments can be included in at least one embodiment of the present application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0039] First, the relevant terms involved in the present application will be introduced below.
[0040] USB is the abbreviation of Universal Serial BUS in English, and its Chinese abbreviation is "universal serial line". It is an external bus standard used to standardize the connection and communication between a computer and external devices. A USB network card is a network card with a USB interface.
[0041] Currently, when testing a USB 3.0 network card, it is not only necessary to test whether the USB 3.0 network card can meet the bandwidth requirements of the USB 3.0 protocol, but also to test whether the USB 3.0 network card is downward compatible with the USB 2.0 protocol. Therefore, during the test process, it is necessary to plug and unplug the signal lines supporting the USB 2.0 and USB 3.0 protocols respectively, which requires plugging and unplugging 2 times and testing 2 times, resulting in low efficiency.
[0042] To solve the above problems, an embodiment of the present application provides a method for testing a USB network card. The system-on-chip can be applied to scenarios for testing a USB network card. When it is detected that the USB network card to be tested is connected, it can be determined whether the protocol version of the USB network card to be tested is the first protocol version type; if the protocol version is the first protocol version type, a first test data packet is sent to the test server through the USB network card to be tested; then, the data volume of the first test data packet sent per unit time is calculated to obtain a first bandwidth value; if the first bandwidth value is greater than a first preset threshold, it is determined that the test of the first protocol version type passes; then, a first switching signal is sent to the USB network card to be tested, and the switching signal is used to instruct the USB network card to be tested to switch the first protocol version type to a second protocol version type; a second test data packet is sent to the test server through the USB network card to be tested; the data volume of the second test data packet sent per unit time is calculated to obtain a second bandwidth value; if the second bandwidth value is greater than a second preset threshold, it is determined that the test of the second protocol version type passes; a first test result is output, and the first test result is used to indicate that the USB network card to be tested passes the test. In this way, during the process of testing the USB network card to be tested, the entire test process can be completed with only one plug and unplug operation, improving the test efficiency of the USB network card. This solution can be applied to a variety of scenarios, including but not limited to the application scenarios mentioned above.
[0043] The following introduces the system architecture involved in the embodiments of the present application.
[0044] Figure 1a It is a structural diagram of a test system 100 provided in an embodiment of the present application, wherein the test system 100 includes an electronic device 101, a USB network card to be tested 102, and a test server 103, wherein the USB network card to be tested 102 is connected to the electronic device 101 during testing. The electronic device 101 may be a laptop computer, a desktop computer, a handheld mobile device, etc., and is not limited to uniqueness herein. Specifically, the electronic device 101 includes a first USB interface, and the USB network card to be tested 102 includes a second USB interface that matches the USB interface; when the USB network card to be tested 102 needs to be tested, the USB network card to be tested 102 is connected to the electronic device 101, and then the USB network card to be tested 102 is tested by the electronic device 101 through the method provided in an embodiment of the present application.
[0045] Figure 1b is a structural diagram of an electronic device 10 provided in an embodiment of the present application, such as Figure 1b As shown, the electronic device 10 includes at least one processor 11; a display screen 12; and a memory 13, and may also include a communications interface 15 and a bus 14. The processor 11, the display screen 12, the memory 13 and the communications interface 15 may communicate with each other through the bus 14. The display screen 12 is configured to display a preset user guide interface in the initial setting mode. The communications interface 15 may transmit information. The processor 11 may call the logic instructions in the memory 13 to execute the method in the above embodiment.
[0046] Optionally, the electronic device 10 may be a mobile electronic device, or an electronic device or other device, which is not limited to any particular device.
[0047] In addition, the logic instructions in the memory 13 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0048] The memory 13, as a computer-readable storage medium, can be configured to store software programs, computer executable programs, such as program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 11 executes functional applications and data processing by running the software programs, instructions or modules stored in the memory 13, that is, implementing the methods in the above embodiments.
[0049] The memory 13 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the electronic device 10, etc. In addition, the memory 13 may include a high-speed random access memory and may also include a non-volatile memory. For example, a variety of media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, may also be a transient storage medium.
[0050] The specific methods are introduced in detail below.
[0051] Figure 2a The present invention provides a flow chart of a USB network card testing method provided by an embodiment of the present invention. The USB network card testing method is applied to an electronic device in a test system. The test system includes the electronic device, a USB network card to be tested, and a test server. The USB network card to be tested is connected to the electronic device during the test. Figure 2a and Figure 2b , the USB network card testing method is introduced, and the method includes:
[0052] Step 201: Detect that the USB network card to be tested is connected.
[0053] In a specific implementation, the test program of the electronic device is started, and the network card configuration is loaded, and the USB network card to be tested is selected, such as a USB3.0 network card (the following description is made using the USB3.0 network card as an example, but is not limited to the USB3.0 network card), and then the USB network card to be tested is waited for to be connected. After the USB network card to be tested is connected, if an access signal of the USB network card to be tested is received, it is determined that the USB network card to be tested has been connected.
[0054] Step 202: Determine whether the protocol version of the USB network card to be tested is a first protocol version type.
[0055] In a possible embodiment, determining whether the protocol version of the USB network card to be tested is a first protocol version type includes: acquiring physical information of the USB network card to be tested, the physical information including at least a first protocol version number; if the first protocol version number is consistent with a second protocol version number corresponding to the first protocol version type, determining that the protocol version is the first protocol version type; if the first protocol version number is inconsistent with the second protocol version number, determining that the protocol version is not the first protocol version type.
[0056] In a specific implementation, when the electronic device detects that the USB network card to be tested is connected, it starts to read the physical information of the USB network card to be tested, and the physical information includes the USB protocol version, and may also include device information such as MAC address, PID (product identification code) / VID (vendor ID), etc. The electronic device can distinguish different devices by different VIDs and PIDs. Specifically, the electronic device identifies the currently connected device as a USB network card according to the VID / PID, and determines whether the protocol version of the USB network card to be tested is the first version protocol type through the USB protocol version.
[0057] Optionally, the first version protocol type is a USB 3.0 protocol. In other embodiments, it may be other types of protocols, which are not limited to uniqueness herein.
[0058] It can be seen that in this embodiment, the current protocol version of the USB network card to be tested is determined through the physical information of the USB network card to be tested, so as to select the corresponding test method to test the network card to be tested, avoiding manual selection or manual switching, and improving the test efficiency of the USB network card.
[0059] Step 203: If the protocol version is the first protocol version type, a first test data packet is sent to the test server through the USB network card to be tested.
[0060] Step 204: Calculate the data volume of the first test data packet sent per unit time to obtain a first bandwidth value.
[0061] Step 205: If the first bandwidth value is greater than a first preset threshold, it is determined that the first protocol version type test passes.
[0062] Step 206: Send a first switching signal to the USB network card to be tested.
[0063] The switching signal is used to instruct the USB network card to be tested to switch the first protocol version type to a second protocol version type.
[0064] Step 207: Send a second test data packet to the test server through the USB network card to be tested.
[0065] Step 208: Calculate the data volume of the second test data packet sent per unit time to obtain a second bandwidth value.
[0066] Step 209: If the second bandwidth value is greater than a second preset threshold, it is determined that the second protocol version type test passes.
[0067] Step 210: output a first test result, where the first test result is used to indicate that the USB network card to be tested has passed the test.
[0068] For example, the first protocol version type is USB 3.0 protocol, the second protocol version type is USB 2.0 protocol, the first preset threshold may be 100 MB / s, and the second preset threshold may be 10 MB / s.
[0069] In a specific implementation, when it is determined that the protocol version is the first protocol version type, the test process is switched to the USB3.0 test process, and then the first test data packet is sent to the USB network card to be tested. The USB network card to be tested forwards the first test data packet to the test server. The electronic device monitors the data volume of the USB network card to be tested in real time, and calculates the data volume per unit time, which is the first bandwidth value. Determine whether the first bandwidth value is greater than 100MB / s. If it is greater than 100MB / s, the bandwidth requirement of USB3.0 is met, and it is judged that the USB3.0 test process is passed. After the USB3.0 test process is ended, the test process is switched to the USB2.0 test process, and then a second test data packet is sent to the USB network card to be tested, and the USB network card to be tested forwards the second test data packet to the test server. The electronic device monitors the data volume of the USB network card to be tested in real time, and calculates the data volume per unit time, which is the second bandwidth value. Determine whether the first bandwidth value is greater than 10MB / s. If so, the bandwidth requirement of USB2.0 is met, and the USB2.0 test process is judged to be passed. Finally, after passing the USB3.0 test process and the USB2.0 test process, output a first test result to indicate that the USB network card to be tested has passed the test.
[0070] It can be seen that in this embodiment, when the USB network card to be tested is detected to be connected, it is determined whether the protocol version of the USB network card to be tested is the first protocol version type; if the protocol version is the first protocol version type, a first test data packet is sent to the test server through the USB network card to be tested; then the data volume of the first test data packet sent per unit time is calculated to obtain a first bandwidth value; if the first bandwidth value is greater than a first preset threshold, it is determined that the first protocol version type test has passed; then a first switching signal is sent to the USB network card to be tested, and the switching signal is used to instruct the USB network card to be tested to switch the first protocol version type to the second protocol version type; a second test data packet is sent to the test server through the USB network card to be tested; the data volume of the second test data packet sent per unit time is calculated to obtain a second bandwidth value; if the second bandwidth value is greater than a second preset threshold, it is determined that the second protocol version type test has passed; and a first test result is output, and the first test result is used to indicate that the USB network card to be tested has passed the test. In this way, in the process of testing the USB network card to be tested, only one plug and unplug is required to complete the entire test process, thereby improving the test efficiency of the USB network card.
[0071] In a possible embodiment, the method also includes: if the protocol version is not the first protocol version type, determining whether the protocol version is the second protocol version type; if it is the second protocol version type, sending a second test data packet to the test server through the USB network card to be tested; calculating the data volume of the second test data packet sent per unit time to obtain a second bandwidth value; if the second bandwidth value is greater than a second preset threshold, determining that the second protocol version type test has passed.
[0072] Furthermore, after determining that the test of the second protocol version type passes, the method also includes: sending a second switching signal to the USB network card under test, the switching signal being used to instruct the USB network card under test to switch the second protocol version type to the first protocol version type; sending a first test data packet to the test server through the USB network card under test; calculating the data volume of the first test data packet sent per unit time to obtain a first bandwidth value; if the first bandwidth value is greater than a first preset threshold, completing the test of the first protocol version type; and outputting a second test result, the second test result being used to indicate that the USB network card under test passes the test.
[0073] Optionally, the method further includes: if the second bandwidth value is less than the second preset threshold, determining that the test has failed; and outputting a fifth test result, wherein the fifth test result is used to indicate that the USB network card to be tested has failed the test.
[0074] In a specific implementation, when it is detected that the first protocol version type is not present, it is determined whether the protocol version of the USB network card to be tested is the second version type. If so, the USB2.0 test process is entered to first perform a USB2.0 test on the USB network card to be tested. After the USB2.0 test process is passed, the USB3.0 test process is entered. When the USB3.0 test process is also passed, the second test result is output to indicate that the USB network card to be tested has passed the test.
[0075] It is understandable that the first test result and the second test result may indicate the test pass as well as the test order, and no uniqueness limitation is made here.
[0076] In addition, if the second bandwidth value is less than 10 MB / s, it means that the USB network card to be tested is not compatible with the USB2.0 protocol, and then a fifth test result is output, indicating that the USB graphics card to be tested fails the test.
[0077] It can be seen that in this embodiment, when the initial protocol version of the USB network card to be tested is the second protocol version, the test corresponding to the second protocol version type is tested first, and then the test corresponding to the first protocol version type is performed, so that the test process can be flexibly changed without human intervention, thereby improving the network card testing efficiency.
[0078] In a possible embodiment, the method also includes: if the first bandwidth value is less than the first preset threshold, determining whether the first bandwidth value is greater than the second preset threshold; if the first bandwidth value is greater than the second preset threshold, sending a first test data packet to the test server through the USB network card to be tested; calculating the data volume of the first test data packet sent per unit time to obtain a new first bandwidth value; if the new first bandwidth value is greater than the first preset threshold, completing the test of the first protocol version type; and outputting a third test result, wherein the third test result is used to indicate that the USB network card to be tested has passed the test.
[0079] Furthermore, the method further includes: if the first bandwidth value is less than the first preset threshold, outputting a fourth test result, wherein the fourth test result is used to indicate that the USB network card to be tested has failed the test.
[0080] In a specific implementation, if it is detected in the USB3.0 test process that the first bandwidth value is less than 100MB / s, in order to avoid test process errors, it continues to determine whether the first bandwidth value is greater than 10MB / s. If the first bandwidth value is greater than 10MB / s, it indicates that the current protocol version is the second protocol version type. Therefore, the USB network card to be tested is controlled to switch to the first protocol version type, and then the USB3.0 test process is continued. If passed, the third test result is output.
[0081] Further, if the first bandwidth value is less than 10 MB / s, it indicates that the USB network card to be tested is not compatible with the USB2.0 protocol. Therefore, a fourth test result is output to indicate that the USB network card to be tested fails the test.
[0082] It can be seen that in this embodiment, the test process verification can be performed when the first bandwidth value is less than 100MB / s, avoiding test failure caused by early judgment errors, and because the verification is automatically performed by the program, it only needs to be executed automatically, which improves the efficiency of network card testing.
[0083] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that in order to realize the above functions, the mobile electronic device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiment provided in this article, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0084] The embodiment of the present application can divide the electronic device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0085] See also Figure 3 The present application also provides a USB network card testing device 30, which is applied to an electronic device in a test system. The test system includes the electronic device, a USB network card to be tested, and a test server. The USB network card to be tested is connected to the electronic device during the test, including:
[0086] A detection unit 31 is used to detect that the USB network card to be tested is connected;
[0087] The judging unit 32 is used to judge whether the protocol version of the USB network card to be tested is a first protocol version type;
[0088] A sending unit 33, configured to send a first test data packet to the test server through the USB network card to be tested when the protocol version is the first protocol version type;
[0089] A calculation unit 34, configured to calculate the data volume of the first test data packet sent per unit time to obtain a first bandwidth value;
[0090] A determination unit 35, configured to determine that the first protocol version type test passes when the first bandwidth value is greater than a first preset threshold;
[0091] The sending unit 33 is used to send a first switching signal to the USB network card to be tested, where the switching signal is used to instruct the USB network card to be tested to switch the first protocol version type to a second protocol version type;
[0092] The sending unit 33 is used to send a second test data packet to the test server through the USB network card to be tested;
[0093] The calculation unit 34 is used to calculate the data volume of the second test data packet sent per unit time to obtain a second bandwidth value;
[0094] The determining unit 35 is configured to determine that the second protocol version type test passes when the second bandwidth value is greater than a second preset threshold;
[0095] The output unit 36 is used to output a first test result, where the first test result is used to indicate that the USB network card to be tested has passed the test.
[0096] It can be seen that in this embodiment, when the USB network card to be tested is detected to be connected, it is determined whether the protocol version of the USB network card to be tested is the first protocol version type; if the protocol version is the first protocol version type, a first test data packet is sent to the test server through the USB network card to be tested; then the data volume of the first test data packet sent per unit time is calculated to obtain a first bandwidth value; if the first bandwidth value is greater than a first preset threshold, it is determined that the first protocol version type test has passed; then a first switching signal is sent to the USB network card to be tested, and the switching signal is used to instruct the USB network card to be tested to switch the first protocol version type to the second protocol version type; a second test data packet is sent to the test server through the USB network card to be tested; the data volume of the second test data packet sent per unit time is calculated to obtain a second bandwidth value; if the second bandwidth value is greater than a second preset threshold, it is determined that the second protocol version type test has passed; and a first test result is output, and the first test result is used to indicate that the USB network card to be tested has passed the test. In this way, in the process of testing the USB network card to be tested, only one plug and unplug is required to complete the entire test process, thereby improving the test efficiency of the USB network card.
[0097] In a possible embodiment, in terms of determining whether the protocol version of the USB network card to be tested is of the first protocol version type, the determining unit 32 is specifically used to: obtain physical information of the USB network card to be tested, the physical information including at least a first protocol version number; if the first protocol version number is consistent with the second protocol version number corresponding to the first protocol version type, determine that the protocol version is the first protocol version type; if the first protocol version number is inconsistent with the second protocol version number, determine that the protocol version is not the first protocol version type.
[0098] In a possible embodiment, the device also includes: the judging unit 32, which is further used to judge whether the protocol version is the second protocol version type when the protocol version is not the first protocol version type; the sending unit 33, which is further used to send a second test data packet to the test server through the USB network card to be tested when the protocol version is the second protocol version type; the calculating unit 34, which is further used to calculate the data volume of the second test data packet sent per unit time to obtain a second bandwidth value; the determining unit 35, which is further used to determine that the second protocol version type test has passed when the second bandwidth value is greater than a second preset threshold.
[0099] In a possible embodiment, after determining that the test of the second protocol version type has passed, the device further includes: the sending unit 33 is further used to send a second switching signal to the USB network card under test, and the switching signal is used to instruct the USB network card under test to switch the second protocol version type to the first protocol version type; the sending unit 33 is further used to send a first test data packet to the test server through the USB network card under test; the calculation unit 34 is further used to calculate the data volume of the first test data packet sent per unit time to obtain a first bandwidth value; the determination unit 35 is further used to determine that the test of the first protocol version type is completed if the first bandwidth value is greater than a first preset threshold; the output unit 36 is further used to output a second test result, and the second test result is used to indicate that the USB network card under test has passed the test.
[0100] In a possible embodiment, the device also includes: the judging unit 32, which is further used to judge whether the first bandwidth value is greater than the second preset threshold when the first bandwidth value is less than the first preset threshold; the sending unit 33, which is further used to send a first test data packet to the test server through the USB network card to be tested if the first bandwidth value is greater than the second preset threshold; the calculating unit 34, which is further used to calculate the data volume of the first test data packet sent per unit time to obtain a new first bandwidth value; the determining unit 35, which is further used to determine that the test of the first protocol version type is completed if the new first bandwidth value is greater than the first preset threshold; the output unit 36, which is further used to output a third test result, and the third test result is used to indicate that the USB network card to be tested has passed the test.
[0101] In a possible embodiment, the device further includes: the output unit 36 is further used to output a fourth test result when the first bandwidth value is less than the first preset threshold, and the fourth test result is used to indicate that the USB network card to be tested has failed the test.
[0102] In a possible embodiment, the device also includes: the judgment unit 32 is further used to judge that the test has failed when the second bandwidth value is less than the second preset threshold; the output unit 36 is further used to output a fifth test result, and the fifth test result is used to indicate that the USB network card to be tested has failed the test.
[0103] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media sets. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium may be a solid-state hard disk.
[0104] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.
[0105] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes an electronic device.
[0106] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0107] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and systems can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0108] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0109] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0110] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a volatile memory or a non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM) and direct RAM bus RAM (DR RAM). Various media that can store program code are available.
[0111] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions without departing from the spirit and scope of the present invention, and can make various changes and modifications, including the combination of the above-mentioned different functions and implementation steps, including software and hardware implementation methods, all of which are within the scope of protection of the present invention.
Claims
1. A USB network card testing method, characterized in that: An electronic device applied to a test system, the test system comprising the electronic device, a USB network card to be tested and a test server, the USB network card to be tested being connected to the electronic device during the test, comprising: Detecting that the USB network card to be tested is connected; Determine whether the protocol version of the USB network card to be tested is a first protocol version type; If the protocol version is the first protocol version type, sending a first test data packet to the test server through the USB network card to be tested; Calculate the data volume of the first test data packet sent per unit time to obtain a first bandwidth value; If the first bandwidth value is greater than a first preset threshold, it is determined that the first protocol version type test passes; Sending a first switching signal to the USB network card to be tested, where the first switching signal is used to instruct the USB network card to be tested to switch the first protocol version type to a second protocol version type; Sending a second test data packet to the test server through the USB network card to be tested; Calculate the data volume of the second test data packet sent per unit time to obtain a second bandwidth value; If the second bandwidth value is greater than a second preset threshold, determining that the second protocol version type test passes; Outputting a first test result, where the first test result is used to indicate that the USB network card to be tested has passed the test; After determining whether the protocol version of the USB network card to be tested is the first protocol version type, the method further includes: if the protocol version is not the first protocol version type, determining whether the protocol version is the second protocol version type; if it is the second protocol version type, sending a second test data packet to the test server through the USB network card to be tested; calculating the data volume of the second test data packet sent within a unit time to obtain a second bandwidth value; if the second bandwidth value is greater than a second preset threshold, determining that the second protocol version type test is passed, and sending a second switching signal to the USB network card to be tested, the second switching signal is used to instruct the USB network card to be tested to switch the second protocol version type to the first protocol version type; sending a first test data packet to the test server through the USB network card to be tested; calculating the data volume of the first test data packet sent within a unit time to obtain a first bandwidth value; if the first bandwidth value is greater than a first preset threshold, completing the test of the first protocol version type; outputting a second test result, the second test result is used to indicate that the USB network card to be tested passes the test; wherein the first test result and the second test result are used to indicate the test order while indicating that the test passes; After calculating the data volume of the first test data packet sent within a unit time to obtain the first bandwidth value, the method further includes: if the first bandwidth value is less than the first preset threshold, determining whether the first bandwidth value is greater than the second preset threshold; if the first bandwidth value is greater than the second preset threshold, sending the first test data packet to the test server through the USB network card to be tested; calculating the data volume of the first test data packet sent within a unit time to obtain a new first bandwidth value; if the new first bandwidth value is greater than the first preset threshold, completing the test of the first protocol version type; and outputting a third test result, wherein the third test result is used to indicate that the USB network card to be tested has passed the test.
2. The method according to claim 1, characterized in that The determining whether the protocol version of the USB network card to be tested is a first protocol version type includes: Acquire physical information of the USB network card to be tested, wherein the physical information at least includes a first protocol version number; If the first protocol version number is consistent with the second protocol version number corresponding to the first protocol version type, determining that the protocol version is the first protocol version type; If the first protocol version number is inconsistent with the second protocol version number, it is determined that the protocol version is not the first protocol version type.
3. The method according to claim 1, characterized in that The method further comprises: If the first bandwidth value is less than the first preset threshold, a fourth test result is output, where the fourth test result is used to indicate that the USB network card to be tested has failed the test.
4. The method according to claim 1, characterized in that: The method further comprises: If the second bandwidth value is less than the second preset threshold, the test is judged to have failed; A fifth test result is output, where the fifth test result is used to indicate that the USB network card to be tested has failed the test.
5. A USB network card testing device, characterized in that: An electronic device applied to a test system, the test system comprising the electronic device, a USB network card to be tested and a test server, the USB network card to be tested being connected to the electronic device during the test, comprising: A detection unit, used for detecting that the USB network card to be tested is connected; A judging unit, used to judge whether the protocol version of the USB network card to be tested is a first protocol version type; A sending unit, configured to send a first test data packet to the test server through the USB network card to be tested when the protocol version is the first protocol version type; A calculation unit, used for calculating the data volume of the first test data packet sent per unit time to obtain a first bandwidth value; a determining unit, configured to determine that the first protocol version type test passes when the first bandwidth value is greater than a first preset threshold; The sending unit is used to send a first switching signal to the USB network card to be tested, wherein the switching signal is used to instruct the USB network card to be tested to switch the first protocol version type to a second protocol version type; The sending unit is used to send a second test data packet to the test server through the USB network card to be tested; The calculation unit is used to calculate the data volume of the second test data packet sent per unit time to obtain a second bandwidth value; The determining unit is configured to determine that the second protocol version type test passes when the second bandwidth value is greater than a second preset threshold; An output unit, used for outputting a first test result, where the first test result is used to indicate that the USB network card to be tested has passed the test; The device further includes: the judging unit is further used to judge whether the protocol version is of the second protocol version type when the protocol version is not of the first protocol version type; the sending unit is further used to send a second test data packet to the test server through the USB network card to be tested when the protocol version is of the second protocol version type; the calculating unit is further used to calculate the data volume of the second test data packet sent per unit time to obtain a second bandwidth value; the determining unit is further used to determine that the second protocol version type test has passed when the second bandwidth value is greater than a second preset threshold value; After the aspect of determining that the test of the second protocol version type has passed, the device further includes: the sending unit is further used to send a second switching signal to the USB network card to be tested, and the switching signal is used to instruct the USB network card to be tested to switch the second protocol version type to the first protocol version type; the sending unit is further used to send a first test data packet to the test server through the USB network card to be tested; the calculation unit is further used to calculate the data volume of the first test data packet sent per unit time to obtain a first bandwidth value; the determination unit is further used to determine that the test of the first protocol version type is completed if the first bandwidth value is greater than a first preset threshold; the output unit is further used to output a second test result, and the second test result is used to indicate that the USB network card to be tested has passed the test; wherein the first test result and the second test result are used to indicate the test order while indicating that the test has passed; The device also includes: the judging unit, which is further used to judge whether the first bandwidth value is greater than the second preset threshold value when the first bandwidth value is less than the first preset threshold value; the sending unit, which is further used to send a first test data packet to the test server through the USB network card to be tested if the first bandwidth value is greater than the second preset threshold value; the calculating unit, which is further used to calculate the data volume of the first test data packet sent per unit time to obtain a new first bandwidth value; the determining unit, which is further used to determine that the test of the first protocol version type is completed if the new first bandwidth value is greater than the first preset threshold value; and the output unit, which is further used to output a third test result, wherein the third test result is used to indicate that the USB network card to be tested has passed the test.
6. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: A computer program for electronic data exchange is stored, wherein the computer program enables a computer to execute instructions of the steps in the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
USB (universal serial bus) port test method and device and readable storage medium
CN107402856A