S026: Android phones as mtp:// locations with hotplug and Devices places
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
eba5db311b
commit
134095472e
1 changed files with 1547 additions and 159 deletions
|
|
@ -184,6 +184,15 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
|
|||
- Not done: arrival fade, scroll cancel and live toggle not watched (single frames); a link badge hides while a thumbnail shows; video frame change doesn't redo existing thumbnails; plain `workspace` clippy red until S026 fixes `tunal-devices`. Screenshots now draw once, run `Shell::settle_thumbs`, then draw again.
|
||||
- Later: preview panel; thumbnails for PDFs; remote locations (SFTP/devices) need a read path in the pool.
|
||||
|
||||
## S026 — Android devices over MTP
|
||||
- Done: `mtp::MtpLocation` (`Location`, scheme `mtp`): `mtp://<serial>/` = the device (its storages as folders `<id hex>`), `mtp://<serial>/<storage>/<path>`. Path → handle walk over a children cache (miss → one fresh listing), handle → URI map for events; list (always fresh), stat (fresh ObjectInfo), open_read (GetPartialObject(64) in 1 MiB chunks, session locked per chunk; else GetObject on a thread through a pipe, short stream → error), open_write (spooled to an unlinked temp file, sent on `flush`; unflushed drop sends nothing; Overwrite deletes the old object first), mkdir, rename (move + ObjectFileName), delete (permanent, `NotEmpty` for non-empty folders; trash Unsupported so the UI confirms). Capabilities write + watch. Watch: per-device interrupt thread (`Transport::take_events`) turns ObjectAdded/Removed/InfoChanged/PropChanged into `Changed([child uris])` for the watched folder; storage events re-read storages and refresh the sidebar.
|
||||
- `mtp::watch(location, on_change)` (hotplug.rs): nusb `watch_devices` + initial scan, key = serial (URI-safe) else `usb-<bus>-<addr>`; `connect(key, name, usb id, transport)` / `disconnect_usb(id)` / `places() -> Vec<DevicePlace { name, uri }>` (one per storage, "Model · Storage" when several; one device entry while it has a problem). `mtp::Error::{Busy, PermissionDenied}` from nusb kinds.
|
||||
- Messages (shown as the folder error when the device entry is opened): busy, no USB permission (udev rule), locked / no file transfer (no storages; re-checked on open, StoreAdded refreshes).
|
||||
- App: `devices_bridge.rs` (`register` adds the backend to `Locations`, `attach` fills Devices via `Shell::set_devices`, glyph `smartphone`); hotplug failure → one stderr line. Example helpers moved to `examples/common`; new `--example mtp_location` (busy/locked phones, list/stat/read/write/mkdir/rename/delete over replay).
|
||||
- Verified: workspace build, clippy -D warnings, fmt --check and the screenshot in a scratch worktree (HEAD + S026 only; the shared checkout fails on S018's in-flight settings files); app with no phone: Devices "No phones connected", no error; `mtp_location` and `mtp_replay` pass.
|
||||
- Not done: real phone, hotplug events, MTP events, permission message (S036). Breadcrumb shows the serial and storage hex, not names. Long transfers hold the device lock (listing waits).
|
||||
- Later: device/storage names in breadcrumb; cancel a running GetObject (MTP Cancel request); free space in the sidebar tooltip.
|
||||
|
||||
## Later
|
||||
- (orchestrator) Breadcrumb: a long path is hard-clipped at the bar's left edge with no elision mark, and the root crumb elides at 960 px — for S034.
|
||||
-
|
||||
|
|
|
|||
Loading…
Reference in a new issue