Skip to content

fix(vader5): block only xpad so the pad stays discoverable (#355)#362

Merged
BANANASJIM merged 1 commit into
mainfrom
fix/355-unblock-usbhid
Jun 4, 2026
Merged

fix(vader5): block only xpad so the pad stays discoverable (#355)#362
BANANASJIM merged 1 commit into
mainfrom
fix/355-unblock-usbhid

Conversation

@BANANASJIM

@BANANASJIM BANANASJIM commented Jun 4, 2026

Copy link
Copy Markdown
Owner

What

Revert the block_kernel_drivers expansion from #357: block only xpad, not hid_generic/usbhid. IF1 (vendor) and IF2/IF3 (suppress) are still claimed via libusb.

Why

#357 added hid_generic/usbhid to block_kernel_drivers so the physical pad's hidraw nodes would vanish. But padctl already calls libusb_detach_kernel_driver before libusb_claim_interface (src/io/usbraw.zig), so it self-detaches the kernel HID driver at claim time — the udev block was redundant.

It was also harmful: device discovery is hidraw-only (HidrawDevice.discoverAllWithRoot). Blocking usbhid/hid_generic at udev means the kernel never creates a hidraw node, so discovery finds nothing and the daemon reports "no devices connected" (#355, reported by two users on Bazzite).

With block = ["xpad"]: usbhid binds -> hidraw node exists -> discovery finds the pad -> the libusb claim detaches usbhid and removes the nodes -> Steam sees only the virtual Elite pad. No reintroduction of the double-input that a full hidraw rollback would cause.

Changes

  • devices/flydigi/vader5.toml: block_kernel_drivers ["xpad","hid_generic","usbhid"] -> ["xpad"]; updated the interface comment. No code change (block_kernel_drivers is install-time-only input to udev generation).

Test plan

  • zig build test green in the canonical Docker image.
  • Real hardware (Flydigi Vader 5 Pro, USB 37d7:2401), daemon run as root:
    • Before: hidraw15/16/17 + evdev "Flydigi Vader 5 Pro" visible.
    • After: all three hidraw nodes gone, virtual "Xbox Elite Series 2" present, physical evdev hidden, padctl status -> device=Flydigi Vader 5 Pro state=active.
    • SIGTERM: usbhid re-attaches, pad restored.
  • fix(install): grant raw USB node access for libusb-claimed devices (#355) #361 raw-USB-node uaccess grant still applies (interfaces stay vendor/suppress, so usesLibusb() stays true).

Notes

  • Known cosmetic log noise: after claim, the netlink listener logs "hotplug: giving up on hidrawN after 3 retries" for the now-removed nodes. Harmless (device stays active); a follow-up can suppress these for libusb-claimed interfaces.

Refs #355, #357

Summary by CodeRabbit

  • Bug Fixes
    • Improved Flydigi Vader 5 Pro controller device initialization and detection. Enhanced configuration ensures more reliable recognition during startup and better overall system compatibility.

padctl self-detaches the kernel HID driver when it libusb-claims IF1/IF2/IF3,
so blocking hid_generic/usbhid at udev was redundant — and it removed the
hidraw node that padctl's discovery depends on, leaving the daemon with
"no devices connected" (regression from #357). Block only xpad: usbhid stays
bound so the hidraw node exists for discovery, and the libusb claim still
detaches it at runtime and hides the pad from Steam.
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Fix Vader 5 device discovery by unblocking hid_generic/usbhid

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Revert excessive kernel driver blocking that broke device discovery
• Block only xpad driver, allow hid_generic/usbhid to bind normally
• Hidraw node now exists for discovery before libusb claims interfaces
• Updated interface documentation to reflect actual behavior
Diagram
flowchart LR
  A["Kernel drivers bind<br/>hid_generic/usbhid"] -->|"hidraw node created"| B["Discovery finds device"]
  B -->|"padctl claims IF1/IF2/IF3"| C["libusb detaches kernel driver"]
  C -->|"hidraw nodes removed"| D["Steam sees virtual Elite pad"]
  E["xpad blocked at udev"] -.->|"prevents double-input"| D

Loading

Grey Divider

File Changes

1. devices/flydigi/vader5.toml 🐞 Bug fix +8/-9

Unblock hid_generic/usbhid for device discovery

• Changed block_kernel_drivers from ["xpad", "hid_generic", "usbhid"] to ["xpad"] only
• Updated interface comment to clarify that libusb_claim detaches kernel HID driver at runtime
• Explained why hid_generic/usbhid must remain unblocked for discovery to work
• Documented that hidraw nodes are removed by libusb claim, not by udev blocking

devices/flydigi/vader5.toml


Grey Divider

Qodo Logo

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fe702c68-7ffc-4a22-90d1-e2daaeecc291

📥 Commits

Reviewing files that changed from the base of the PR and between dc28146 and 828c8dd.

📒 Files selected for processing (1)
  • devices/flydigi/vader5.toml

📝 Walkthrough

Walkthrough

The Flydigi Vader 5 Pro device configuration is updated to block only the xpad kernel driver instead of blocking xpad alongside hid_generic/usbhid. Documentation is adjusted to clarify that the latter drivers must remain bound to provide a hidraw node for discovery before padctl claims the device.

Changes

Flydigi Vader 5 device configuration

Layer / File(s) Summary
Kernel driver blocking configuration update
devices/flydigi/vader5.toml
The block_kernel_drivers configuration is simplified to block only xpad instead of xpad, hid_generic, and usbhid. Inline comments are updated to document the HID interface binding model: IF0 has no driver, while three HID interfaces require hid_generic/usbhid to remain bound for hidraw node availability during device discovery.

Possibly related PRs

  • BANANASJIM/padctl#357: Modifies the same devices/flydigi/vader5.toml file with a conflicting approach to kernel driver blocking, using suppress interface claiming instead of the revised single-driver blocking.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hops through configs with careful thought,
Blocking drivers—one, not three—sought,
Hydraw nodes shine bright and clear,
Device discovery, sans fear!
Configuration clean, the work done right. 🎮

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(vader5): block only xpad so the pad stays discoverable' accurately describes the main change: blocking only xpad (instead of xpad+hid_generic+usbhid) to maintain hidraw node discoverability.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/355-unblock-usbhid

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

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

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider

Sorry, something went wrong

We weren't able to complete the code review on our side. Please try again

Grey Divider

Qodo Logo

@BANANASJIM BANANASJIM merged commit b76edee into main Jun 4, 2026
38 checks passed
@BANANASJIM BANANASJIM deleted the fix/355-unblock-usbhid branch June 4, 2026 00:20
BANANASJIM added a commit that referenced this pull request Jun 4, 2026
Regression test asserting the shipped devices/flydigi/vader5.toml blocks only xpad and never hid_generic/usbhid. Inline-TOML install tests cannot catch a value regression in the real device file. Refs #355, #362.
BANANASJIM pushed a commit that referenced this pull request Jun 6, 2026
…355)

- Add generateReprobeRulesFromEntries -> 62-padctl-reprobe.rules: on add|bind
  of a supported VID:PID, reprobe the interface if it is still driverless
  (live `test -e /sys%p/driver` check; %p/%k substituted by udevd, matching the
  61 driver-block rule). Root-scoped via udevd; coldplug-replayed at boot.
- Wired into install after the 61 block rule; added to /lib and /etc cleanup.
- Complements the install-time probeAndReprobeDrivers (immediate case).

Defense-in-depth safety net only: on current main nothing leaves the interface
driverless at boot (the usbhid-in-block_kernel_drivers regression was fixed in
PR #362). Kept unmerged until a real-boot capture from an affected machine
confirms a genuinely driverless interface.
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