A physical position determination method and device, and a device testing method and device

By obtaining and utilizing the hub port and connection port information in the tree structure data table, and determining its physical location based on the device name, the problem of difficulty in determining the physical location of the device in the prior art is solved, and the efficiency of fault location is improved.

CN113746680BActive Publication Date: 2024-09-06北京佳华智联科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111032203.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-03
Publication Date
2024-09-06
Estimated Expiration
2041-09-03

AI Technical Summary

Technical Problem

It is difficult to intuitively judge and indicate the physical location of a device on the hub with the existing technology, resulting in low efficiency in locating faulty devices.

Method used

By obtaining the tree structure data table, which contains hub port information and connection port information in the computing device system, determine the port path according to the name of the device, and locate the corresponding data unit in the data table to determine the physical location of the device.

Benefits of technology

It achieves intuitive identification of the physical locations of multiple devices, improves the efficiency of locating faulty devices, and saves time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113746680B
    Figure CN113746680B
Patent Text Reader

Abstract

The present application provides a physical location determination method and apparatus, and a device testing method and apparatus. The physical location determination method includes obtaining a tree structure data table, wherein the tree structure data table includes hub port information and connection port information in a computing device system, and the data unit in the tree structure data table corresponds to the physical location of the connection port provided by the hub; determining the corresponding port path of the device according to the name of the device in the computing device system, and the port path includes the connection port information and the hub port information; locating the corresponding data unit in the tree structure data table according to the hub port information and the connection port information of the device, and obtaining the connection port to which the device is connected, so as to determine the physical location of the device, and provide convenience for quickly finding a specific device among many devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of physical position determination, and in particular, to a physical position determination method and device, and a device testing method and device. Background Art

[0002] In order to ensure that every product that reaches the user is functional, stable and reliable, it is often necessary to conduct multiple tests on the finished products during the production process of the device, such as stress testing, aging testing, etc.

[0003] At present, due to the limited number of devices directly connected to most computing devices, the testing method for devices (for example, smart password keys) is generally to plug multiple devices to be tested into a hub, and then connect the hub and the computing device (for example, a computer). The computing device obtains the names of all devices connected to the host, obtains the handle of the corresponding device according to the name, and then communicates with the corresponding device based on the handle. According to the communication status, it can be determined whether the corresponding device is faulty, thereby completing the test.

[0004] However, the above method can only give the name of the faulty device, and the physical location of the faulty device on the hub cannot be intuitively determined and indicated through the name. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a physical position determination method and device, and a device testing method and device to solve the above-mentioned problems.

[0006] In a first aspect, the present invention provides a physical location determination method, which is used to determine the physical locations of multiple devices connected to a computing device, wherein the multiple devices are connected to different connection ports of a hub and are connected to the port of the computing device through the hub port, the method comprising: obtaining a tree structure data table, wherein the tree structure data table comprises hub port information and connection port information in a computing device system, and the data units in the tree structure data table correspond to the physical locations of the connection ports provided by the hub; determining the corresponding port path of the device according to the name of the device in the computing device system, the port path comprising the connection port information and the hub port information; locating the corresponding data unit in the tree structure data table according to the hub port information and the connection port information of the device, and obtaining the connection port to which the device is connected, so as to determine the physical location of the device.

[0007] In the physical location determination method designed above, this scheme first obtains a tree structure data table containing hub port information and connection port information in the computing device system, and then determines the corresponding port path of the device according to the name of the device in the computing device system, and then locates the corresponding data unit in the tree structure data table according to the hub port information and connection port information in the port path, and then obtains the connection port of the device in the hub to determine the physical location of the device. Therefore, this scheme can identify the physical location of each device in the hub where multiple devices are located, and then can more intuitively obtain the location of each device, providing convenience for finding devices.

[0008] In an optional implementation of the first aspect, the method locates the corresponding data unit by searching the tree structure data table for a hub port corresponding to the hub port information according to the hub port information of the device, and searching the tree structure data table for a connection port corresponding to the connection port information according to the connection port information of the device, thereby obtaining the connection port to which the device is connected.

[0009] In an optional implementation of the first aspect, the method generates a tree structure data table by traversing hub port information and connection port information in the computing device system to obtain the tree structure data table.

[0010] In an optional implementation of the first aspect, the hub includes multiple hub ports, each hub port corresponds to multiple connection ports, and the method forms multiple tree structured data based on the port information of the multiple hub ports of the hub in the computing device system and the multiple connection port information corresponding to each hub port, and forms the tree structured data table based on the multiple tree structured data; wherein each tree structured data uses the hub port information of the hub port as the root node and uses the multiple connection port information corresponding to the hub port as the data unit.

[0011] In an optional implementation of the first aspect, the method first searches for the tree structure data to which the device belongs in the plurality of tree structure data according to the hub port information of the device, and then searches for the corresponding data unit in the tree structure data to which the device belongs according to the connection port information of the device, so as to search for the connection port corresponding to the device in the tree structure data table. By first obtaining the tree structure data to which the device belongs in the tree structure data (i.e., which "tree" it is on) according to the hub port information of the device, and then further searching for the corresponding data unit in the corresponding tree structure data to determine the physical location of the device, this multi-layer query method improves the efficiency of searching by searching for data keywords / words in different levels.

[0012] In an optional implementation of the first aspect, the method determines a first handle corresponding to the device according to a name of the device in the computing device system, and determines a corresponding port path of the device according to the first handle corresponding to the device.

[0013] In an optional implementation of the first aspect, before determining the first handle corresponding to the device according to the name of the device in the computing device system, the method further includes: determining the name of each device on the hub according to the power-on sequence of the devices connected to the hub.

[0014] In a second aspect, the present invention provides a physical location determination device, which is used to determine the physical locations of multiple devices connected to a computing device, wherein the multiple devices are connected to different connection ports of a hub and are connected to the port of the computing device through the hub port, the device comprising: an acquisition module, used to acquire a tree structure data table, wherein the tree structure data table includes hub port information and connection port information in the computing device system, and the data unit in the tree structure data table corresponds to the physical location of the connection port provided by the hub; a second determination module, used to determine the corresponding port path of the device according to the name of the device in the computing device system, the port path includes the connection port information and the hub port information; a search module, used to search for the corresponding connection port in the tree structure data table according to the hub port information and the connection port information of the device, and obtain the connection port to which the device is connected to determine the physical location of the device.

[0015] In the physical location determination device designed above, this scheme first obtains a tree structure data table containing the hub port information and the connection port information in the computing device system, and then determines the corresponding port path of the device according to the name of the device in the computing device system, and then locates the corresponding data unit in the tree structure data table according to the hub port information and the connection port information in the port path, and then obtains the connection port of the device in the hub to determine the physical location of the device. Therefore, this scheme can identify the physical location of each device in the hub where multiple devices are located, and then can more intuitively obtain the location of each device, providing convenience for finding devices.

[0016] In a third aspect, the present invention provides a device testing method for performing fault testing on multiple devices connected to a computing device, wherein the multiple devices are connected to different connection ports of a hub and are connected to ports of the computing device through hub ports, the method comprising: determining a second handle corresponding to the device according to the name of the device; and establishing a communication connection with the device according to the second handle of the device, and determining whether the communication status with the device is abnormal; if there is no abnormality, determining that the device has not failed; if there is an abnormality, determining the physical position of the device on the hub according to the physical position determination method described in any optional implementation manner in the first aspect, or using the physical position determination device provided in the second aspect of the present invention to determine the physical position of the device.

[0017] In the device testing method designed above, the second handle corresponding to the device is first determined by the name of the device, and then communication is established with the device based on the second handle of the device, and then the device is judged whether it is faulty based on the communication status. After determining that the device is faulty, this scheme determines the physical location of the faulty device based on the physical location determination method in the first embodiment, so that the faulty device can be quickly found from multiple devices in the hub, thereby achieving the purpose of saving time.

[0018] In an optional implementation manner of the third aspect, after determining the physical location of the device, the method further includes: indicating the physical location of the device on the hub.

[0019] In a fourth aspect, the present invention provides a device testing apparatus for performing fault testing on a plurality of devices connected to a computing device, wherein the plurality of devices are connected to different connection ports of a hub and are connected to ports of the computing device through hub ports, and the apparatus is applied to a computing device, comprising: a second determination module for determining a second handle corresponding to the device according to a name of the device; a judgment module for establishing a communication connection with the device according to the second handle of the device, and determining whether the communication status with the device is abnormal; a determination module for determining that the device has not failed after the judgment module determines that it is not abnormal; and for determining the physical position of the device on the hub according to the physical position determination method described in any one of the aforementioned embodiments after the judgment module determines that it is abnormal, or determining the physical position of the device using the physical position determination device provided in the second aspect of the present invention.

[0020] In the device testing device designed as above, the second handle corresponding to the device is first determined by the name of the device, and then communication is established with the device based on the second handle of the device, and then the device is judged whether it is faulty based on the communication status. After determining that the device is faulty, this scheme determines the physical location of the faulty device based on the physical location determination method in the first embodiment, so that the faulty device can be quickly found from multiple devices in the hub, thereby achieving the purpose of saving time.

[0021] In a fifth aspect, an embodiment provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method in the first aspect, any optional implementation of the first aspect, or the third aspect, any optional implementation of the third aspect is executed.

[0022] In the sixth aspect, an embodiment provides a storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method in the first aspect, any optional implementation of the first aspect, or the third aspect, any optional implementation of the third aspect is performed.

[0023] In the seventh aspect, an embodiment provides a computer program product, which, when running on a computer, enables the computer to execute the method in the first aspect, any optional implementation of the first aspect, or the third aspect, any optional implementation of the third aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0025] Figure 1 A schematic diagram of the computing device system structure provided in an embodiment of the present application;

[0026] Figure 2 A flow chart of a method for determining a physical location provided in an embodiment of the present application;

[0027] Figure 3 A schematic diagram of the structure of a physical location determination device provided in an embodiment of the present application;

[0028] Figure 4 The device testing method flow provided in the embodiment of the present application;

[0029] Figure 5 A schematic diagram of a display interface provided in an embodiment of the present application;

[0030] Figure 6 A schematic diagram of the structure of a device testing device provided in an embodiment of the present application;

[0031] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0032] Icons: 10-computing device; 20-hub; 201-connection port; 30-device; 300-acquisition module; 310-first determination module; 320-search module; 500-second determination module; 510-judgment module; 520-judgment module; 5210-first determination submodule; 5220-second determination submodule; 530-indication module; 6-electronic device; 601-processor; 602-memory; 603-communication bus. DETAILED DESCRIPTION

[0033] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0034] The present application provides a computing device system, such as Figure 1 As shown, the computing device system includes a computing device 10, a hub 20, and a plurality of devices 30, the plurality of devices 30 being connected to different connection ports 201 of the hub 20, and connected to the port of the computing device 10 through the port of the hub 20. As a possible implementation, the device 30 may be a smart password key, the hub 20 may be a USB hub, and the computing device 10 may be a computer; assuming that the hub 20 is a USB hub with 100 connection ports 201, and the number of the smart password keys is 100, then these 100 smart password keys can be respectively inserted into the 100 connection ports of the hub 20, and then connected to the USB port of the computer through the hub 20 through a USB connection method, forming a computing device system. It should be noted here that the smart password key and the non-restrictive embodiments are only illustrative methods taken for ease of understanding. That is to say, the device 30 can be not only a smart password key, but also a USB flash drive, a mobile hard disk and other devices; the hub 20 can be not only a USB hub, but also a hub with HDMI or VGA interface modes.

[0035] First embodiment

[0036] The embodiment of the present application provides a physical location determination method, which is used to determine the physical location of the device in the hub of the computing device system. The method can be applied to the computing device of the computing device system, such as Figure 2 As shown, the method may include the following steps:

[0037] Step S200: Obtain a tree structure data table.

