Skip to content

Name DragonFly USB devices by driver instance when devinfo has none - #3830

Merged
dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:dragonfly-usb-names
Oct 18, 2026
Merged

dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:dragonfly-usb-names

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Fixes a regression from #3826 that has failed the DragonFly job of Unix CI on master since that PR merged.

DragonFly's hardware layer extends FreeBSD's, so it reads USB devices through FreeBsdUsbDevice, which #3826 moved to devinfo -v. FreeBSD's devinfo prints a <description> on every line, but DragonFly's prints none:

        uhci0 pnpinfo vendor=0x8086 device=0x7020 subvendor=0x1af4 subdevice=0x1100 class=0x0c0300 at slot=1 function=2 ...
          usbus0
            uhub0

So every DragonFly USB device got a blank name, which UsbDeviceTest.testUsbDevices() rejects ("USB name shouldn't be blank"). #3826's fixtures were all FreeBSD output, so the unit tests didn't catch it.

Change

When a line has no description, the device is named after its driver instance (uhci0, uhub0), which devinfo always prints. The javadoc now mentions DragonFly, and DragonFly 6.4.2's real devinfo -v output from CI is a new test fixture.

Verification

  • CI: Unix CI, dispatched on my fork for this branch, passes on all six VMs. On DragonFly, testUsbDevices() passes.
  • Locally: the full -Paggregate-coverage gate and the Error Prone build pass.

No CHANGELOG entry, since #3826 hasn't been released yet.

Separate, not fixed here

The first failing master run, for #3826, failed differently. The DragonFly VM stopped responding partway through the oshi-core tests, rather than failing a test. devinfo -v runs in 0.01 s there, so it isn't the cause. The two later runs failed only on the test above. I'll watch for the hang recurring.

Summary by CodeRabbit

  • Bug Fixes
    • Improved USB device detection on DragonFly systems when device descriptions are unavailable. Devices now appear under their driver instance names, while available descriptions remain readable and omit trailing class details. This helps ensure USB controllers and hubs are identified consistently in hardware information.

DragonFly's hardware layer extends FreeBSD's and so reads USB devices
with FreeBsdUsbDevice, which oshi#3826 moved to devinfo -v. FreeBSD's devinfo
prints a <description> on each line; DragonFly's prints none:

  uhci0 pnpinfo vendor=0x8086 device=0x7020 ... at slot=1 function=2
    usbus0
      uhub0

so every DragonFly USB device had a blank name, failing UsbDeviceTest
in the DragonFly job of Unix CI on master. Where there is no
description, name the device by its driver instance (uhci0, uhub0),
which devinfo always prints.

The fixture is DragonFly 6.4.2's devinfo -v from CI. Unix CI dispatched
on the fork for this branch passes on all six VMs, DragonFly included.
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bbbe003c-e35d-4c54-ba13-e6892aeee025
📥 Commits

Reviewing files that changed from the base of the PR and between 4c64e8f and 5c7aa24.

📒 Files selected for processing: 2
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDevice.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDeviceTest.java

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 12
  • GitHub Check: Test JDK 25, OpenBSD
  • GitHub Check: Test JDK 25, FreeBSD
  • GitHub Check: Test JDK 25, NetBSD
  • GitHub Check: Test JDK 25, OpenIndiana
  • GitHub Check: Error Prone
  • GitHub Check: Test JDK 25, ubuntu-latest
  • GitHub Check: Test JDK 25, windows-latest
  • GitHub Check: Test JDK 25, macos-latest
  • GitHub Check: Test JDK 21, ubuntu-latest
  • GitHub Check: Lint (ForbiddenAPIs, Javadoc, SLF4J)
  • GitHub Check: Lint (Spotless, Checkstyle)
  • GitHub Check: Analyze (java)
🧰 Additional context used
📚 Code guidelines: 1
AGENTS.md — auto-discovered
📓 Path-based instructions: 1
Source excerpt: **Banned APIs** (`config/forbidden-apis.txt` and friends, enforced by `forbiddenapis:check`): `oshi-common` may not reference `com.sun.jna.**`, `java.lang.foreign.**`, or any `System.load`/`loadLibrary`.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDeviceTest.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDevice.java
🔇 Additional comments: 2
oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDevice.java: 1

74-75: LGTM!

Also applies to: 129-131

oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDeviceTest.java: 1

108-124: LGTM!

📝 Walkthrough

The USB device parser now uses the driver instance name when a device description is empty. A test checks parsing of DragonFly USB controller and root hub entries.

Changes: USB device parsing

Layer / File(s) Summary
Empty-description fallback
oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDevice.java, oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDeviceTest.java
When a description is empty, parseUsbDevices uses the driver instance name. The test checks the controller name and vendor ID, and the root hub name.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 5c7aa

DragonFly USB entries without descriptions now receive driver-instance names, avoiding blank device names. The inspected changes leave no concrete merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: naming DragonFly USB devices by driver instance when devinfo provides no description.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit reads the USB list,
Where names were missing in the mist.
Driver names now fill the space,
And root hubs show their proper place.
One test checks the parser’s trace,
Then hops away at rabbit pace.

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.05%. Comparing base (d47f214) to head (5c7aa24).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3830      +/-   ##
============================================
- Coverage     81.08%   81.05%   -0.04%     
- Complexity      650      658       +8     
============================================
  Files           726      726              
  Lines         26279    26280       +1     
  Branches       4465     4466       +1     
============================================
- Hits          21309    21301       -8     
- Misses         2763     2770       +7     
- Partials       2207     2209       +2     
Flag Coverage Δ
freebsd 37.78% <100.00%> (-0.01%) ⬇️
linux 41.74% <100.00%> (+<0.01%) ⬆️
macos 42.67% <100.00%> (-0.03%) ⬇️
netbsd 37.08% <100.00%> (+<0.01%) ⬆️
openbsd 37.65% <100.00%> (-0.01%) ⬇️
solaris 38.92% <100.00%> (+0.01%) ⬆️
windows 49.05% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbwiddis
dbwiddis merged commit 37e0090 into oshi:master Oct 18, 2026
20 checks passed
@dbwiddis
dbwiddis deleted the dragonfly-usb-names branch October 18, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant