bug(stage3): instlist device index is passed as chartread -c comm port #111

Closed
opened 2026-08-26 15:04:30 +01:00 by gronod · 1 comment
Owner
Field Value
Labels Kind/Bug, Priority/High
Priority High
Milestone v0.3.3 hotfix
Related #86
Branch fix/chartread-comm-port (from development)
Pair with

Description

#86 added instrument autodetection via instlist and a dropdown. The selected option’s value is the instlist ordinal (1, 2, …). build_chartread_args then emits -c {index}.

In ArgyllCMS these are different lists. They often coincide when a single USB i1Pro is port 1. With two instruments, or USB plus serial, -c 2 can select the wrong port or a non-spectro device.

Current behaviour

Tool List Flag
instlist Detected instruments (name + USB/serial) n/a
chartread -?? Communication ports (COM / tty / USB HID endpoints) -c N

Frontend (src/js/chartread.js):

opt.value = inst.index;

Backend (src-tauri/src/commands.rs):

chartread -v -u -c {index} {basename}

The instlist regex is also too loose and will match unrelated numbered log lines:

/^(\d+)[\s:=]+'?([^'\n]+)'?(?:\s+on\s+'?([^'\n]+)'?)?/i

Proposed solution

Pick one of the following, in order of preference.

Option A (recommended)

Do not pass -c from instlist. Use instlist only as a presence/health display (Found i1Pro on USB). Let Argyll default to the first usable port (-c omitted). Document that in the UI.

Option B

Parse chartread -?? (the communication-port dump Argyll prints) and populate the dropdown from that list. Values must be the Argyll comm-port numbers. Show the instrument name as the label if USB strings can be correlated.

Option C

If instlist output includes a usable port specifier, pass that string only when it is a documented -c argument. Do not assume ordinal equality.

Also tighten the instlist regex. Require a known instrument token (i1, ColorMunki, Spyder, spectro, Display, Huey, DTP, SpectroScan) or the on '…' port clause.

UI copy must not say “instrument index”. It should say “communication port” or “auto”.

Files

  • src/js/chartread.js — dropdown values, regex, copy
  • src-tauri/src/commands.rsbuild_chartread_args and tests
  • src/index.html — Stage 3 help text

Acceptance criteria

  • With one USB instrument, Start Measurement still calibrates (no regression versus omitting -c).
  • Dropdown values are either empty (auto) or real Argyll comm-port ids, never an instlist row number unless proven equal.
  • Unit test: port: None["-v", "-u", basename].
  • Unit test: port: Some("1") only when that 1 is a comm port.
  • Fake or noisy instlist stdout containing 1: something that is not an instrument is not added to the dropdown.
  • UI copy says “communication port” or “auto”, not “instrument index”.

Dependencies

None.

| Field | Value | |---|---| | Labels | `Kind/Bug`, `Priority/High` | | Priority | High | | Milestone | v0.3.3 hotfix | | Related | #86 | | Branch | `fix/chartread-comm-port` (from `development`) | | Pair with | — | ## Description #86 added instrument autodetection via `instlist` and a dropdown. The selected option’s value is the instlist ordinal (`1`, `2`, …). `build_chartread_args` then emits `-c {index}`. In ArgyllCMS these are **different lists**. They often coincide when a single USB i1Pro is port `1`. With two instruments, or USB plus serial, `-c 2` can select the wrong port or a non-spectro device. ## Current behaviour | Tool | List | Flag | |---|---|---| | `instlist` | Detected instruments (name + USB/serial) | n/a | | `chartread -??` | Communication ports (COM / tty / USB HID endpoints) | `-c N` | Frontend (`src/js/chartread.js`): ```javascript opt.value = inst.index; ``` Backend (`src-tauri/src/commands.rs`): ```text chartread -v -u -c {index} {basename} ``` The instlist regex is also too loose and will match unrelated numbered log lines: ```javascript /^(\d+)[\s:=]+'?([^'\n]+)'?(?:\s+on\s+'?([^'\n]+)'?)?/i ``` ## Proposed solution Pick one of the following, in order of preference. ### Option A (recommended) Do not pass `-c` from instlist. Use instlist only as a presence/health display (`Found i1Pro on USB`). Let Argyll default to the first usable port (`-c` omitted). Document that in the UI. ### Option B Parse `chartread -??` (the communication-port dump Argyll prints) and populate the dropdown from **that** list. Values must be the Argyll comm-port numbers. Show the instrument name as the label if USB strings can be correlated. ### Option C If `instlist` output includes a usable port specifier, pass that string only when it is a documented `-c` argument. Do not assume ordinal equality. Also tighten the instlist regex. Require a known instrument token (`i1`, `ColorMunki`, `Spyder`, `spectro`, `Display`, `Huey`, `DTP`, `SpectroScan`) or the `on '…'` port clause. UI copy must not say “instrument index”. It should say “communication port” or “auto”. ## Files - `src/js/chartread.js` — dropdown values, regex, copy - `src-tauri/src/commands.rs` — `build_chartread_args` and tests - `src/index.html` — Stage 3 help text ## Acceptance criteria - [ ] With one USB instrument, Start Measurement still calibrates (no regression versus omitting `-c`). - [ ] Dropdown values are either empty (auto) or real Argyll comm-port ids, never an instlist row number unless proven equal. - [ ] Unit test: `port: None` → `["-v", "-u", basename]`. - [ ] Unit test: `port: Some("1")` only when that `1` is a comm port. - [ ] Fake or noisy `instlist` stdout containing `1: something` that is not an instrument is not added to the dropdown. - [ ] UI copy says “communication port” or “auto”, not “instrument index”. ## Dependencies None.
gronod added the Kind/Bug
Priority
High
2
Reviewed
Confirmed
1
labels 2026-08-26 15:05:53 +01:00
gronod added this to the v0.3.3 Hot fixes milestone 2026-08-26 15:06:00 +01:00
gronod started working 2026-08-26 15:06:10 +01:00
gronod changed title from # bug(stage3): instlist device index is passed as chartread -c comm port | Field | Value | |---|---| | Labels | `Kind/Bug`, `Priority/High` | | Priority | High | | Milestone | v0.3.3 hotfix | | Related | #86 | | Branch | `fix/chartread-comm-port` (from ` to # bug(stage3): instlist device index is passed as chartread -c comm port 2026-08-26 15:07:38 +01:00
gronod changed title from # bug(stage3): instlist device index is passed as chartread -c comm port to bug(stage3): instlist device index is passed as chartread -c comm port 2026-08-27 15:30:18 +01:00
gronod worked for 50 hours 50 minutes 2026-08-28 17:56:33 +01:00
gronod started working 2026-08-28 17:56:42 +01:00
gronod canceled time tracking 2026-08-28 17:56:43 +01:00
Author
Owner

Resolved via PR #120. chartread now defaults to auto-detected first available device and does not pass the instlist ordinal index as -c. Regex detection was tightened to known instrument tokens and UI labels updated.

Resolved via PR #120. `chartread` now defaults to auto-detected first available device and does not pass the `instlist` ordinal index as `-c`. Regex detection was tightened to known instrument tokens and UI labels updated.
Sign in to join this conversation.