#34 - Rollscan installs on Windows from one .exe, gphoto2 included, and sets the camera up itself #40

Merged
eliott merged 8 commits from feat/34-windows-app into main 2026-11-20 22:11:50 +01:00
Owner

Rollscan becomes a real Windows app: one Rollscan_0.7.0_x64-setup.exe, opened like any installer, without administrator rights. gphoto2 comes inside it, so there is nothing else to install: no WSL2, no Ubuntu, no usbipd, no passing USB devices through by hand. The first time a camera is plugged in, the app says it needs setting up and a Set up the camera button switches it to the WinUSB driver gphoto2 needs (one administrator prompt).

Closes #34

How it works

  • gphoto2 on Windows comes from MSYS2's UCRT64 packages: gphoto2.exe, every DLL it and its drivers load (found with ntldd), its camera drivers (camlibs) and port drivers (iolibs). They are installed in tools\ next to the app; process::command puts that folder first on the PATH and sets CAMLIBS/IOLIBS, and starts every command with CREATE_NO_WINDOW.
  • The camera's driver: Windows binds cameras to its own driver, and libgphoto2 (through libusb) can only open one on WinUSB. On Windows, each Refresh lists the plugged-in picture devices (USB class 06) of camera makers that aren't on WinUSB yet (Get-PnpDevice). Such a camera isn't opened. The page offers Set up the camera, which runs wdi-simple (the command-line half of libwdi, the library behind Zadig) with administrator rights, then refreshes. libwdi only publishes Zadig, so packaging/windows/build.ps1 builds wdi-simple from the v1.5.1 tag (commit checked), with the WDK 8.0 WinUSB co-installers (SHA-256 checked).
  • Building the installer: packaging/windows/build.ps1 (MSYS2 + VS 2022 Build Tools + Rust on a Windows PC) collects gphoto2, builds wdi-simple, then cargo tauri build --config packaging/windows/tauri.conf.json (NSIS, per-user install, WebView2 bootstrapper embedded). That config is only used by the script, so cargo build/cargo test on Windows don't need the tools.
  • No workflow: the installer is built by hand with that script on a Windows PC, then attached to the release, which the download page then offers.
  • Windows places: settings, calibration and log in %APPDATA%\rollscan. Scans go to the Pictures folder's Film scans (wherever OneDrive moved it). The folder picker shows plain C:\ paths, hides hidden folders and lists the other drives from a drive's top. Explorer shows the scans. Roll and file names with characters Windows refuses are refused before a scan starts.
  • The release build is a window app (no console behind it), and rollscan scan ... typed in a terminal still writes to it. Without --port, the command line now takes the first port that looks like an Arduino (a COM port on Windows).
  • The WSL2 route is removed: the three scripts, the WSL code (wslpath, the Windows Pictures folder seen from Linux) and the udev rules that were only there for cameras passed through to WSL2.

Tested

  • On the real scanner, Windows 11, X-T5, Arduino Uno, 35mm negatives: the installer built with packaging/windows/build.ps1 installed it; Set up the camera switched the camera to WinUSB; calibration, live view, Check framing, scans and negative conversion worked as on Linux.
  • cargo test on Linux: 302 passed. The new tests cover reading Windows' device list, wdi-simple's arguments and PowerShell quoting, the session's set-up flow (refused, then done and connected), the Arduino port found without --port, and the folder listing.
  • cargo check and cargo clippy --all-targets for x86_64-pc-windows-msvc (cross-compiled from Linux): no new warnings.
  • pnpm lint, pnpm check and pnpm build in site/.

Not tested

  • Windows 10.
  • Other cameras on Windows, and an Arduino clone with a CH340 chip.
  • cargo test on Windows.
  • Giving the camera back to Windows from the Device Manager, as the docs describe.

Changes in behaviour

  • Windows: the WSL2 installer scripts are gone. The .exe replaces them (it never ran, so nobody should be using it).
  • Command line: --port no longer defaults to /dev/ttyACM0. Without it, the first port that looks like an Arduino is used.
  • Linux: 60-rollscan.rules no longer opens cameras to every user (that was only for WSL2; gphoto2's own rules already do it on a Linux desktop).
  • Roll names can no longer contain \ on any system.
Rollscan becomes a real Windows app: one `Rollscan_0.7.0_x64-setup.exe`, opened like any installer, without administrator rights. gphoto2 comes inside it, so there is nothing else to install: no WSL2, no Ubuntu, no usbipd, no passing USB devices through by hand. The first time a camera is plugged in, the app says it needs setting up and a **Set up the camera** button switches it to the WinUSB driver gphoto2 needs (one administrator prompt). Closes #34 ## How it works - **gphoto2 on Windows** comes from MSYS2's UCRT64 packages: `gphoto2.exe`, every DLL it and its drivers load (found with `ntldd`), its camera drivers (`camlibs`) and port drivers (`iolibs`). They are installed in `tools\` next to the app; `process::command` puts that folder first on the `PATH` and sets `CAMLIBS`/`IOLIBS`, and starts every command with `CREATE_NO_WINDOW`. - **The camera's driver**: Windows binds cameras to its own driver, and libgphoto2 (through libusb) can only open one on WinUSB. On Windows, each Refresh lists the plugged-in picture devices (USB class 06) of camera makers that aren't on WinUSB yet (`Get-PnpDevice`). Such a camera isn't opened. The page offers **Set up the camera**, which runs `wdi-simple` (the command-line half of libwdi, the library behind Zadig) with administrator rights, then refreshes. libwdi only publishes Zadig, so `packaging/windows/build.ps1` builds `wdi-simple` from the v1.5.1 tag (commit checked), with the WDK 8.0 WinUSB co-installers (SHA-256 checked). - **Building the installer**: `packaging/windows/build.ps1` (MSYS2 + VS 2022 Build Tools + Rust on a Windows PC) collects gphoto2, builds wdi-simple, then `cargo tauri build --config packaging/windows/tauri.conf.json` (NSIS, per-user install, WebView2 bootstrapper embedded). That config is only used by the script, so `cargo build`/`cargo test` on Windows don't need the tools. - **No workflow**: the installer is built by hand with that script on a Windows PC, then attached to the release, which the download page then offers. - **Windows places**: settings, calibration and log in `%APPDATA%\rollscan`. Scans go to the Pictures folder's `Film scans` (wherever OneDrive moved it). The folder picker shows plain `C:\` paths, hides hidden folders and lists the other drives from a drive's top. Explorer shows the scans. Roll and file names with characters Windows refuses are refused before a scan starts. - The release build is a window app (no console behind it), and `rollscan scan ...` typed in a terminal still writes to it. Without `--port`, the command line now takes the first port that looks like an Arduino (a `COM` port on Windows). - The WSL2 route is removed: the three scripts, the WSL code (`wslpath`, the Windows Pictures folder seen from Linux) and the udev rules that were only there for cameras passed through to WSL2. ## Tested - On the real scanner, Windows 11, X-T5, Arduino Uno, 35mm negatives: the installer built with `packaging/windows/build.ps1` installed it; **Set up the camera** switched the camera to WinUSB; calibration, live view, Check framing, scans and negative conversion worked as on Linux. - `cargo test` on Linux: 302 passed. The new tests cover reading Windows' device list, wdi-simple's arguments and PowerShell quoting, the session's set-up flow (refused, then done and connected), the Arduino port found without `--port`, and the folder listing. - `cargo check` and `cargo clippy --all-targets` for `x86_64-pc-windows-msvc` (cross-compiled from Linux): no new warnings. - `pnpm lint`, `pnpm check` and `pnpm build` in `site/`. ## Not tested - Windows 10. - Other cameras on Windows, and an Arduino clone with a CH340 chip. - `cargo test` on Windows. - Giving the camera back to Windows from the Device Manager, as the docs describe. ## Changes in behaviour - Windows: the WSL2 installer scripts are gone. The `.exe` replaces them (it never ran, so nobody should be using it). - Command line: `--port` no longer defaults to `/dev/ttyACM0`. Without it, the first port that looks like an Arduino is used. - Linux: `60-rollscan.rules` no longer opens cameras to every user (that was only for WSL2; gphoto2's own rules already do it on a Linux desktop). - Roll names can no longer contain `\` on any system.
- gphoto2 and wdi-simple are looked for in the tools folder next to the app, with
  CAMLIBS/IOLIBS set; commands start without a console window.
- Settings and log in %APPDATA%\rollscan, scans in the Pictures folder; roll and file
  names Windows can't save are refused.
- Folder picker: plain C:\ paths, hidden folders left out, other drives from a root,
  Explorer to show the scans.
- A camera still on Windows' driver is listed in place of being opened; Set up the
  camera switches it to WinUSB through wdi-simple, after Windows' administrator prompt.
- Without --port, the command line uses the first port that looks like an Arduino.
- The release build is a window app, and writes to the terminal it was typed in.
- The WSL2 code (wslpath, the Windows Pictures folder seen from Linux) is gone.
- packaging/windows/build.ps1 takes gphoto2, its DLLs and its drivers from MSYS2's
  UCRT64 packages, builds wdi-simple from libwdi 1.5.1 (commit and WDK hash checked),
  and makes the NSIS installer with packaging/windows/tauri.conf.json.
- .forgejo/workflows/windows.yml runs the tests and that script on a Windows runner
  (label windows): an artifact for pull requests, a file on a published release.
- install-windows.bat, install-windows.ps1, launch-windows.ps1 and the udev rules for
  cameras passed through to WSL2 are gone.
chore(release): 0.7.0
Some checks failed
website / build (pull_request) Successful in 43s
windows / build (pull_request) Has been cancelled
3d98a44cb5
chore(install): build the Windows installer by hand, without a workflow
All checks were successful
website / build (pull_request) Successful in 42s
1eef31823e
- The Windows runner workflow is removed: packaging/windows/build.ps1 is run on a Windows PC.
eliott merged commit e212170253 into main 2026-11-20 22:11:50 +01:00
eliott deleted branch feat/34-windows-app 2026-11-20 22:11:50 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
RollNote/rollscan!40
No description provided.