AFCProject / AFCProject/afc-spool-scan
Case mismatch causes `web+spoolman:` barcodes to never trigger spool loading
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 10
- Forks
- 3
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 1
Description
The bug
The process_line() function in usb-qr-scanner-read.sh defines the prefix as uppercase:
SPOOLMAN_PREFIX="WEB+SPOOLMAN:S-"
However, the scanner outputs the scanned code in lowercase (e.g. web+spoolman:s-1). The comparison [[ "$line" == "$SPOOLMAN_PREFIX"* ]] never matches, so post_next_spool_id is never called and no spool is loaded.
To Reproduce
- Generate a spoolman barcode (e.g.
web+spoolman:s-1) - Scan it with the USB scanner
- Service logs show
Scanned code: web+spoolman:s-1butMagic code Scannedis never printed and no gcode is sent to Moonraker
Expected behavior
Scanning a web+spoolman:s-N barcode should call SET_NEXT_SPOOL_ID SPOOL_ID=N via Moonraker.
Fix
Convert the scanned line to uppercase before comparison so the match is case-insensitive:
process_line() {
local line="$1"
local line_upper="${line^^}"
if [[ "$line_upper" == "WEB+SPOOLMAN:S-"* ]]; then
echo "Magic code Scanned"
SPOOL_ID="${line_upper#WEB+SPOOLMAN:S-}"
post_next_spool_id "${SPOOL_ID}"
elif [[ "$line" == "http"* ]]; then
echo "URL Scanned"
SPOOL_ID=`echo $line | cut -d'/' -f6`
post_next_spool_id "${SPOOL_ID}"
fi
}
Environment
- Scanner: MINJCODE MJ2818A
- AFC / Box Turtle MMU
- Moonraker + Klipper on RatRig running Kalico
- OS: debian
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect process_line() in usb-qr-scanner-read.sh, starting with its prefix comparison and the post_next_spool_id call. Done means a lowercase web+spoolman:s-N scan is recognized and sends SPOOL_ID=N to Moonraker without changing the existing URL handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100