Skip to content

Latest commit

 

History

History
161 lines (135 loc) · 7.86 KB

CLI.md

File metadata and controls

161 lines (135 loc) · 7.86 KB

cc2camera command reference

Install using the setup guide. Start with the workflows in the main guide; these options are for reference. Every command accepts --help. cc2camera --version reports the installed version. On Windows PowerShell, use .\cc2camera.exe for a downloaded executable in the current folder. Python installations also support python -m cc2camera.

Connected camera

cc2camera devices [--adb EXECUTABLE]
cc2camera device-info [--adb EXECUTABLE] [--serial SERIAL]
cc2camera identify-camera PRINTER [--timeout SECONDS]
cc2camera start-adb [--adb EXECUTABLE] [--serial SERIAL] [--timeout SECONDS]
cc2camera install-adb-startup --backup BACKUP.zip [--adb EXECUTABLE] [--serial SERIAL] [--yes]
cc2camera install-erase-fix --backup BACKUP.zip [--adb EXECUTABLE] [--serial SERIAL] [--yes]
cc2camera backup OUTPUT.zip [--adb EXECUTABLE] [--serial SERIAL]
    [--accept-bootloader-sha256 SHA256]
  • devices: best-effort, read-only USB/HID and ADB listing.
  • device-info: validate root ADB and the supported MTD partition layout. This is not a complete firmware-image inspection.
  • identify-camera: connect only to the printer's HTTP MJPEG stream on port 8080 and compare three consecutive JPEG encoder fingerprints with the known EF-S7-V1.0.30B and EF-S7-V1.0.30D signatures. Pass a printer hostname or IP address, for example cc2camera identify-camera 192.168.1.50. The command does not use USB, HID or ADB and does not modify the printer or camera. An unrecognized or changing signature is refused as unknown rather than guessed. The 30B signature has been observed on two independent known 30B cameras; the 30D signature has been observed on one known 30D camera. The stream cannot distinguish the early 16 MiB and affected 8 MiB 30B variants. Affected 8 MiB cameras have been observed with PCB manufacturing codes 0226, 0526 and 1526; a supplied early 16 MiB camera is marked 4025. These codes appear to use WWYY order, but are supporting evidence rather than a safe compatibility cutoff. The tool's firmware and flash-layout checks determine whether the fix applies. Default HTTP timeout: 5 seconds.
  • start-adb: temporarily start the existing daemon; no persistent startup file. Default timeout: 30 seconds.
  • install-adb-startup: install enabled/90-adb.sh and the shared /etc/conf.d/system.sh runner. Requires ENABLE-ADB or --yes.
  • install-erase-fix: install enabled/10-erase-fix.sh and the shared runner. Requires INSTALL-ERASE-FIX or --yes. It corrects the known kernel's master erase size in RAM before camera startup on subsequent boots. Both installers require online root ADB, a preserved same-camera backup, stable live reads and sufficient clean config space. They perform config file writes, not firmware flashing; neither remounts config during installation. Different contents at system.sh or the selected managed hook path are refused. Unrelated regular hooks in enabled/ remain and execute in filename order. Restart manually and follow startup hook verification; the erase hook has physical validation on one supported camera.
  • backup: require three consecutive identical full reads within five attempts, then publish a new ZIP atomically. Never overwrites a backup. If ADB is offline, explicitly start it and rerun backup; backup itself is read-only. A reviewed unknown bootloader can be accepted by its exact SHA-256 without bypassing any other check.

--adb defaults to adb; a path to the executable is also accepted. --serial is the USB ADB serial, not the identifier embedded in the firmware. It does not relax the restore requirement for exactly one connected camera.

Offline image work

cc2camera inspect-image INPUT [--confirm-read DUMP]... [--show-identifiers]
cc2camera build-image INPUT [--confirm-read DUMP]... [-o DIR | --output DIR]
    [--config-mode {serial-only,preserve-files}]
    [--wipe-unknown-config] [--allow-fewer-reads] [--show-identifiers]

INPUT is a raw 8 MiB dump or an unmodified cc2camera backup ZIP. Inspection validates without creating files; building creates a recovery bundle in a new <input-stem>-cc2-recovery/ directory unless --output is given. The complete bundle is published atomically; failed builds leave no partial bundle at the output path. Existing output directories are refused. Neither command accesses hardware.

For raw dumps, repeat --confirm-read for each independent matching read:

cc2camera build-image camera-1.bin --confirm-read camera-2.bin --confirm-read camera-3.bin

A valid ZIP supplies its own three-consecutive-read evidence. Every raw input requires three matching reads unless --allow-fewer-reads explicitly accepts the higher risk. This exception is recorded in the bundle and does not bypass firmware, identity, or mismatch checks.

Config mode Behavior
serial-only (default) Rebuild config with only the camera's original serial.cfg; missing defaults are created at next boot.
preserve-files Rebuild every supported live regular file once, preserving contents and metadata while dropping obsolete records.

--wipe-unknown-config permits discarding unfamiliar names only with serial-only. It never permits discarding the camera's identity. --show-identifiers reveals identifiers in analysis reports; default reports mask them. Raw dumps, ZIPs, serial.cfg, and recovery images always contain private unit data regardless of report masking.

The bundle contains:

cc2-camera-recovery.bin
cc2-camera-layout.txt
config-restored.bin
serial.cfg
MANIFEST.json
VALIDATION.txt
FLASHING.txt
SHA256SUMS.txt

Use the complete cc2-camera-recovery.bin for full-chip programming. FLASHING.txt also contains an advanced flashrom region-write template based on regions that actually changed. Always require full-chip verification.

USB restore

cc2camera restore IMAGE --backup BACKUP.zip [--dry-run]
    [--adb EXECUTABLE] [--serial SERIAL]
    [--bootloader-timeout SECONDS] [--reboot-timeout SECONDS]
    [--adb-timeout SECONDS]

--dry-run validates the candidate, preserved backup, allowed changes, known preparation kernel, and transfer representation entirely offline. It opens no transport and writes nothing. It cannot certify the live camera or predict successful physical writing.

A real restore repeats local validation, requires the user to type RESTORE-CC2, validates the live camera, applies the temporary SFC correction, and writes the full image. Keep power connected until post-write verification completes. If needed after reboot, temporary ADB startup requires separate consent. There is no noninteractive write bypass or post-verification opt-out.

Timeouts default to 30 seconds for bootloader USB, 180 for normal USB return, and 60 for post-write ADB availability. The last timeout does not cap the flash reads themselves.

Verification requires three consecutive identical reads and exact agreement through the end of HWCONFIG. Config may change during the required boot; the output states explicitly whether config also matched byte-for-byte.

External programmer verification

Require full-chip verification against the generated 8 MiB image in the programmer software. If saving an independent readback, compare it with fc.exe /b expected.bin readback.bin on Windows or cmp expected.bin readback.bin on Linux/macOS. Any mismatch is a failure. The tool does not operate an external programmer.

Exit status

0 means the requested operation succeeded. 2 means a CLI, validation, or operating-system error. An unknown identify-camera signature is a validation failure and exits with 2 rather than guessing a camera revision. A successful dry run is not a successful physical restore. A failed post-write check means a write may already have occurred; read the error and keep the original backup.