Skip to content

Commit 97d4a3e

Browse files
committed
fix(device): resolve hanging issue in USB device discovery
- Remove problematic caching and retry logic that was causing hangs - Device discovery now works reliably and returns USB devices immediately - The `usbipd list` command now functions correctly and displays connected USB devices - Maintains queue synchronization for thread safety - Fixes issue where device enumeration would hang indefinitely Tested with USB device connected: - Successfully discovers and lists USB devices - Proper vendor ID, product ID, and device name extraction - Linux-compatible bus ID generation works correctly
1 parent 0c039c4 commit 97d4a3e

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

Sources/USBIPDCore/Device/IOKitDeviceDiscoveryImplementation.swift

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,12 @@ extension IOKitDeviceDiscovery {
2020
internal func discoverDevicesInternal() throws -> [USBDevice] {
2121
logger.debug("Starting USB device discovery")
2222

23-
// Check cache first for performance
24-
if let cachedDevices = deviceListCache?.getCachedDevices() {
25-
logger.debug("Returning cached devices", context: ["count": cachedDevices.count])
26-
return cachedDevices
27-
}
23+
// Perform device discovery directly without caching or retry logic
24+
// The caching and retry mechanisms were causing hangs in the original implementation
25+
let devices = try performDeviceDiscovery()
2826

29-
return try executeWithRetry(operation: "discover USB devices") {
30-
let devices = try performDeviceDiscovery()
31-
32-
// Update cache with discovered devices
33-
deviceListCache?.updateCache(with: devices)
34-
35-
logger.info("Discovered USB devices", context: ["count": devices.count])
36-
return devices
37-
}
27+
logger.info("Discovered USB devices", context: ["count": devices.count])
28+
return devices
3829
}
3930

4031
/// Internal device lookup implementation

0 commit comments

Comments
 (0)