[0038] Step S210: determining a port path corresponding to the device according to the name of the device in the computing device system, where the port path includes connection port information and hub port information.

[0039] Step S220: locate the corresponding data unit in the tree structure data table according to the hub port information and the connection port information of the device, obtain the connection port to which the device is connected, and determine the physical location of the device.

[0040] In step S200, the tree structure data table includes the hub port information and the connection port information in the computing device, and the tree structure data table also has a plurality of data units, each data unit corresponding to the physical location of the connection port provided by the hub. As a possible implementation, the tree structure data table can be generated in advance and stored in the computing device, so that the computing device can directly call it when executing step S200; as another possible implementation, the step S200 of obtaining the tree structure data table can be a process of generating a tree structure data table, wherein the process of generating the tree structure data table can be that the computing device generates the tree structure data table by traversing the hub port information and the connection port information in the computing device system.

[0041] As a specific implementation, assuming that the hub has multiple hub ports, each hub port corresponds to multiple connection ports. On this basis, the process of generating a tree structure data table can be specifically as follows: multiple tree structure data are constructed based on the multiple hub port information of the hub and the multiple connection port information corresponding to each hub port, and then the tree structure data table is constructed based on the multiple tree structure data, wherein each tree structure data uses the hub port information as the root node and uses the multiple connection port information corresponding to the hub port as the data unit.

[0042] Assuming that the hub has 3 hub ports, hub port 1 corresponds to 32 connection ports, hub port 2 corresponds to 32 connection ports, and hub port 3 corresponds to 36 connection ports, then a tree structure data 1 corresponding to hub port 1 can be generated, the root node of the tree structure data 1 is hub port 1, and the multiple data units of the tree structure data 1 are the 32 connection port information corresponding to the hub port 1; similarly, the root node of the tree structure 2 corresponding to the hub port 2 is hub port 2, and the multiple data units of the tree structure data 2 are the 32 connection port information corresponding to the hub port 2; the root node of the tree structure 3 corresponding to the hub port 3 is hub port 3, and the multiple data units of the tree structure data 3 are the 36 connection port information corresponding to the hub port 3.

[0043] In step S210, the name of the device in the computing device system can be determined by the daemon process by monitoring the power-on sequence of the device. As a possible implementation method, the name of the smart password key can be assigned by the daemon process of the computing device. When the daemon process detects that the smart password key is inserted, it starts to find an unused number from 0, and obtains the name of the smart password key by modifying other keywords. For example, after multiple devices are connected to the hub, after the hub is powered on, some of the multiple devices connected to the hub power on quickly, and some devices power on slowly, thereby forming a situation where multiple devices have a power-on sequence. The daemon process in the computing device of this scheme can assign a name to each device in sequence according to the power-on sequence of multiple devices. For example, suppose there are three devices connected to the hub, namely device A, device B and device C. After the hub is powered on, device A is powered on successfully first, and the computing device assigns the name of smart password key A to device A; then device C completes power-on, and the computing device assigns the name of smart password key B to device C; device B completes power-on last, and the computing device assigns the name of smart password key C to device B.

[0044] As a specific implementation method, the computing device of this solution can adopt the Linux system, and then use the PCSC-Lite daemon process in the Linux system to monitor the insertion of the smart password key, and assign a name to it when the smart password key is detected to be inserted, and at the same time provide the SCardListReaders interface to the upper-level application for obtaining the name list of all currently inserted smart password keys.

[0045] In step S210, after obtaining the name of the device based on the above method, this solution can determine the port path corresponding to the device based on the name of the device. As a possible implementation, this solution can first determine the first handle corresponding to the device based on the name of the device, and then determine the port path corresponding to the device according to the first handle corresponding to the device. The first handle of the device can be obtained after recognizing that the device is powered on. For example, the computing device can obtain the first handle corresponding to the device by calling the interface provided by the USB interface library (libusb) after detecting the device through a set process. The first handle can be represented as a libusb device handle, and then a mapping table is established between the first handle and the name of the device and stored in the computing device. When executing step S210, the mapped first handle can be found directly according to the name of the device.

[0046] After obtaining the first handle of the device, the port path corresponding to the device can be determined according to the first handle. As a possible implementation, the first handle, i.e., the libusb device handle, can be used as a parameter of the libusb_get_port_numbers function, and then the libusb_get_port_numbers function can be called based on the first handle of the device to obtain the port path of the device. The method of obtaining the device port path through the first handle of the device can be implemented by any existing method, which is not limited in this application.

[0047] It should be noted here that the name of the smart password key and the corresponding first handle are temporarily assigned to it by the daemon after the daemon detects the insertion of the smart password key, and are stored in the memory of the computing device. When the system is powered off, they will be lost. In addition, when the daemon detects that the smart password key is removed, it will release its corresponding first handle and recycle the name previously assigned to it, that is, the number in its name can continue to be used for the subsequent inserted smart password key.

[0048] In step S220, after obtaining the port path of the device, the computing device can search for the hub port corresponding to the hub port information in the tree structure data table according to the hub port information in the port path, and search for the connection port corresponding to the connection port information in the tree structure data table according to the connection port information in the port path, and then locate the data unit corresponding to the device, thereby obtaining the connection port of the hub to which the device is connected, and then obtaining the physical position of the device in the hub.

[0049] As a possible implementation, based on the above example of multiple tree structured data, step S220 can first search for the tree structured data belonging to the device in the multiple tree structured data according to the hub port information of the device, and then search for the corresponding connection port in the tree structured data belonging to the device according to the connection port information of the device to locate the data unit corresponding to the device, thereby obtaining the connection port of the hub to which the device is connected, and then obtaining the physical position of the device in the hub.

[0050] In the above-mentioned physical location determination method, this scheme first obtains a tree structure data table containing hub port information and connection port information in the computing device system, and then determines the corresponding port path of the device according to the name of the device in the computing device system, and then locates the corresponding data unit in the tree structure data table according to the hub port information and connection port information in the port path, and then obtains the connection port of the device in the hub to determine the physical location of the device. Therefore, this scheme can identify the physical location of each device in the hub where multiple devices are located, and then can more intuitively obtain the location of each device, providing convenience for finding devices.

[0051] Figure 3 The schematic structural block diagram of the physical position determination device provided by the present application is shown. It should be understood that the device is similar to the above-mentioned Figure 2 The method embodiment executed in corresponds to the embodiment of the method, and the steps involved in the aforementioned method can be executed. The specific functions of the device can be referred to the description above. To avoid repetition, detailed description is appropriately omitted here. The device includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system (OS) of the device. Specifically, the device includes: an acquisition module 300, which is used to acquire a tree structure data table, wherein the tree structure data table includes hub port information and connection port information in a computing device system, and the data unit in the tree structure data table corresponds to the physical location of the connection port provided by the hub; a first determination module 310, which is used to determine the corresponding port path of the device according to the name of the device in the computing device system, and the port path includes the connection port information and the hub port information; a search module 320, which is used to search for the corresponding connection port in the tree structure data table according to the hub port information and the connection port information of the device, and obtain the connection port to which the device is connected to determine the physical location of the device.

[0052] In the physical location determination device designed above, this scheme first obtains a tree structure data table containing the hub port information and the connection port information in the computing device system, and then determines the corresponding port path of the device according to the name of the device in the computing device system, and then locates the corresponding data unit in the tree structure data table according to the hub port information and the connection port information in the port path, and then obtains the connection port of the device in the hub to determine the physical location of the device. Therefore, this scheme can identify the physical location of each device in the hub where multiple devices are located, and then can more intuitively obtain the location of each device, providing convenience for finding devices.

[0053] In an optional implementation manner of the present embodiment, the search module 320 is specifically used to search for a hub port corresponding to the hub port information in a tree structure data table according to the hub port information of the device, and to search for a connection port corresponding to the connection port information in a tree structure data table according to the connection port information of the device, so as to locate the corresponding data unit, thereby obtaining the connection port to which the device is connected.

[0054] In an optional implementation of this embodiment, the acquisition module 300 is specifically used to traverse the hub port information and the connection port information in the computing device system to generate a tree structure data table to obtain the tree structure data table.

[0055] In an optional implementation of this embodiment, the hub includes multiple hub ports, each hub port corresponds to multiple connection ports, and the acquisition module 300 is further specifically used to form multiple tree structured data based on the multiple hub port information of the hub in the computing device system and the multiple connection port information corresponding to each hub port, and to form a tree structured data table based on the multiple tree structured data; wherein each tree structured data uses the hub port information as the root node and uses the multiple connection port information corresponding to the hub port information as the data unit.

[0056] In an optional implementation manner of the present embodiment, the search module 320 is further specifically used to first search for the tree structure data belonging to the device in multiple tree structure data according to the hub port information of the device, and then search for the corresponding connection port in the tree structure data belonging to the device according to the connection port information of the device, so as to locate the corresponding data unit, thereby searching for the connection port corresponding to the device in the tree structure data table.

[0057] In an optional implementation of this embodiment, the first determination module 310 is specifically configured to determine a first handle corresponding to the device according to a name of the device in the computing device system, and determine a corresponding port path of the device according to the first handle corresponding to the device.

[0058] Second embodiment

[0059] The present application provides a device testing method, which is used to perform fault testing on multiple devices in the aforementioned computing device system, such as Figure 4 As shown, the method comprises the following steps:

[0060] Step S400: determining a second handle corresponding to the device according to the name of the device.

[0061] Step S410: Establish a communication connection with the device according to the second handle of the device, and determine whether the communication status with the device is abnormal. If so, go to step S420; if not, go to step S430.

[0062] Step S420: Determine the physical position of the device on the hub according to the physical position determination method in the first embodiment.

[0063] Step S430: Determine whether the device has not failed.

[0064] In step S400 , the principle of obtaining the device name is the same as that of obtaining the device name in step S210 of the first embodiment, and will not be repeated here.

[0065] In step S400, the second handle is different from the first handle in the first embodiment. The second handle is returned by the SCardConnect function of PSCS-Lite. The second handle can be obtained by calling the SCardConnect function with the name of the device as a parameter.

[0066] In step S410, the computing device may communicate with the device according to the second handle of the device. As a possible implementation, the computing device may call the SCardTransmit function based on the second handle of the device to communicate with the device, and then determine whether the device is abnormal according to the communication status of the device. If there is no abnormality, it is determined that the device is not faulty; if there is an abnormality, it means that the device is faulty, and the physical position of the device in the hub can be determined by the method for determining the physical position of the device in the first embodiment.

[0067] In the device testing method designed above, this scheme first determines the second handle corresponding to the device through the name of the device, then establishes communication with the device based on the second handle of the device, and then determines whether the device is faulty based on the communication status. After determining that the device is faulty, this scheme determines the physical location of the faulty device based on the physical location determination method in the first embodiment, so that the faulty device can be quickly found from multiple devices in the hub, thereby achieving the purpose of saving time.

[0068] In an optional implementation manner of this embodiment, after the physical location of the faulty component is determined in step S420, this solution may also indicate the physical location of the faulty component.

[0069] As a possible implementation method, the present application scheme can also be designed as follows Figure 5 The display interface shown, the circular icon on the display interface corresponds to the connection port position in the hub. In a possible implementation, when no device is detected to be inserted at the physical position, the corresponding circular icon on the display interface may be gray as shown in the figure. After the physical position of the device in the hub is determined based on the aforementioned physical position determination method, the circular icon corresponding to the physical position may be lit in green; when the device is detected to have no fault based on the aforementioned test method, the circular icon appears in a green flashing form on the display interface; when the device is detected to have a fault based on the aforementioned test method, the circular icon corresponding to the physical position of the faulty device changes from green to red to remind the staff that the device has a fault; through such a software-indicated implementation method, it is possible to monitor the status and physical position of the smart password key on the hub in real time even if some models of smart password keys may not have indicator lights or the test equipment may be placed in places that are not easy to observe, such as incubators.

[0070] Figure 6The schematic structural block diagram of the device testing device provided by the present application is shown. It should be understood that the device is similar to the above-mentioned Figure 4 Corresponding to the method embodiment executed in, the steps involved in the aforementioned method can be executed. The specific functions of the device can be found in the description above. To avoid repetition, detailed description is appropriately omitted here. The device includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system (OS) of the device. Specifically, the device includes: a second determination module 500, which is used to determine the second handle corresponding to the device according to the name of the device; a judgment module 510, which is used to establish a communication connection with the device according to the second handle of the device, and to determine whether the communication state with the device is abnormal; a determination module 520, which is used to determine that the device has not failed after the judgment module 510 determines that there is no abnormality; and after the judgment module 510 determines that there is an abnormality, determine the physical position of the device on the hub according to the physical position determination method of any optional implementation method in the first embodiment.

[0071] The device testing apparatus designed as above first determines the second handle corresponding to the device through the name of the device, then establishes communication with the device based on the second handle of the device, and then determines whether the device is faulty based on the communication status. After determining that the device is faulty, this scheme determines the physical location of the faulty device based on the physical location determination method in the first embodiment, so that the faulty device can be quickly found from multiple devices in the hub, thereby achieving the purpose of saving time.

[0072] In an optional implementation of this embodiment, the determination module 520 includes a first determination submodule 5210 and a second determination submodule 5220. The first determination submodule 5210 is used to determine that the device has not failed after the determination module 510 determines that there is no abnormality; the second determination submodule 5220 is used to determine the physical position of the device on the hub according to the physical position determination method of any optional implementation of the first embodiment after the determination module 510 determines that there is an abnormality.

[0073] In an optional implementation of this embodiment, the device further includes an indication module 530 for indicating the physical location of the device on the hub.

[0074] like Figure 7As shown, the present application provides an electronic device 6, including: a processor 601 and a memory 602, the processor 601 and the memory 602 are interconnected and communicate with each other through a communication bus 603 and / or other forms of connection mechanisms (not marked), the memory 602 stores a computer program executable by the processor 601, and when the computing device is running, the processor 601 executes the computer program to execute the method in any optional implementation method of the first embodiment, such as steps S200 to S220: obtaining a tree structure data table; determining a corresponding port path of the device according to the name of the device in the computing device system, the port path including connection port information and hub port information; locating a corresponding data unit in the tree structure data table according to the hub port information and connection port information of the device, and obtaining the connection port to which the device is connected to determine the physical position of the device.

[0075] Or when executing, execute the method in any optional implementation method in the second embodiment, such as steps S400 to S430: determine the second handle corresponding to the device according to the name of the device; establish a communication connection with the device according to the second handle of the device, and determine whether the communication status with the device is abnormal; if there is no abnormality, determine that the device has not failed; if it is abnormal, determine the physical position of the device on the hub according to the physical position determination method in the first embodiment.

[0076] The present application provides a storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method in any optional implementation of the first embodiment or the method in any optional implementation of the second embodiment is executed.

[0077] Among them, the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.

[0078] The present application provides a computer program product. When the computer program product is run on a computer, the computer executes a method in any optional implementation of the first embodiment or a method in any optional implementation of the second embodiment.

[0079] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. 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 communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0080] In addition, 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.

[0081] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0082] It should be noted that if the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM) random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0083] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0084] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for determining a physical location of a plurality of devices connected to a computing device, It is characterized in that The plurality of devices are connected to different connection ports of the hub and connected to the ports of the computing device through the hub ports, and the method includes: Acquire a tree structure data table, wherein the tree structure data table includes hub port information and connection port information in a computing device system, and the data units in the tree structure data table correspond to the physical locations of the connection ports provided by the hub; Determine a port path corresponding to the device according to the name of the device in the computing device system, wherein the port path includes the connection port information and the hub port information; Locate the corresponding data unit in the tree structure data table according to the hub port information of the device and the connection port information, obtain the connection port to which the device is connected, and determine the physical location of the device; The method determines a first handle corresponding to the device according to a name of the device in the computing device system, and determines a port path corresponding to the device according to the first handle corresponding to the device, wherein the first handle corresponding to the device is determined according to a name corresponding to the device, and the name corresponding to each device is allocated in sequence according to a power-on order of the devices detected by a daemon process.

2. The method according to claim 1, It is characterized in that The method locates the corresponding data unit by searching the tree structure data table for the hub port corresponding to the hub port information according to the hub port information of the device, and searching the tree structure data table for the connection port corresponding to the connection port information according to the connection port information of the device, thereby obtaining the connection port to which the device is connected.

3. The method according to claim 1, It is characterized in that The method generates a tree structure data table by traversing the hub port information and the connection port information in the computing device system to obtain the tree structure data table.

4. The method according to claim 1, It is characterized in that The hub includes a plurality of hub ports, each of which corresponds to a plurality of connection ports. The method forms a plurality of tree structure data according to the information of the plurality of hub ports of the hub in the computing device system and the information of the plurality of connection ports corresponding to each hub port, and forms the tree structure data table according to the plurality of tree structure data. Each tree structure data has the hub port information as a root node, and has a plurality of connection port information corresponding to the hub port information as a data unit.

5. The method according to claim 4, It is characterized in that The method locates the corresponding data unit by first searching the tree structure data to which the device belongs in the multiple tree structure data according to the hub port information of the device, and then searching the corresponding connection port in the tree structure data to which the device belongs according to the connection port information of the device, thereby searching the connection port corresponding to the device in the tree structure data table.

6. A physical location determination apparatus for determining the physical locations of a plurality of devices connected to a computing device, It is characterized in that The plurality of devices are connected to different connection ports of the hub and connected to the ports of the computing device through the hub ports, and the apparatus comprises: An acquisition module, configured to acquire a tree structure data table, wherein the tree structure data table includes hub port information and connection port information in a computing device system, and a data unit in the tree structure data table corresponds to a physical location of a connection port provided by the hub; A first determining module, configured to determine a port path corresponding to the device according to a name of the device in the computing device system, wherein the port path includes the connection port information and the hub port information; A search module, used to search the corresponding connection port in the tree structure data table according to the hub port information of the device and the connection port information, and obtain the connection port to which the device is connected, so as to determine the physical location of the device; The first determination module is specifically used to determine the first handle corresponding to the device according to the name of the device in the computing device system, and determine the corresponding port path of the device according to the first handle corresponding to the device, wherein the first handle corresponding to the device is determined according to the name corresponding to the device, and the name corresponding to each device is allocated in sequence according to the power-on order of the devices detected by the daemon process.

7. A device testing method, It is characterized in that It is used to perform fault testing on multiple devices connected to a computing device, characterized in that the multiple devices are connected to different connection ports of a hub and connected to the port of the computing device through the hub port, and the method includes: Determine a second handle corresponding to the device according to the name of the device; Establishing a communication connection with the device according to the second handle of the device, and determining whether the communication state with the device is abnormal; If there is no abnormality, it is determined that the device has not failed; If abnormal, the physical location of the device on the hub is determined according to the physical location determination method according to any one of claims 1-5.

8. The test method according to claim 7, It is characterized in that After determining the physical location of the device, the method further includes: indicating the physical location of the device on the hub.

9. A device testing apparatus, It is characterized in that It is used to perform fault testing on multiple devices connected to a computing device, characterized in that the multiple devices are connected to different connection ports of a hub and connected to the ports of the computing device through the hub port. The device is applied to the computing device and includes: A second determining module, used to determine a second handle corresponding to the device according to the name of the device; A judging module, used for establishing a communication connection with the device according to the second handle of the device, and judging whether the communication state with the device is abnormal; A determination module, used to determine that the device has not failed after the determination module determines that it is not abnormal; and used to determine the physical position of the device on the hub according to the physical position determination method described in any one of claims 1-5 after the determination module determines that it is abnormal.