A method for unified automatic discovery and configuration-free one-key connection of multi-interface test instruments based on Linux Qt and LXI library
By adopting a unified automatic discovery method for multi-interface test instruments based on Linux Qt and LXI libraries, the problems of fragmented device discovery systems and dynamic IP adaptation failures in existing test instrument software are solved. This method enables fully automatic discovery and one-click stable connection of various types of test instruments, improving the versatility and stability of the measurement and control software.
Patent Information
- Application Number
- CN202610762656.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-29
- Publication Date
- 2026-08-25
AI Technical Summary
Existing test instrument control software suffers from problems such as fragmented device discovery system, failure of dynamic IP adaptation, cumbersome manual port configuration, weak Linux compatibility, scanning lag, and repeated device display, resulting in cumbersome operation process, poor stability, and poor adaptability.
A unified automatic discovery method for multi-interface test instruments based on Linux Qt and LXI libraries is adopted. Through asynchronous dual-path scanning, dynamic IP mapping, device fingerprint normalization, multi-protocol unified communication abstraction layer and multi-threaded isolation architecture, fully automatic instrument discovery, configuration-free connection and stable communication are achieved.
It enables fully automatic discovery of various types of testing instruments, zero manual configuration, and one-click stable connection, improving the versatility, stability, and ease of use of the measurement and control software, adapting to complex dynamic network environments, and enhancing the security and stability of device connections.
Smart Images

Figure CN122633260A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of test instrument communication, embedded Linux test and control software, and virtual instrument technology, specifically to a unified automatic discovery and configuration-free one-click connection method for multi-interface test instruments based on Linux Qt and LXI libraries. Background Technology
[0002] Oscilloscopes, signal generators, multimeters and other testing instruments generally support LXI network interfaces and USBTMC USB interfaces. Existing host computer measurement and control software has many technical defects when discovering and communicating with such instruments.
[0003] In existing technologies, traditional LXI device tools can only scan network instruments within a local area network and cannot identify USB interface instruments; while USB measurement and control tools only support local USB device enumeration and do not have the ability to discover network LXI devices. The two types of interface device discovery systems are fragmented and cannot be uniformly displayed and managed on the same interface. Users need to manually distinguish the device interface type and manually switch the connection mode, which is cumbersome and has poor adaptability.
[0004] Meanwhile, existing LXI measurement and control software heavily relies on fixed IP configurations. In industrial field DHCP dynamic networking environments, instrument restarts and network segment changes will cause changes in device IPs, which can easily lead to software and device disconnection. Users need to manually query and reconfigure IP addresses, making it unsuitable for dynamic network scenarios and resulting in poor versatility and stability.
[0005] On the other hand, existing instrument connection methods require users to manually configure the SCPI communication port. The port parameters of different manufacturers and models of instruments are not uniform, making the configuration threshold high and failing to achieve one-click connection without configuration. USBTMC devices under Linux systems also have obvious compatibility defects. The system does not have corresponding permission rules by default, and the device node will randomly drift after the device is plugged in, unplugged, or restarted, which can easily lead to problems such as device recognition failure, abnormal opening, and communication interruption.
[0006] In addition, traditional device scanning methods often employ a single-threaded synchronous execution mechanism. When network scanning and USB enumeration are executed simultaneously, it can easily cause UI blocking, scanning lag, and device list refresh errors. Furthermore, the lack of device deduplication logic means that scanning the same device across two interfaces can result in duplicate displays, severely impacting software stability and user experience. In summary, existing test instrument control solutions suffer from technical problems such as limited interface compatibility, cumbersome configuration, poor dynamic environment adaptability, weak Linux compatibility, and insufficient stability. Summary of the Invention
[0007] To address the aforementioned shortcomings of existing technologies, the present invention aims to provide a unified automatic discovery and configuration-free one-click connection method for multi-interface test instruments based on Linux Qt and LXI libraries. This method addresses technical issues in existing technologies such as fragmented LAN / USB device discovery, dynamic IP device adaptation failures, cumbersome manual port configuration, instability of Linux USB devices, scanning lag, and repeated device display. It achieves fully automatic discovery of various types of test instruments, zero manual configuration, and stable one-click connection, thereby improving the versatility, stability, and ease of use of measurement and control software. Technical solution of the present invention
[0008] To achieve the above objectives, the present invention adopts the following technical solution:
[0009] A unified discovery and configuration-free one-click connection method for multi-interface testing instruments based on Linux Qt includes the following steps:
[0010] S1. The software starts and initializes on the Linux system, loads the preset instrument port configuration file, and enables the asynchronous dual-path device scanning mechanism.
[0011] S2. Asynchronously scan the network test instruments that support the LXI protocol in the local area network using the LXI library to obtain the IP address, model and serial number information of each network instrument. At the same time, enumerate the USB bus using libusb to identify USB test instruments that conform to the USBTMC protocol and obtain USB device information.
[0012] S3. For all network and USB instruments obtained from the scan, generate a unique device fingerprint based on the device model, serial number, and interface type. Complete device deduplication and normalization integration, generate a unified device list, and display it to the user through the Qt interface.
[0013] S4. Establish and maintain a dynamic mapping cache between serial numbers and IP addresses in real time. When the IP address of the LXI instrument changes due to dynamic allocation by DHCP, the mapping cache is automatically updated to achieve configuration-free recognition of dynamic IP devices.
[0014] S5. For the selected target instrument, the default Socket port preset in the configuration file is used for connection first. If the default port connection fails, the general SCPI communication ports of the detection instrument are automatically traversed to match a valid communication port.
[0015] S6. Based on the matched IP address and valid communication port, the system automatically completes protocol handshake and link establishment through a preset multi-protocol unified communication abstraction layer, enabling one-click configuration-free connection of the test instrument.
[0016] Furthermore, after the software starts, it automatically detects the permission status of the USBTMC device on the Linux system. When a missing permission is detected, it automatically generates and loads the udev rule file to complete the configuration of permanent read and write permissions for the USBTMC device.
[0017] Furthermore, the USB device node is persistently bound based on the instrument serial number, fixing the USBTMC device path and eliminating the device node drift problem caused by Linux system device restarts and plugging / unplugging.
[0018] Furthermore, the independent network scanning thread and the independent USB enumeration thread execute in parallel, and the two threads are physically isolated from the Qt UI main thread to prevent the device scanning process from blocking the interface rendering and ensure the UI responds smoothly in real time.
[0019] Furthermore, for dual-path scan results of the same device that simultaneously has both an LXI network interface and a USBTMC interface, the unique device fingerprint is used to merge them into a single device entry, thereby blocking duplicate device displays and filtering out offline invalid devices.
[0020] Furthermore, a periodic network rescan mechanism and a USB hot-plug monitoring mechanism are set up to update the LAN device list periodically, respond to USB device insertion and removal events in real time, and dynamically refresh the unified device list.
[0021] Furthermore, it prioritizes using the manufacturer's default fixed port for quick connection. When the connection times out or the link is abnormal, it automatically traverses the common SCPI port groups such as 5025, 5026, and 1234 for polling and probing, and adaptively matches the optimal communication port.
[0022] Furthermore, the multi-protocol unified communication abstraction layer adapts to three communication protocols: LXI Socket, VXI-11, and USBTMC. Upper-layer services call unified connection and data transmission / reception interfaces, while the lower layer automatically adapts to the corresponding physical interface protocols, thus achieving standardized communication for multiple types of instruments.
[0023] Furthermore, after the communication link is established, the link status is monitored in real time. When network jitter, USB disconnection, or data timeout is detected, multiple retry attempts are automatically executed. If a retry fails, a visual status prompt is output.
[0024] Furthermore, after the device is successfully connected, it automatically sends the *IDN® standard SCPI command to read the instrument model and firmware information, and automatically adapts to the corresponding measurement and control command set according to the instrument type, thus completing the command differentiation adaptation.
[0025] Furthermore, based on the list of legitimate device serial numbers pre-stored in the configuration file, the scanned devices are filtered, and only test instruments within the whitelist are displayed and allowed to connect, thereby improving device access security. Beneficial effects of the present invention
[0026] Compared with the prior art, the present invention has the following beneficial effects:
[0027] 1. This invention constructs an asynchronous dual-path parallel scanning mechanism for LXI network devices and USBTMC USB devices, enabling synchronous automatic discovery of two different types of interface testing instruments. By normalizing device fingerprints, it achieves deduplication and integration, and displays a unified device list, solving the problems of fragmented network device and USB device discovery systems and cumbersome operations in traditional technologies.
[0028] 2. This invention sets up a dynamic mapping caching mechanism between serial numbers and IP addresses, which can adapt to DHCP dynamic IP change scenarios in real time. After the device IP changes, there is no need for users to manually query and configure it, realizing seamless identification and continuous connection of dynamic IP devices. It is more adaptable to complex dynamic network environments in industrial sites and has stronger versatility.
[0029] 3. This invention adopts a two-layer adaptation strategy of default port priority + intelligent port automatic detection, which completely eliminates the need for manual port configuration and realizes a true one-click configuration-free connection for testing instruments, greatly reducing the threshold for equipment use and debugging.
[0030] 4. This invention can automatically complete the configuration of permissions for USBTMC devices on Linux systems and persistent binding of device nodes, solving industry pain points such as insufficient permissions, node drift, and instability of plug-and-play on Linux platform USB testing instruments, and greatly improving the device adaptation stability of Linux platform.
[0031] 5. This invention adopts a multi-threaded isolation architecture, which isolates scanning, enumeration, and communication services from the UI main thread, effectively avoiding interface lag and crashes. At the same time, it is equipped with hot-swap monitoring, periodic rescanning, and automatic reconnection mechanisms for abnormalities to achieve real-time updates of device status and stable and controllable links.
[0032] 6. This invention establishes a multi-protocol unified communication abstraction layer, which is compatible with various mainstream instrument communication protocols. Upper-layer services are seamlessly adapted to different interface devices, realizing modular and universal design of measurement and control software. It can be widely adapted to various LXI standard test instruments such as oscilloscopes, signal generators, and multimeters, with a wide range of compatibility and strong scalability.
[0033] 7. This invention adds device whitelist filtering, link anomaly fault tolerance, and automatic instrument capability identification functions, which improves device connection stability and convenience while effectively enhancing device access security and software intelligence. Attached Figure Description
[0034] Figure 1 is a flowchart of the overall process of unified discovery and one-click connection of multi-interface instruments according to the present invention;
[0035] Figure 2 is a schematic diagram of the asynchronous dual-path scanning and device deduplication integration of the present invention;
[0036] Figure 3 is a schematic diagram of the dynamic IP mapping and automatic port detection principle of the present invention. Detailed Implementation
[0037] The present invention will be further described in detail below with reference to specific embodiments.
[0038] This embodiment discloses a unified automatic discovery and configuration-free one-click connection method for multi-interface test instruments based on Linux Qt and LXI libraries. It runs on a Linux operating system, uses Qt to develop host computer measurement and control software, and is compatible with various test instruments supporting the LXI and USBTMC protocols. The specific implementation steps are as follows:
[0039] Step 1: Software Initialization Configuration. After the software starts, it first checks the current system's USBTMC device permissions. If no permissions are configured, it automatically generates and loads the udev rule file, granting the USB testing instrument permanent read and write permissions. Simultaneously, it reads the default Socket communication ports for various instruments preset in the local configuration file, initializes the network scanning thread, USB enumeration thread, and communication management module, completing the software startup initialization. At the same time, it binds the USB device nodes based on their serial numbers, fixing the device access path and preventing node drift.
[0040] Step 2: Dual-path asynchronous device scanning. Start independent network scanning and USB enumeration threads. The network thread calls the VXI-11 scanning interface of the LXI library to broadcast and traverse all LXI instruments within the local area network, collecting key information such as instrument IP address, device model, and unique serial number. The USB thread calls the libusb interface to traverse the system USB bus, filtering for test instruments conforming to the USBTMC protocol, and obtaining information such as USB device VID, PID, serial number, and device model. The two threads run in parallel without interference and do not consume UI main thread resources.
[0041] Step 3: Device Normalization and Deduplication. For all network and USB devices acquired during the scan, a device fingerprint ID is generated using "device model + device serial number + interface type" as the unique dimension. For cases where the same instrument has both network and USB interface scan results, they are automatically merged into a single device data entry, and duplicate device entries are removed. Simultaneously, the online status of the devices is verified, and offline invalid devices are filtered out. Finally, a standardized, non-duplicate unified device list is generated and displayed in real-time on the Qt interactive interface for user selection.
[0042] Step 4: Real-time Update of Dynamic IP Mapping. A local cache mapping table is established to associate and store the serial number and corresponding IP address of each instrument. During software operation, a network rescan is periodically performed to compare device IP information in real time. When an instrument's IP address changes due to DHCP dynamic allocation, the system automatically updates the cached serial number-IP mapping relationship, eliminating the need for manual configuration changes by the user and ensuring that devices can always be addressed and identified normally. Simultaneously, USB hot-plug events are monitored, and the device list is refreshed in real time the moment a device is plugged in or unplugged.
[0043] Step 5: Intelligent Port Adaptive Matching. After the user selects the target test instrument on the interface, the system first reads the default Socket port of the instrument model pre-stored in the configuration file and initiates a communication connection request. If the default port connection times out, the handshake fails, or the link is abnormal, the system automatically starts the port detection mechanism, sequentially traversing common SCPI communication ports such as 5025, 5026, and 1234, attempting handshake communication one by one, and automatically matching a valid port that can communicate normally.
[0044] Step Six: Unified Protocol Link Establishment and Device Adaptation. Through a pre-defined multi-protocol unified communication abstraction layer, the software automatically matches the LXI Socket, VXI-11, or USBTMC communication protocol based on the device interface type, automatically completing protocol handshake, link initialization, and communication channel establishment, achieving one-click configuration-free connection. After successful connection, the software automatically sends the *IDN? SCPI command to read the instrument's identity information, identify the instrument model and firmware version, and automatically adapt to the corresponding measurement and control, data reading command set.
[0045] Step 7: Link Monitoring and Security Management. During communication, the link data transmission status is monitored in real time. For anomalies such as network jitter, USB disconnection, and data timeout, the system automatically performs three retry attempts. If a retry fails, a visual prompt indicating device offline or connection error is displayed on the interface. Simultaneously, based on the device whitelist serial number list in the configuration file, unauthorized devices are filtered, allowing only authorized devices to connect, ensuring device monitoring and control security.
Claims
1. A unified automatic discovery and configuration-free one-click connection method for multi-interface testing instruments based on Linux Qt and LXI libraries, comprising the following steps: S1. The software starts and initializes on the Linux system, loads the preset instrument port configuration file, and enables the asynchronous dual-path device scanning mechanism. S2. Asynchronously scan the network test instruments that support the LXI protocol in the local area network using the LXI library to obtain the IP address, model and serial number information of each network instrument. At the same time, enumerate the USB bus using libusb to identify USB test instruments that conform to the USBTMC protocol and obtain USB device information. S3. For all network instruments and USB instruments obtained from the scan, generate a unique device fingerprint based on the device model + serial number + interface type, complete the device deduplication and normalization integration, generate a unified device list and display it through the Qt interface; S4. Establish and maintain a dynamic mapping cache between serial numbers and IP addresses in real time. When the IP address of the LXI instrument changes due to dynamic allocation by DHCP, the mapping cache is automatically updated to achieve configuration-free recognition of dynamic IP devices. S5. For the selected target instrument, the default Socket port preset in the configuration file is used for connection first. If the default port connection fails, the general SCPI communication ports of the detection instrument are automatically traversed to match a valid communication port. S6. Based on the matched IP address and valid communication port, the system automatically completes protocol handshake and link establishment through a preset multi-protocol unified communication abstraction layer, enabling one-click configuration-free connection of the test instrument.
2. The method according to claim 1, characterized in that, After the software starts, it automatically detects the permission status of the USBTMC device on the Linux system. When a missing permission is detected, it automatically generates and loads the udev rule file to complete the configuration of permanent read and write permissions for the USBTMC device.
3. The method according to claim 1, characterized in that, Persistent binding of USB device nodes is performed based on the instrument serial number, fixing the USBTMC device path and eliminating device node drift issues caused by Linux system device restarts and plugging / unplugging.
4. The method according to claim 1, characterized in that, The independent network scanning thread and the independent USB enumeration thread execute in parallel, and the two threads are physically isolated from the Qt UI main thread to prevent the device scanning process from blocking the interface rendering.
5. The method according to claim 1, characterized in that, For dual-path scan results of the same device that has both an LXI network interface and a USBTMC interface, the unique device fingerprint is used to merge them into a single device entry, while filtering out offline invalid devices.
6. The method according to claim 1, characterized in that, Configure a periodic network rescan mechanism and a USB hot-plug monitoring mechanism to update the LAN device list periodically, respond to USB device plug-in / plug-out events in real time, and dynamically refresh the unified device list.
7. The method according to claim 1, characterized in that, It prioritizes using the manufacturer's default fixed port for quick connection. When a connection error occurs, it automatically traverses the common SCPI port groups such as 5025, 5026, and 1234 for polling and probing, and adaptively matches the optimal communication port.
8. The method according to claim 1, characterized in that, The multi-protocol unified communication abstraction layer adapts to three communication protocols: LXI Socket, VXI-11, and USBTMC. Upper-layer business calls the unified connection and data transmission / reception interface, while the lower layer automatically adapts to the corresponding physical interface protocol.
9. The method according to claim 1, characterized in that, After the communication link is established, the link status is monitored in real time. When network jitter, USB disconnection, or data timeout is detected, multiple retry attempts are automatically performed. If the retry fails, a visual status prompt is output.
10. The method according to claim 1, characterized in that, After successful device connection, it automatically sends the *IDN? standard SCPI command to read the instrument model and firmware information, and automatically adapts to the corresponding measurement and control command set according to the instrument type; based on the list of legal device serial numbers pre-stored in the configuration file, it filters the scanned devices and only displays and allows connection to test instruments within the whitelist.