fix(openrfid): fix review issues from PR #306 (PIDFILE, stray echo, help_url, error handling)#321
fix(openrfid): fix review issues from PR #306 (PIDFILE, stray echo, help_url, error handling)#321kbaker827 wants to merge 3 commits intopaxx12:developfrom
Conversation
Introduce a Sims filament-detect overlay that installs a startup service and detector script. Add firmware-config settings wiring plus base, generic, and vendor profile configs for broader spool support. Update RFID/settings docs and index references to document the new behavior and configuration.
- Fix wrong PIDFILE name in S99openrfid: was /var/run/filament-detect.pid (a leftover from the old filament-detect service name), now correctly /var/run/openrfid.pid. - Remove stray echo at the end of the openrfid-generic activation cmd; the confirm dialog already shows the same message before the user commits to the change. - Fix broken help_url anchor in 13_settings_rfid_reader.yaml: the URL pointed to #alternative-detection-system (singular) but the docs heading is "## Alternative Detection Systems" which generates the anchor #alternative-detection-systems. - Add proper error handling to openrfid.py _snapmaker_key(): instead of crashing with an AttributeError if the HKDF key regex doesn't match (e.g. after a firmware update renames the constant), the script now prints a descriptive message to stderr and exits with code 1. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
✅ Build ArtifactsVersion:
|
Test plan resultsGoing through each item — static analysis for the items that don't need printer hardware, live Python execution for #5. ✅ Test 1 & 2 — PIDFILE path and stop cleanupAll references to The ✅ Test 3 — No stray
|
| Value | |
|---|---|
help_url in YAML |
…/rfid_support#alternative-detection-systems |
Heading in docs/rfid_support.md (line 123) |
## Alternative Detection Systems |
| Generated anchor | #alternative-detection-systems |
Exact match. ✅
✅ Test 5 — openrfid.py error handling
Ran all three paths of _snapmaker_key() locally:
5a — driver file missing:
exit code: 1
stderr: Error: cannot read Klipper RFID driver: [Errno 2] No such file or directory: '/nonexistent/path.py'
PASS ✅ (was previously AttributeError or FileNotFoundError with no context)
5b — file present but HKDF key constant not found:
exit code: 1
stderr: Error: Snapmaker HKDF key not found. The firmware driver may have changed.
PASS ✅ (was previously AttributeError: 'NoneType' object has no attribute 'group')
5c — key found, correct hex returned:
exit code: 0
stdout: 736e61706d616b65725f7365637265745f6b65795f68657265 ← correct hex encoding
PASS ✅
All 5 test plan items verified. 🟢
Summary
Bug fixes for the OpenRFID overlay introduced in #306, addressing issues found during review.
Wrong PIDFILE path in
S99openrfid— The init script used/var/run/filament-detect.pid, a leftover from the previous service name. This has been corrected to/var/run/openrfid.pid. As written, if any remnant PID file from the oldfilament-detectservice existed, the already-running guard would fire incorrectly and OpenRFID would silently refuse to start.Stray
echoin15_settings_openrfid.yaml— Theopenrfid-genericactivation command ended withecho Please read the relevant documentation.... This was redundant (theconfirmdialog already shows this message before the user proceeds) and was explicitly flagged for removal in the review thread.Broken
help_urlanchor —13_settings_rfid_reader.yamlpointed to#alternative-detection-system(singular) but the corresponding docs heading is## Alternative Detection Systems, which generates the anchor#alternative-detection-systems. The?button in the firmware-config UI would silently 404 on this anchor.No error handling in
openrfid.py—_snapmaker_key()would crash with an unhelpfulAttributeError: 'NoneType' object has no attribute 'group'if the Klipper RFID driver file was missing or had been updated to rename the HKDF key constant. It now prints a descriptive message to stderr and exits with code 1 in both failure cases.Test plan
filament-detectservice installed: enable OpenRFID and confirm the PID file is created at/var/run/openrfid.pidS99openrfid stopcleans up/var/run/openrfid.pidconfirmdialog message appears; no extra text in the action output?help icon on the Filament Detection setting: confirm it navigates to the correct docs anchorfm175xx_reader.pytemporarily and runopenrfid.py: confirm a clear error message is printed instead of anAttributeError🤖 Generated with Claude Code