Skip to content

Android app to inspect USB devices with full descriptor and HID details

License

Notifications You must be signed in to change notification settings

iodn/android-usb-device-info

Repository files navigation

USB Descriptor Explorer for Android

USB Descriptor Explorer icon

USBDevInfo

USB Descriptor Explorer for Android
USBDevInfo is an Android application for discovering, inspecting, and analyzing USB devices connected to your phone or tablet. It exposes the same low-level USB information that Android sees, but presents it in a clear, structured, and human-readable way.

The app is designed for developers, reverse-engineers, hardware hackers, and power users who need to understand exactly what a USB device reports: vendor IDs, configurations, interfaces, endpoints, HID descriptors, power requirements, and more.

USBDevInfo works fully offline, stores all data locally, and never transmits device information to any server.

Features

  • Live USB monitoring
    • Automatically reacts to USB attach/detach and can auto‑open a device's details view on attach
    • Permission request flow for devices that require user consent
    • Instant visibility into attached USB devices, hubs, and HID/gamepad/touch devices
  • Device list with search
    • Shows vendor/product names when known, plus VID:PID and basic class info
    • Text search across vendor, product, id string, and device path
  • Detailed device view
    • Full device and configuration/endpoint breakdown (classes, subclasses, protocols)
    • Human‑readable names for USB class/subclass/protocol when available
    • Copy any field, view raw JSON payload, and neatly wrapped hex where applicable
  • Device history
    • Maintains a chronological history of attach events; drill into past entries
    • Export/import history as JSON from the Settings screen
  • Theming and UX
    • Material 3 design, light/dark theme, optional Android dynamic color support
    • Polished section cards, key/value rows, and snack‑bar copy confirmations
  • Offline USB IDs database
    • Bundled SQLite database provides vendor/product/class lookups
    • Update controller coordinates DB refresh gating and metadata verification

Technical/architectural

  • Flutter + Riverpod 3
    • State: Notifier/AsyncNotifier providers for search, lists, settings, and details
    • Routing: go_router with named routes: Home, Device details, History (+ entry detail), Settings
  • Platform channel bridge (Android)
    • Kotlin glue (UsbBridge) exposes:
      • MethodChannel: listDevices, getDeviceDetails, requestPermission, setUsbAttachComponentEnabled
      • EventChannel: usb attach/detach/connect/disconnect events
    • MainActivity wires pending intents and forwards onNewIntent to the bridge
  • Repository + data layers
    • UsbPlatformService (Dart) wraps method/event channels
    • UsbRepository enriches platform data with lookups from UsbIdsDb
    • Providers compose platform, repository, and DB future
  • USB IDs database
    • assets/db/usbids.sqlite shipped with the app
    • UsbIdsDb exposes vendorName/productName/class/subclass/protocol lookups with small caches
    • Tools (Python) to regenerate DB from assets/db_src/usbids.sql
      • tools/update_usbids_artifacts.py builds the SQL from upstream data
      • tools/build_usbids_db.py compiles the SQL into SQLite, with WAL/SHM cleanup
  • UX components
    • Reusable SectionCard and KeyValueRow widgets for consistent layout
    • Formatters for hex/dec, labels, hex wrapping, and misc helpers
  • Preferences
    • SharedPreferences for theme mode, dynamic color toggle, and USB auto‑attach behavior

How it works (high‑level)

  1. On app start, Riverpod initializes:
    • USB event coordinator and USB IDs auto‑check coordinator
    • Preference controllers (theme mode, dynamic color, USB attach behavior)
  2. The Android bridge streams USB attach/detach events over an EventChannel.
  3. The usbEventCoordinator listens for events and:
    • Ensures the USB IDs DB is available
    • Refreshes the device list
    • On attach, records a history entry and optionally navigates to the device details screen
    • On detach, returns to Home if the auto‑opened device was unplugged
  4. Views bind to providers:
    • Home shows the enriched list (UsbRepository + UsbIdsDb)
    • Device detail fetches full descriptor data then enriches class/name fields
    • History pages display recorded entries; Settings offers export/import and preferences

Installation

  1. Download the APK:

Get it on Google Play

Get it on F-Droid

Or download the latest APK from the Releases Section.

  1. Install the Application:

    • Enable installation from unknown sources if needed.
    • Follow the on‑screen instructions.
  2. Launch and Configure:

    • Optionally enable dynamic color and choose light/dark/system theme
    • Decide whether the app should auto‑open on USB attach (Settings)
    • Plug in a USB device and grant permission when prompted

Build from source

  • Requirements
    • Flutter SDK (Dart 3.x), Android SDK/NDK as needed, a device/emulator running Android
  • Steps
    • flutter pub get
    • flutter build apk (or flutter run for development)

The app bundles assets/db/usbids.sqlite. If you need to refresh the USB IDs data:

  • Update assets/db_src/usbids.sql (or regenerate it via tools/update_usbids_artifacts.py)
  • Run: python3 tools/build_usbids_db.py

Permissions and compatibility

  • Uses Android's USB host APIs; user permission prompts appear for certain device interactions
  • Works offline for lookups once installed (DB is local)
  • Dynamic color support is enabled by default on Android

Project structure (high‑level)

  • lib/
    • core/: routing, theme, preferences, USB event coordination, widgets, utils
    • data/: platform bridge wrapper, repository, DB layer, providers
    • features/: home, device detail, history, settings (and subcontrollers)
  • android/: Kotlin bridge (UsbBridge), activity configuration, and intent plumbing
  • assets/: USB IDs SQLite DB and sources
  • tools/: scripts to rebuild and update the USB IDs database

Screenshots

1 2 3 4 5

Contributing

Contributions are welcome.

If you:

  • Find a bug
  • Have a feature request
  • Want to improve UI, parsing, or USB coverage

Open an issue or submit a pull request.

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).

Credits

  • USB vendor and product data sourced from the public usb.ids database

More Apps by KaijinLab!

App What it does
IR Blaster Control and test infrared functionality for compatible devices.
USBDevInfo Inspect USB device details and behavior to understand what's really connected.
GadgetFS Experiment with USB gadget functionality (hardware-adjacent, low-level).
TapDucky A security/testing tool for controlled keystroke injection workflows.
HIDWiggle A mouse jiggler built with USB gadget functionalities.
AKTune (Android Kernel Tweaker) Adaptive Android kernel auto-tuner for CPU/GPU/scheduler/memory/I-O. (Magisk Module).