From 2bcb355d64e72dcc5e384a2d6a982016fb7844fa Mon Sep 17 00:00:00 2001 From: Justin Mitchell Date: Sun, 2 Aug 2026 23:22:25 -0400 Subject: [PATCH] Add debug method for device detection diagnostics Implements debug_managed_device_detection() to provide verbose output about CrossPoint Reader network detection, including connection status, discovery attempts, and error reporting. Bypasses discovery throttle to force fresh scans during debugging. --- crosspoint_reader/driver.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/crosspoint_reader/driver.py b/crosspoint_reader/driver.py index a48915c..0616213 100644 --- a/crosspoint_reader/driver.py +++ b/crosspoint_reader/driver.py @@ -93,6 +93,26 @@ class CrossPointDevice(DeviceConfig, DevicePlugin): self._log('[CrossPoint] discovery failed') return None + def debug_managed_device_detection(self, devices_on_system, output): + from functools import partial + p = partial(print, file=output) + if self.is_connected: + p(f'A CrossPoint Reader is already connected at {self.device_host}:{self.device_port}') + return True + p('Looking for a CrossPoint Reader on the network...') + try: + # Bypass the discovery throttle so a fresh scan happens. + self.last_discovery = 0.0 + dev = self.detect_managed_devices(devices_on_system, force_refresh=True) + except Exception as exc: + p(f'Error while probing for a CrossPoint Reader: {exc}') + return False + if dev is not None: + p(f'Found a CrossPoint Reader at {self.device_host}:{self.device_port}') + return True + p('No CrossPoint Reader detected on the network') + return False + def _detect_device_model(self): """Query /api/status for the device model (X3/X4), like the web UI.""" try: