Desktop USB: faster card listing (no auto-tether, defer catalog publish, skip unchanged polls) #144

Open
opened 2026-11-03 12:19:53 +00:00 by spark · 1 comment
Owner

Context

Photographers with a full card (e.g. EOS R1, 1000+ files) wait a long time on "A ler o cartão…". The blank window on launch was worsened by opening the PTP session as soon as the app starts.

Problems considered

  • didAddItems during the initial Image Capture enumeration are not new shots; treating them as new would auto-ingest the whole card.
  • We cannot skip Apple’s USB enumeration once a session is open; we can avoid doing it until the photographer enables the cable, and avoid flooding the UI while it runs.
  • Changing the tether default is a behaviour change — persist the last choice.

Plan

  1. Default tether off; restore from prefs when the photographer last left it on.
  2. While catalogReady is false, index files but do not publish the full catalog on every didAddItems (one publish at complete).
  3. camera_status(sinceGen): omit files when the catalog generation is unchanged so the 1s poll does not re-serialize thousands of entries.

Out of scope

Disk cache of the card index; "new shots only" mode that skips Apple’s full catalog (unsafe without a complete seenAtConnect snapshot).

## Context Photographers with a full card (e.g. EOS R1, 1000+ files) wait a long time on "A ler o cartão…". The blank window on launch was worsened by opening the PTP session as soon as the app starts. ## Problems considered - `didAddItems` during the initial Image Capture enumeration are **not** new shots; treating them as new would auto-ingest the whole card. - We cannot skip Apple’s USB enumeration once a session is open; we can avoid doing it until the photographer enables the cable, and avoid flooding the UI while it runs. - Changing the tether default is a behaviour change — persist the last choice. ## Plan 1. Default tether **off**; restore from prefs when the photographer last left it on. 2. While `catalogReady` is false, index files but **do not** publish the full catalog on every `didAddItems` (one publish at complete). 3. `camera_status(sinceGen)`: omit `files` when the catalog generation is unchanged so the 1s poll does not re-serialize thousands of entries. ## Out of scope Disk cache of the card index; "new shots only" mode that skips Apple’s full catalog (unsafe without a complete `seenAtConnect` snapshot).
Author
Owner

Done on task/BIT-144-usb-catalog-perf

Problems considered (not done)

  • Treating Image Capture’s initial didAddItems as “new” would auto-ingest the whole card — kept the complete-catalog snapshot for isNew.
  • Cannot skip Apple’s USB enumeration once a PTP session is open; only avoid opening it until asked, and avoid flooding the UI while it runs.
  • Full disk cache of the card index left out of scope (invalidation is messy).

Changes

  1. Tether off by default (Rust + ObjC). UI restores pr.usb.tether when the photographer last left the cable on.
  2. No catalog publish per item during the first pass — index only until deviceDidBecomeReadyWithCompleteContentCatalog, then one publish; after that, new shots still publish.
  3. camera_status(sinceGen) + catalogGen — unchanged generation returns empty files so the 1s poll does not re-serialize thousands of rows; the web UI keeps the last list.

Tests

  • cargo test --manifest-path apps/desktop/src-tauri/Cargo.toml --lib camera:: — 3 ok
  • vitest run src/library/UsbCamera.test.tsx — 6 ok

Needs a desktop shell rebuild/release (native + web). Web-only deploy is not enough for the ObjC/Rust parts.

## Done on `task/BIT-144-usb-catalog-perf` ### Problems considered (not done) - Treating Image Capture’s initial `didAddItems` as “new” would auto-ingest the whole card — kept the complete-catalog snapshot for `isNew`. - Cannot skip Apple’s USB enumeration once a PTP session is open; only avoid opening it until asked, and avoid flooding the UI while it runs. - Full disk cache of the card index left out of scope (invalidation is messy). ### Changes 1. **Tether off by default** (Rust + ObjC). UI restores `pr.usb.tether` when the photographer last left the cable on. 2. **No catalog publish per item during the first pass** — index only until `deviceDidBecomeReadyWithCompleteContentCatalog`, then one publish; after that, new shots still publish. 3. **`camera_status(sinceGen)` + `catalogGen`** — unchanged generation returns empty `files` so the 1s poll does not re-serialize thousands of rows; the web UI keeps the last list. ### Tests - `cargo test --manifest-path apps/desktop/src-tauri/Cargo.toml --lib camera::` — 3 ok - `vitest run src/library/UsbCamera.test.tsx` — 6 ok Needs a **desktop shell rebuild/release** (native + web). Web-only deploy is not enough for the ObjC/Rust parts.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: BitReport.pt/photoreport#144