fix(install): reload udev rules before re-probing drivers (#355)#368
Conversation
probeAndReprobeDrivers generates bind uevents that udevd evaluates against
its loaded ruleset. The re-probe ran inside installUdevRules, before the
later `udevadm control --reload-rules`, so a stale "block usbhid" rule from
a previous install was still loaded and re-unbound usbhid on the bind event
— leaving the device with no hidraw node ("no device") after an update.
Move the live driver-state mutation (re-probe + proactive unbind) out of
installUdevRules into applyDriverState, and call it only after reload-rules,
before starting the service. installUdevRules is now write-only.
Confirmed on a real Flydigi Vader 5: with the old order the pad ends with
hidraw=0; reloading before re-probe leaves hidraw intact.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR refactors the install phase's device driver and systemctl management by extracting driver state application into a standalone function and reordering the execution sequence. Udev reload/trigger now happens in the phase orchestrator, followed by the new ChangesInstall Phase Udev and Systemctl Reordering
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Confirmed install-migration race surfaced by adversarial review of #365 and reproduced on a real Flydigi Vader 5.
probeAndReprobeDriverswrites driverless interfaces to/sys/bus/usb/drivers_probe, which makes the kernel re-bind drivers and emitbinduevents. udevd evaluates those uevents against its currently loaded ruleset. The re-probe ran insideinstallUdevRules— before the laterudevadm control --reload-rules— so a staleblock usbhidrule from a previous (#357-style) install was still loaded and re-unbound usbhid on the bind event, leaving the device with no hidraw node ("no device") after an update until replug/reboot.Fix
installUdevRulesinto a newapplyDriverState;installUdevRulesis now write-only.applyDriverStateonly afterudevadm control --reload-rules, and before starting the service (splitrunSystemctlPhase→runSystemctlUnits; reload+trigger now run once inphase.zigfor both the enable and non-enable paths).Final order: write rule files → sweep stale files → reload udevd ruleset → mutate driver state → start service.
Test plan
block usbhidrule loaded in udevd + sentinel, then ran both orders. Old order (re-probe before reload) →hidraw=0(pad invisible). New order (reload before re-probe) →hidraw=6(pad discoverable). Cleanup restored stock state.zig build test(full suite) green in the canonical Docker image.zig build test-tsangreen in Docker.Summary by CodeRabbit