Multi-camera device distinguishing method and system on Android system
By parsing the VID and PID of the USB camera, and combining the soft connection path and driver information, a three-dimensional mapping relationship is established, which solves the problem of distinguishing multiple USB camera devices in the Android system, realizes accurate device identification and seamless recovery, and improves the system's reliability and management efficiency.
Patent Information
- Application Number
- CN202510768835.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2025-10-28
AI Technical Summary
The existing Android system relies on dynamic node IDs to distinguish between multiple USB camera devices, which leads to functional errors after device reconnection. It cannot accurately distinguish between external USB cameras and internal virtual cameras, and cannot accurately identify devices of the same model, resulting in low system reliability.
By parsing the soft connection path and driver information of video device nodes, the VID and PID of the USB camera are extracted as unique identifiers. Combined with the physical path of the USB Host interface, a three-dimensional mapping relationship is established to achieve intelligent device differentiation. The function label is automatically restored through VID/PID when the device is reconnected.
It enables precise differentiation and dynamic management of multiple USB cameras on the Android system, supports real-time monitoring of hot-plug events, improves device management efficiency and system reliability, and reduces manual configuration costs.
Smart Images

Figure CN120848962A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer application technology, and in particular to a method and system for distinguishing multiple camera devices on an Android system. Background Technology
[0002] With the widespread application of the Android system in various devices, such as smart monitoring equipment, industrial inspection equipment, and smart security systems, the use of multi-USB camera devices is becoming increasingly common. By connecting multiple USB cameras, devices can achieve richer functions, such as panoramic monitoring, multi-angle shooting, and multi-scene recognition. However, accurately distinguishing these multi-USB camera devices connected to the Android system has become an important problem that urgently needs to be solved.
[0003] Current Android systems rely solely on dynamically assigned device node IDs when distinguishing between multiple USB camera devices, lacking an effective mechanism to differentiate between external USB cameras and internal virtual cameras. Firstly, the lack of a stable, unique device identifier established through the USB protocol layer's Vendor Identifier (VID) and Product Identifier (PID) leads to functional errors when devices are disconnected and reconnected due to changes in the node ID, resulting in mismatches with historical function tags. Secondly, the absence of a multi-level filtering strategy combining soft connection path resolution and driver information detection makes it difficult to accurately exclude internal virtual devices, and it cannot achieve precise one-to-one differentiation for multiple camera devices with the same VID / PID. This ultimately causes problems such as chaotic multi-device function mapping, cumbersome manual configuration, and low system reliability, failing to meet the needs of multi-camera collaborative work in scenarios such as intelligent monitoring and industrial inspection.
[0004] Specific defects may include: when multiple USB cameras with the same VID / PID are connected, the system relies solely on dynamically assigned device node IDs (such as videoXX) for identification, failing to establish a "hardware identifier-physical location-function" association, leading to confusion in the function mapping of devices of the same model; without a multi-level filtering strategy that uses soft link path resolution and driver information detection, it is difficult to effectively distinguish between external USB cameras and virtual devices generated by internal virtual drivers (such as uvc_gadget), resulting in misidentification of internal and external devices; when the system reassigns node IDs after a device is disconnected and reconnected, the historical function mapping cannot be automatically restored because the VID / PID hardware identifier is not bound, requiring manual reconfiguration. Summary of the Invention
[0005] The purpose of this invention is to overcome one or more shortcomings of the prior art and provide a method and system for distinguishing multiple camera devices on an Android system.
[0006] The objective of this invention is achieved through the following technical solution:
[0007] A method for distinguishing multiple USB camera devices on an Android system includes the following steps:
[0008] Device node traversal: Scan all video device nodes (videoXX) under the video device system directory ( / sys / class / video4linux) and obtain the system path corresponding to each node;
[0009] External device identification: By parsing the soft connection path of the video device node, it can be determined whether it is an external USB camera device;
[0010] Built-in device filtering: excludes in-machine virtual camera devices associated with the in-machine virtual driver (uvc_gadget);
[0011] Device information binding: Extract the VID (manufacturer identification code) and PID (product identification code) of the external USB camera, use the VID and PID to uniquely identify the external USB camera device, and establish a mapping relationship between it and the preset function tags (such as "front camera" and "industrial camera") to achieve intelligent differentiation of different USB camera devices.
[0012] A three-dimensional mapping relationship is established, consisting of VID / PID, USB Host interface physical path, and function tag. When a device with the same VID / PID is connected, the physical location is differentiated through the USB Host interface physical path. When the device reconnects, the pre-assigned function tag is restored based on the historical three-dimensional mapping relationship of VID / PID.
[0013] Furthermore, the external device identification steps specifically include: executing system commands to obtain a soft connection string for each video device node; if the string contains a USB feature identifier, it is determined to be an external USB camera device, thereby excluding non-USB type camera devices.
[0014] Furthermore, the "built-in device filtering" step specifically includes: by reading the driver information file corresponding to the video device node, determining whether the device is associated with an internal virtual driver (uvc_gadget); if it is associated with an internal virtual driver, it is determined to be an internal virtual camera device and the node is skipped to filter out non-external hardware devices.
[0015] Furthermore, extracting the VID and PID information of the external USB camera specifically includes: parsing the device's USB attributes through system commands to extract the VID and PID; the combination of VID and PID constitutes the unique hardware identifier of the external USB camera device.
[0016] It also includes: Device status monitoring: Real-time monitoring of device hot-plug events, capturing the insertion and removal of USB cameras and dynamic changes of video device node ID (videoXX);
[0017] Anomaly Recovery Handling: When a device reconnects, the system matches the historical mapping relationship using the uniquely identified VID and PID, ignoring the system's reassigned video device node ID and directly restoring the pre-assigned function labels. A "VID / PID Priority Matching" mechanism is implemented: When device reconnection causes a change in node ID, the system directly matches the historical 3D mapping relationship using VID / PID, bypassing the system's dynamically assigned node ID, and automatically restores the pre-assigned function labels and configuration parameters, achieving seamless device status recovery.
[0018] The establishment of the three-dimensional mapping relationship includes: obtaining the USBHost interface level information (such as usb1 / 1-1) by parsing the soft connection path of the video device node, and binding and storing it in combination with VID / PID and preset function tags.
[0019] A multi-USB camera device differentiation system on an Android system includes:
[0020] Device traversal module: used to scan the video device system directory, generate a list of video device nodes and obtain the corresponding system paths;
[0021] Type recognition module: By parsing the soft connection path, it distinguishes between external USB cameras and non-USB devices;
[0022] Filtering module: Based on driver information, excludes built-in virtual devices associated with internal virtual drivers;
[0023] Mapping Management Module: Extracts the VID and PID of the external USB camera as a unique hardware identifier, establishes a mapping relationship between it and the function label, and realizes intelligent device differentiation.
[0024] Furthermore, the type identification module includes: a soft connection parsing unit: executing system commands to obtain the complete path string of the video device node;
[0025] USB Feature Matching Unit: Detects USB feature identifiers using a string matching algorithm and outputs a candidate list of external USB camera devices.
[0026] Furthermore, the filtering module includes:
[0027] Driver reading unit: Accesses the driver information file corresponding to the video device node to obtain the device driver name;
[0028] Built-in device filtering unit: When the driver name is an in-machine virtual driver (uvc_gadget), remove the device node from the candidate list to ensure that only external hardware cameras are retained.
[0029] Furthermore, it also includes: a hot-swap monitoring module: registering device status change events of the USB subsystem and collecting device insertion, removal, and video device node ID change events in real time;
[0030] Dynamic binding module: Based on the unique hardware identifiers of VID and PID, it bypasses the dynamically assigned video device node ID by the system when the device reconnects and directly matches the historical function tags to achieve seamless restoration of the device status.
[0031] The beneficial effects of the present invention are:
[0032] (1) By extracting the VID / PID of the USB camera as an identifier, and combining the soft connection path parsing and driver information detection multi-level filtering strategy, the accurate differentiation and dynamic management of multiple USB cameras on the Android system is realized, which effectively solves the problems of device reconnection function disorder, internal and external device confusion and inaccurate identification of the same model of device caused by the reliance on dynamic node ID in the prior art; the "three-dimensional mapping mechanism" realizes the accurate association between the physical location and function of the same VID / PID device, which solves the problem of indistinguishable devices of the same model in the prior art;
[0033] (2) The system supports real-time monitoring of hot-plug events and automatic recovery of function tags, which significantly improves the efficiency of device management and system reliability in multi-camera environments; it adopts a dual filtering strategy of soft connection path parsing and driver information detection to accurately distinguish between external USB cameras and internal virtual devices.
[0034] (3) Based on the VID / PID dynamic recovery mechanism, the historical function mapping is automatically matched when the device is reconnected, without manual intervention, which improves the reliability of device management in multi-camera environments; it is compatible with multi-level HUB cascading and mixed access of multiple types of devices. Through automated function binding and abnormal handling mechanisms, it reduces the cost of manual configuration and realizes stable mapping between device physical location and function label, providing an efficient and reliable general solution for multi-camera collaborative work. Attached Figure Description
[0035] Figure 1 A flowchart illustrating the steps of a method for distinguishing multiple USB camera devices on an Android system, provided as an example.
[0036] Figure 2 This is a structural diagram of a multi-USB camera device differentiation system provided in an embodiment;
[0037] Figure 3The hardware connection structure diagram provided for the embodiment. Detailed Implementation
[0038] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0039] Example 1
[0040] like Figure 1 As shown, the method follows the main steps of "device traversal → type identification → filtering → binding → dynamic management" to achieve intelligent differentiation and stable management of multiple USB cameras.
[0041] The specific steps are as follows:
[0042] Device node traversal: Scan all video device nodes (videoXX) under the video device system directory ( / sys / class / video4linux) and obtain the system path corresponding to each node;
[0043] External device identification: By parsing the soft connection path of the video device node, it can be determined whether it is an external USB camera device;
[0044] Built-in device filtering: excludes in-machine virtual camera devices associated with the in-machine virtual driver (uvc_gadget);
[0045] Device information binding: Extract the VID (Manufacturer Identification Code) and PID (Product Identification Code) of the external USB camera, use the VID and PID to uniquely identify the external USB camera device, and establish a mapping relationship between it and preset function tags (such as "front camera" or "industrial camera") to achieve intelligent differentiation of different USB camera devices.
[0046] A three-dimensional mapping relationship is established, consisting of VID / PID, USB Host interface physical path, and function tag. When a device with the same VID / PID is connected, the physical location is differentiated through the USB Host interface physical path. When the device reconnects, the pre-assigned function tag is restored based on the historical three-dimensional mapping relationship of VID / PID.
[0047] Specifically, this could involve setting up an intelligent differentiation mechanism that integrates "hardware-driver-protocol layer three-level feature fusion":
[0048] Hardware layer feature analysis: By parsing the soft link path of the video device node (such as executing ls -l / sys / class / video4linux / videoXX), the "usb" feature identifier is extracted to identify external USB devices and exclude non-USB type cameras;
[0049] Driver layer feature filtering: Read the driver information file corresponding to the device node (such as / sys / class / video4linux / videoXX / device / driver) and exclude built-in virtual devices associated with the internal virtual driver (uvc_gadget);
[0050] Protocol layer feature binding: Extract the VID / PID of the USB camera as a unique hardware identifier, and establish a three-dimensional mapping relationship of "VID / PID-physical path-functional label" in combination with the physical path of the USB Host interface (such as Host1-HUB-Port1) to achieve accurate differentiation of devices of the same model.
[0051] For example: When an Android device connects to the same model of camera (both with the same VID / PID) via Host1-HUB and Host2 respectively:
[0052] The system parses the USB Host level information (such as Host1-HUB-Port1 and Host2-Port1) in the soft link path and establishes a differentiated three-dimensional mapping relationship by combining VID / PID;
[0053] When one of the cameras disconnects and reconnects, the system automatically restores its function label based on the historical mapping of VID / PID and USB Host path matching, without the need for manual reconfiguration, thus solving the problem of function disorder caused by node ID changes in the existing technology.
[0054] See Figure 2 Based on a method for distinguishing multiple USB camera devices, a system for distinguishing multiple USB camera devices is established. This system consists of multiple modules working together to achieve accurate identification and management of different USB cameras, as described in detail below:
[0055] Device traversal module: As the starting point of the system, this module is responsible for scanning all video device nodes in the system (such as nodes under the / sys / class / video4linux directory), generating a list of device nodes, and providing basic data for subsequent recognition and processing.
[0056] Type recognition module:
[0057] Symbolic link resolution unit: Extracts path information by parsing the symbolic link path of the device node (e.g., obtaining the path string by executing the ls -l command).
[0058] USB feature matching unit: Checks whether the soft connection path contains the "USB" feature identifier (such as usb1 / 1-1 / uvcvideo / video0) to determine whether the device is an external USB device, and initially excludes non-USB devices (such as onboard cameras).
[0059] Filtering module:
[0060] Driver reading unit: Reads driver information of device nodes (path such as / sys / class / video4linux / videoXX / device / driver).
[0061] Built-in device filtering unit: If the driver is uvc_gadget (representing an internal virtual driver), the device is determined to be a built-in virtual camera and filtered to ensure that only external hardware cameras are retained.
[0062] Mapping Management Module: For selected external USB cameras, the Provider Identifier (VID) and Product Identifier (PID) are extracted to form a unique hardware identifier. Based on this identifier, a mapping relationship is established with functional labels (such as "front-facing camera" or "industrial camera") and stored in the system configuration, realizing the association between camera hardware and function.
[0063] Hot-plug monitoring module: Real-time monitoring of uevent events in the USB subsystem, capturing device insertion and removal actions and node ID changes (such as video0 changing to video3), providing event trigger signals for dynamic device management.
[0064] Dynamic binding module: When the device reconnects and the system reassigns the node ID, it matches the historical mapping relationship through VID / PID, ignores the new node ID, and directly restores the pre-assigned function label of the device, ensuring that the device can still be correctly identified and used even after the node ID changes, thus solving the problem of device identification failure after hot-plugging.
[0065] Inter-module collaboration process:
[0066] The device traversal module scans and generates a node list → the type identification module distinguishes external USB devices by parsing soft links and matching them with USB features → the filtering module excludes built-in virtual devices based on driver information → the mapping management module extracts VID / PID and binds function tags → the hot-plug monitoring module monitors device status changes → the dynamic binding module restores function tags through VID / PID when the device is reconnected, forming a complete closed loop for device differentiation and management.
[0067] Through the orderly collaboration of its various modules, this system achieves accurate identification, filtering, binding, and dynamic management of external USB cameras, ensuring stable and accurate use of devices in multi-camera environments. It is suitable for multi-camera application scenarios such as smart retail, telemedicine, and industrial inspection.
[0068] The specific steps are as follows:
[0069] Device node traversal: Loop through folders with the prefix "video" under the directory / sys / class / videod4linux, and check if there are any unchecked folders;
[0070] Specifically, the device traversal module scans the video device system directory ( / sys / class / video4linux), generates a list of all device nodes (such as video0, video1), and obtains the complete system path of each node, providing basic data for subsequent recognition.
[0071] External device identification and type filtering: Determine if it is the videoxx folder, and execute ls -l / sys / class / video4linux / videoxx to get the corresponding output string and check if this string contains the substring "usb";
[0072] Specifically, the type recognition module obtains the soft link string by executing system commands (such as ls -l) through the "soft link parsing unit" and uses the "usb feature matching unit" to detect the "usb" substring to distinguish between external USB cameras and non-USB devices (such as HDMI cameras).
[0073] The filtering module accesses / sys / class / video4linux / videoXX / device / driver through the "driver reading unit". If the driver is uvc_gadget (internal virtual driver), it is filtered by the "built-in device filtering unit" to ensure that all candidate devices are external hardware.
[0074] VID / PID extraction and function binding: Determine if it is an internal UVC gadget device;
[0075] Specifically, the mapping management module extracts the Vendor Identifier (VID) and Product Identifier (PID) of external cameras through system commands (such as udevadm info) to form a unique hardware identifier. Based on the VID / PID, a mapping relationship is established with functional labels (such as "front-facing camera" or "industrial camera"), which is stored in the system configuration file or database to achieve intelligent differentiation between different cameras.
[0076] Dynamic device management and anomaly recovery: Obtain the VID and PID of the videoxx device and mark the function of this videoxx device, and continue to search for the next device;
[0077] Specifically, the hot-plug listening module registers the uevent event of the USB subsystem to capture device insertion, removal, and node ID changes (such as video0 becoming video3) in real time.
[0078] When a device reconnects, the dynamic binding module matches the historical mapping relationship using VID / PID, ignoring the node ID reassigned by the system and directly restoring the pre-assigned functional label, thus resolving the identification failure issue caused by device ID changes.
[0079] Example 2: Multi-camera product detection in smart retail stores:
[0080] In the intelligent shelf management system of large chain supermarkets, an advanced multi-camera detection system is needed to achieve accurate merchandise management, efficient inventory counting, and a good customer shopping experience. This system connects to multiple USB cameras via Android devices, not only to comprehensively monitor the merchandise on the shelves but also to analyze customer behavior and optimize merchandise display.
[0081] See Figure 3 Hardware connection implementation: Physical architecture: The Android motherboard is equipped with multiple high-performance USB Host ports to meet the connection needs of different types of cameras.
[0082] like Figure 3 As shown, Android system devices connect to external USB cameras and USB hubs through multiple USB host interfaces (such as Host1, Host2, and Host3), forming a multi-device expansion architecture (such as...). Figure 3(As shown). Each USB camera connects to a HUB via a USB cable or directly to a USB port (such as a Type-C port) on the Android motherboard, generating a corresponding device node (such as / dev / videoXX) and system path (such as / sys / class / video4linux / videoXX) in the system. The soft connection path of external USB cameras contains the "usb" characteristic identifier (such as / sys / devices / usb1 / 1-1 / uvcvideo / video0). Through the "soft connection resolution unit" and "usb characteristic matching unit", it can be quickly identified as an external USB device, excluding non-USB type cameras (such as onboard cameras). Built-in cameras such as "CAMERA1" and "CAMERA2" implement virtual functions through the uvc_gadget driver. Their soft connection path contains "virtual" or the driver information is uvc_gadget. Through the "driver reading unit" and "built-in device filtering unit", they are automatically filtered from candidate devices to ensure that only external hardware cameras are retained.
[0083] USB Host1: Connects to a 4-port smart HUB (e.g., ...) Figure 3 (An extension of the "USB HUB" component shown). This HUB features intelligent identification and power distribution capabilities, dynamically adjusting power supply according to the needs of connected devices.
[0084] Port1: Wide-angle camera C1 (VID=0x1234 / PID=0x5678), installed above shelf A, is used for panoramic monitoring of shelf A, and its field of view can cover the entire shelf's merchandise display.
[0085] Port2: Macro camera C2 (VID=0x5678 / PID=0x9ABC), fixed near the shelf in section A, is specifically used to identify the barcodes and product label information of products in section A.
[0086] Port3: Infrared camera C5 (VID=0xDEFG / PID=0x1234) is used to detect temperature and humidity changes in shelf area A to ensure a suitable storage environment for goods.
[0087] Port4: Behavior analysis camera C6 (VID=0xHIJK / PID=0x5678), installed on the side of shelf A, is used to capture customer behavior in front of the shelf, such as dwell time and picking up goods.
[0088] Usb Host2: Directly connects to multiple cameras to provide a more stable connection and higher data transfer rate.
[0089] Port1: Wide-angle camera C3 (VID=0x1234 / PID=0x5678), located above shelf area B, is responsible for panoramic monitoring of shelf area B.
[0090] Port2: Macro camera C4 (VID=0x5678 / PID=0x9ABC), located on the shelf in section B, used for barcode recognition of goods in section B.
[0091] Port3: 3D camera C7 (VID=0xLMNO / PID=0x9ABC), installed in the corner of shelf area B, is used to build a 3D model of shelf area B for more accurate analysis of product placement and inventory status.
[0092] Built-in camera, such as Figure 3 The “CAMERA1” shown in the image implements a virtual preview function through the uvc_gadget driver. It is mainly used for system self-testing and debugging and is automatically excluded by the filtering module during normal operation.
[0093] C1 and C3 are wide-angle cameras from the same manufacturer and of the same model. Although their VID / PID are exactly the same, their installation locations and functions differ. Their functions can be accurately distinguished by their USB Host interfaces (Host1 / Host2) and HUB port numbers.
[0094] C2 and C4 are macro cameras from different manufacturers, with different VID / PID, which can be directly distinguished by hardware identifiers.
[0095] C5, C6, and C7 each have different functions and characteristics, and are identified and managed through their unique VID / PID.
[0096] Detailed description of the software process
[0097] Device initialization and node selection include the process of "device traversal, identification, and filtering".
[0098] After the full directory scanning system starts, the device traversal module will periodically and comprehensively scan the / sys / class / video4linux directory. This scanning process uses multi-threading technology to improve scanning efficiency. After the scan is complete, all possible video device nodes are obtained, including external device nodes (such as video0 - video6) and built-in virtual nodes (such as video7).
[0099] USB feature matching: A detailed string matching analysis is performed on the symbolic link path of each node. Regular expression techniques are used to quickly and accurately determine whether the path contains the substring "usb". If it does not, it is identified as a non-USB device; for example, the path of a built-in camera typically does not contain "usb" and is therefore excluded.
[0100] Driver detection: The driver information for each node is read from the path / sys / class / video4linux / videoXX / device / driver. A precise string comparison is used to determine if the driver name is uvc_gadget. If it is, the node is removed from the candidate list, ultimately retaining all external camera nodes.
[0101] The hardware identification process, "Extract VID / PID," parses the device's USB attributes using system commands to obtain the VID / PID for each camera. Employing an intelligent parsing algorithm, it automatically processes USB attribute information in different formats, ensuring accurate VID / PID extraction.
[0102] C1 / C3: VID=0x1234, PID=0x5678; C2 / C4: VID=0x5678, PID=0x9ABC; C5: VID=0xDEFG, PID=0x1234; C6: VID=0xHIJK, PID=0x5678; C7: VID=0xLMNO, PID=0x9ABC;
[0103] Establish a multidimensional mapping table containing VID / PID, physical path, function label, and configuration parameters. This mapping table is stored in the system's database, supporting fast querying and dynamic updates.
[0104] Table 1 Multidimensional Mapping Table
[0105]
[0106] Hot-swap event handling (via the "Hot-swap monitoring module" + "Dynamic binding module"): When C2 (A-area barcode recognition) is disconnected due to an unexpected situation (such as a loose cable):
[0107] Event Capture: The hot-plug monitoring module can detect device removal within milliseconds by monitoring system hardware events in real time. Simultaneously, it records the current VID / PID (0x5678 / 0x9ABC), function label (“Area A Barcode Recognition”), the last connected node ID (e.g., video1), and the disconnection time.
[0108] Task Pause and Adjustment: Trigger the detection task interruption logic and send a "Detection Equipment Abnormality" alarm to the shelf management system. At the same time, temporarily adjust the task of C4 (B-zone camera) so that it can also perform some barcode recognition tasks in A-zone while completing the barcode recognition task in B-zone, but reduce the frame rate to 10fps to ensure the stability of the overall system.
[0109] After the C2 connection is manually restored, the system performs the following steps:
[0110] New node identification: A new node video8 was discovered during scanning. Through detailed analysis of the soft connection path and driver information, it was determined that it is an external USB camera.
[0111] VID / PID matching: Extract the VID / PID (0x5678 / 0x9ABC) of the new node and perform an exact match with the historical records to confirm that it belongs to the C2 device.
[0112] Dynamic binding recovery: The mapping management module ignores the new node ID video8 and directly binds it to the "Area A Barcode Recognition" label. At the same time, it reads the device's configuration parameters (resolution 1280×720, frame rate 20fps) from the database and resumes the original detection task.
[0113] C1 / C3 sensors acquire real-time panoramic images of the shelving and transmit the image data to the local edge computing module. The edge computing module uses advanced image recognition algorithms to detect the compliance of product display, such as whether items are out of stock or misplaced. Simultaneously, the detection results are fed back to the shelving management system in real time.
[0114] C2 / C4 scanners perform micro-scanning of shelf panels to identify product barcodes and label information. The identification results are compared with the cloud-based inventory system to generate a detailed discrepancy report. If any inventory anomalies are detected, replenishment personnel are promptly notified for handling.
[0115] The C5 monitors the temperature and humidity changes in area A of the shelving in real time and uploads the data to the system's environmental management module. If the temperature or humidity exceeds the preset range, the system automatically issues an alarm and adjusts the environmental control equipment on the shelving (such as air conditioners and humidifiers).
[0116] C6 captures customer behavior in shelf area A and analyzes customer dwell time and product frequency using behavioral analytics algorithms. The analysis results are then correlated with product sales data to provide a basis for adjusting product display and marketing strategies.
[0117] C7 constructs a 3D model of shelf area B, and optimizes and analyzes the model using 3D modeling algorithms. The system can accurately calculate information such as inventory quantity and space utilization, providing more accurate decision support for warehouse management and merchandise replenishment.
[0118] It provides a visual device status monitoring interface, employing real-time data update technology to display the connection status, function labels, current tasks, anomaly records, and configuration parameters of each camera in real time. Administrators can manually adjust labels through this interface (e.g., temporarily switching C3 from "B Zone Panorama" to "Entrance Pedestrian Monitoring"), and the system automatically updates the mapping relationship and synchronizes it to all related modules. The interface also provides data analysis and report generation functions to help administrators better manage and optimize the system.
[0119] like Figure 3 As shown, the Android motherboard connects to the HUB and multiple cameras via USB Host1 / 2, with built-in device labels indicating their connection to the HUB and cameras. Figure 3 The interface is consistent with "CAMERA1". It clearly presents the connection location and method of each camera, corresponding one-to-one with the actual hardware connection. It fully covers the "traversal, recognition, filtering, binding, and hot-swapping" process, and the interaction between each module is clearly shown. Figure 2 Each node corresponds to a specific device. For example, the "filtering module" accurately excludes built-in devices, while the "dynamic binding module" efficiently handles VID / PID matching and function recovery.
[0120] This invention extracts the VID / PID of a USB camera as a unique hardware identifier and combines it with a multi-level filtering strategy involving soft connection path parsing and driver information detection. This enables accurate differentiation and dynamic management of multiple USB cameras on an Android system, effectively solving problems such as device reconnection errors, confusion between internal and external devices, and inaccurate identification of the same model of device caused by reliance on dynamic node IDs in existing technologies. The system supports real-time monitoring of hot-plug events and automatic recovery of function tags, handling device node ID changes without manual intervention, significantly improving device management efficiency and system reliability in multi-camera environments. The solution is compatible with multi-level HUB cascading and mixed access of multiple types of devices, and can be widely applied in scenarios such as smart retail, industrial inspection, and telemedicine. Through automated function binding and anomaly handling mechanisms, it reduces manual configuration costs and achieves stable mapping between device physical locations and function tags, providing an efficient and reliable universal solution for multi-camera collaborative work.
[0121] The above description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the forms disclosed herein and should not be construed as excluding other embodiments. It can be used in various other combinations, modifications, and environments, and can be altered within the scope of the concept described herein through the above teachings or related technologies or knowledge. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims.
Claims
1. A method for distinguishing multiple USB camera devices on an Android system, characterized in that, The following steps are involved: Device node traversal: Scan all video device nodes in the video device system directory and obtain the system path corresponding to each node; External device identification: By parsing the soft connection path of the video device node, it can be determined whether it is an external USB camera device; Built-in device filtering: excludes in-machine virtual camera devices associated with in-machine virtual drivers; Device information binding: Extract the VID and PID of the external USB camera, use the VID and PID to uniquely identify the external USB camera device, and establish a mapping relationship between it and the preset function tags to achieve intelligent differentiation of different USB camera devices. A three-dimensional mapping relationship is established, consisting of VID / PID, USB Host interface physical path, and function tag. When a device with the same VID / PID is connected, the physical location is differentiated through the USB Host interface physical path. When the device reconnects, the pre-assigned function tag is restored based on the historical three-dimensional mapping relationship of VID / PID.
2. The method for distinguishing multiple USB camera devices on an Android system according to claim 1, characterized in that, The external device identification steps specifically include: executing system commands to obtain a soft link string for each video device node; if the string contains a USB feature identifier, it is determined to be an external USB camera device, thus excluding non-USB type camera devices.
3. The method for distinguishing multiple USB camera devices on an Android system according to claim 1, characterized in that, The "built-in device filtering" step specifically includes: determining whether the device is associated with an internal virtual driver by reading the driver information file corresponding to the video device node; if it is associated with an internal virtual driver, it is determined to be an internal virtual camera device and the node is skipped to filter out non-external hardware devices.
4. The method for distinguishing multiple USB camera devices on an Android system according to claim 1, characterized in that, Extracting the VID and PID information of an external USB camera specifically involves: parsing the device's USB attributes through system commands to extract the VID and PID; the combination of VID and PID constitutes the unique hardware identifier of the external USB camera device.
5. The method for distinguishing multiple USB camera devices on an Android system according to claim 1, characterized in that, Also includes: Device status monitoring: Real-time monitoring of device hot-plug events, capturing the insertion and removal of USB cameras and dynamic changes in video device node IDs; Anomaly recovery handling: When the device reconnects, the historical mapping relationship is matched by the uniquely identified VID and PID, ignoring the video device node ID reassigned by the system, and the pre-assigned function label is directly restored; The function recovery during device reconnection includes: by listening to USB subsystem hot-plug events, retrieving historical mapping relationships based on VID / PID, and automatically restoring function tags and corresponding configuration parameters.
6. The method for distinguishing multiple USB camera devices on an Android system according to claim 1, characterized in that, The establishment of the three-dimensional mapping relationship includes: obtaining the USB Host interface level information by parsing the soft connection path of the video device node, and binding and storing it in combination with VID / PID and preset function tags.
7. A multi-USB camera device differentiation system on an Android system, characterized in that, include: Device traversal module: used to scan the video device system directory, generate a list of video device nodes and obtain the corresponding system paths; Type recognition module: By parsing the soft connection path, it distinguishes between external USB cameras and non-USB devices; Filtering module: Based on driver information, excludes built-in virtual devices associated with internal virtual drivers; Mapping Management Module: Extracts the VID and PID of the external USB camera as a unique hardware identifier, establishes a mapping relationship between it and the function label, and realizes intelligent device differentiation.
8. A multi-USB camera device differentiation system on an Android system according to claim 7, characterized in that, The type identification module includes: The symbolic link resolution unit executes system commands to obtain the complete path string of the video device node; USB Feature Matching Unit: Detects USB feature identifiers using a string matching algorithm and outputs a candidate list of external USB camera devices.
9. A multi-USB camera device differentiation system on an Android system according to claim 7, characterized in that, The filtering module includes: Driver reading unit: Accesses the driver information file corresponding to the video device node to obtain the device driver name; Built-in device filtering unit: When the driver name is an internal virtual driver, remove the device node from the candidate list to ensure that only external hardware cameras are retained.
10. A multi-USB camera device differentiation system on an Android system according to claim 7, characterized in that, Also includes: Hot-swap monitoring module: Registers device status change events of the USB subsystem and collects device insertion, removal and video device node ID change events in real time; Dynamic binding module: Based on the unique hardware identifiers of VID and PID, it bypasses the dynamically assigned video device node ID by the system when the device reconnects and directly matches the historical function tags to achieve seamless restoration of the device status.
Citation Information
Patent Citations
Dynamic virtual camera mapping method and system
CN106790612A
An industrial personal computer multi-channel USB camera application method and system
CN109842777A
Serial port equipment self-adaption management method and system based on Linux system and storage medium
CN113608790A
USB interface-to-serial port mapping method and device, concentrator, equipment and medium
CN115374028A
Camera upgrading method and device, equipment and storage medium
CN115756536A