r/SwiftUI • • 1h ago

GitHub - poise52/USBview-HS: Native USB inspector for macOS(Swift, haskell). Explore the USB device tree, inspect descriptors, and reconnect devices or hubs from the menu bar.

https://github.com/poise52/USBview-HS

Hey everyone,

I’ve been working on USBview HS, an open-source (MIT) native USB inspector for macOS (15+, Apple Silicon).

If you've ever needed to see what’s actually going on behind a tangle of USB-C docks and nested hubs—or wanted to software-reset a misbehaving USB device without crawling under your desk to unplug it—that’s what this tool is built for.

What it does

  • Full USB Topology Tree: Inspect controllers, nested hubs, and even empty ports. It automatically groups the USB 2 and USB 3 sides of the same physical connector when the macOS I/O Registry links them.

  • Software Reconnect (Reset): Reset a USB device or hub directly from the app or the menu bar via IOUSBHostDevice.reset(), and verify whether it reappears on the same port.

  • Deep Inspection:

    • Ports: Awake/sleep current limits, per-link error counters, and USB-C transport info.

    • Devices: VID:PID, serial numbers, negotiated speeds, drivers, interfaces, and on-demand Configuration Descriptors (alternate settings & endpoints).

    • Adapters & Drives: BSD interface names, MAC, MTU, and link state for USB Ethernet adapters; media/partition info and write capability for drives.

  • Menu Bar & Mini Window: Quick access to connected devices right from the menu bar, plus an optional always-on-top floating mini window.

  • Search & Event Log: Filter by name, manufacturer, or VID:PID, with configurable auto-refresh and a log tracking the last 200 attach/detach events.

  • Headless CLI Mode: Query the exact same USB topology from the terminal—dump the tree, export to JSON, watch live attach/detach events, or filter by --network, --storage, and --details.

Under the hood

Architecturally, it’s a bit of an unusual mix: a Haskell backend engine (engine/) reads directly from the macOS I/O Registry via IOKit and constructs the USB topology, while a Swift 6 / SwiftUI frontend (app/) handles the native UI, reads configuration descriptors through IOUSBLib, and triggers device resets.

Installation & Quick Notes

  • Pre-built Apple Silicon .zip binaries are available on GitHub Releases (built via GitHub Actions), or you can build from source with make run.

  • Gatekeeper note: Releases are ad-hoc signed and not notarized by Apple, so if macOS blocks the first launch, you can clear the quarantine flag with xattr -dr com.apple.quarantine "/Applications/USBviewHS.app".

  • Language note: The UI currently defaults to Russian on first launch—you can switch to English right away via Настройки (Settings) → Язык интерфейса (the choice persists across launches)

1 Upvotes

0 comments sorted by