Skip to content

project usb

Aisjam edited this page Nov 15, 2026 · 1 revision

USB selective transfer

Home · Section index

Working manual · 0.0.1-alpha · source snapshot 16 November 2026

Status and transport

The user's H700 prototype is verified Mass Storage, not MTP: Linux 4.9.170, Ubuntu 22.04 aarch64, UDC 5100000.udc-controller, ConfigFS gadget contour, function mass_storage.0, existing FAT32 image /mnt/mmc/Contour/usb-transfer.img, Windows volume label CONTOUR. Windows enumerated it and accepted a document. The new application integration and helper still require device acceptance testing. No image is created, reformatted, resized or deleted by this implementation.

MTPBackend deliberately reports unavailable. Kernel configuration alone is not a userspace responder. Before implementing it, inspect /dev/mtp_usb, the actual vendor ioctl ABI, installed responders and FunctionFS. No responder dependency or licensing decision has been made. Do not describe the mock or Mass Storage as MTP.

Using the selective staging workflow

  1. Place only files wanted on Windows in <content-root>/Send. These are explicit exports, not a mirror of Projects, Samples or the full library.
  2. Open Project, move down to USB / TRANSFER, and press A. Mouse clicks and SDL's touch-to-mouse events activate the same action. Existing keyboard actions continue to mirror the controller.
  3. PREPARING copies Send into a uniquely named session inside the image's Send folder, flushes it and unmounts locally before exporting the image.
  4. At USB Transfer Ready, connect the cable. Browse/copy files in Windows. Windows can rename, move or delete staging files without changing live files.
  5. Use Windows Eject on CONTOUR, then press EJECT in Contour. Merely closing Explorer or unplugging the cable is not treated as safe ejection.
  6. The helper requires the kernel LUN's file attribute to be empty before unbinding. It mounts read-only and imports permitted image contents into a new <content-root>/Received/USB-... folder. COMPLETE appears after unmounting.

The kernel's documented removable-LUN behavior closes the backing file on a SCSI eject request: Linux Mass Storage documentation. This exact release signal needs testing against the H700 vendor kernel. A failure to observe it rejects EJECT; the helper never uses forced eject or guesses that an unplugged cable means all Windows writes finished.

Both copies stream in 64 KiB chunks, check size/time changes and available space, flush file data, and publish complete session directories by rename. FAT32 limits each export file to less than 4 GiB. Nesting is limited to 32 levels and directory metadata to 10,000 entries per folder. Keep Send unchanged during export. This initial workflow does not offer cancellation during a copy/commit.

Imports include the selected export sessions too, preserving host modifications without overwriting the live source. Repeated sessions consume additional space; review completed imports and explicitly clean staging files in Windows as needed. There is no periodic synchronization or automatic cleanup. Hidden names, underscore names (including _TRASH), Windows system folders, live CTL files, .tmp, .part, Windows reserved names, and non-ASCII names are currently skipped. Symlinks and special files are rejected. This filename policy is intentionally limited; Unicode name handling is not yet implemented. Do not put credentials in Send.

Deletions and conflicts

There is no propagation of staging deletions or replacements into the working library. Every import has a fresh name; live projects, active samples and previous Received sessions remain untouched. Consequently this workflow does not need to trash an original to resolve a conflict. It does not yet implement an approved merge, _TRASH metadata/recovery UI, or deletion synchronization. Any future merge must gain explicit approval and archive prior files before changing them.

Failed copies remain in hidden .USB-*.partial folders for recovery. Original sources are retained, including on disk-full or a changed source. Application file access is confined to Send, Received and the helper's image mount. It never scans or copies the entire Contour library. No project reload is triggered by imports; open an imported project deliberately after reviewing it.

Failure recovery

If Windows has not released the LUN, EJECT reports an error and can be retried. If import fails, the read-only mount is retained and EJECT retries the import into a fresh session; fix space/permission problems first. Do not kill the process to interrupt a file commit. Normal application Quit is blocked while the dialog is open.

On helper EOF or application crash, a local mount is unmounted when possible. An exported gadget is deliberately left bound: automatically unbinding could truncate host writes. Safely eject in Windows before administrative recovery. Confirm the LUN file attribute is empty, unbind the existing contour UDC, and inspect loop and mount ownership before restarting. Never mount an image still owned by a host. Unexpected helper death/timeouts require this inspection, not blind retries. After power loss retain the image and partial sessions; validate/repair a backup offline before using it again. No automatic trash or image deletion occurs.

What should be here

Documentation still to add
Annotated current-build screenshots and a recorded controller walkthrough for this topic.

Evidence and verification

Repository sources used for this page:

  • docs/usb-transfer.md

This is a documentation/source review, not a new runtime or hardware test. Physical response, screenshots and listening examples still need verification on a recorded build.

Clone this wiki locally