Repository navigation
Conversation
Port the Nikon Coolscan wire grammar from nkscan (LS-5000/LS-9000 protocol spec, byte-identical to the LS-50) into a new protocol/ls50 package so the LS-50 ED can be driven over raw USB without SANE: - protocol/ls50/capture.py: session + RGBI capture (RESERVE, MODE_SELECT, SET_BOUNDARY, SET_WINDOW x4, SCAN with RGBI mask, chunked image READ). The READ carries the data type code (DTC) in byte 2 and the data type qualifier (DTQ = color << 8 | element width) in bytes 4-5, transfer length in 6-8, control 0x80 -- per the Nikon spec -- and treats a short read or sense 05-2C (ILI, OutOfSequence) as the normal end of the image stream. This replaces per-line READs that desynchronized the LS-50. - protocol/ls50/artifacts.py: write raw linear 16-bit RGB + -ir.tif sidecar (marker scanstudio.infrared.linear.uint16.v1) + receipt with settingsFingerprint 4000:16:1:rgbi. - protocol/ls50/workflow.py: Ls50Roll -- preview (per-slot streaming, end of strip detection), set_spacing_offset (frame adjust), scan_many. - protocol/ls50/pass_runner.py: CLI for the calibration passes. - protocol/ls50/frame_edges.py: row-density seam detection. - tests/protocol/ls50/: hardware-free coverage of the geometry, read CDB grammar, and end-of-strip preview logic. The wire grammar is adapted from nkscan (activexray/nkscan, MIT/Apache-2.0), which documents the LS-5000/LS-9000 ED protocol and supports the LS-50. Live-verified against a physical LS-50 ED with a color-negative strip in an SA-30 adapter: preview completes with end-of-strip detection and full-res RGBI captures are correct raw negatives.
Standalone LS-50 review: implementation handoff
Reviewed head: This Markdown is intended to be pasted directly into an implementation LLM. Read the actual current files first, preserve the shared LS-5000 transport contract, and make small fixes with regression tests. Review covered every changed line and all seven added files. No physical scanner qualification was performed. Fix these in the standalone package
Source entry points: capture.py, workflow.py, pass_runner.py, artifacts.py. Minimum completion evidence
The companion reproduction script targets the reviewed ScanStudio head and imports APIs absent from this older standalone head; use it there as supplied, or adapt each probe deliberately to this head. In particular, do not claim its cancellation-clear race already exists in this older implementation. |
Ports the Nikon Coolscan wire grammar from nkscan (LS-5000/LS-9000 protocol spec, byte-identical to the LS-50) into a new
protocol/ls50package so the LS-50 ED can be driven over raw USB without SANE.What's included
protocol/ls50/capture.py: session + RGBI capture. The image READ carries DTC in byte 2 and DTQ (color<<8|element-width) in bytes 4-5 per the Nikon spec, reads in whole-granule chunks, and treats a short read / sense 05-2C (ILI, OutOfSequence) as the normal end of the image stream — fixing the per-line READ desync seen on the physical LS-50.protocol/ls50/artifacts.py: raw linear 16-bit RGB +-ir.tifsidecar + receipt (4000:16:1:rgbi).protocol/ls50/workflow.py: Ls50Roll — preview (per-slot streaming, end-of-strip detection), set_spacing_offset, scan_many.protocol/ls50/pass_runner.py: calibration-pass CLI.protocol/ls50/frame_edges.py: row-density seam detection.tests/protocol/ls50/: hardware-free tests.Attribution
Wire grammar adapted from activexray/nkscan (MIT/Apache-2.0 dual), which documents the LS-5000/LS-9000 ED protocol and lists the LS-50 (Coolscan V) as supported.
Verification
Live-tested against a physical LS-50 ED (color-negative strip, SA-30): RGBI frame captures at 400/4000 dpi are correct raw negatives; preview completes with end-of-strip detection.