Repository navigation
Allow reusing an existing PTP session - #29
Conversation
|
Hi, @worm-emoji! Thanks for this, and for keeping it clean. I've checked out the branch, rebased it onto v0.31.0 I also confirmed your diagnosis against the code. Nothing in One thing before I can merge: Hardware evidence. Your tp7 PR says the write-path hardware smoke didn't run because macOS wouldn't hand over the IOKit interface. So the central claim isn't verified on a real TP-7 yet. That's a blocker. The cause, btw, is most likely And four more things that either you or I can do: 1. Docs. Add a TP-7 bullet under "Known device quirks" in 2. Say what 3. Windows ignores the setting. 4. Test the wiring. Do these if you'd like, otherwise I can. Good for me either way. And don't worry about the rebase or the changelog. Your branch is two commits behind |
|
Thanks for the detailed review. I pushed
Local formatting, strict all-feature Clippy, default and all-feature tests, isolated watcher tests, and docs all pass. I am deliberately holding off on the real TP-7 A/B while the device is busy with an import. I will run the requested before/after once it is free and report the exact commands and observed mode behavior here. |
|
Hardware A/B complete and pushed in Setup:
Result:
So the default |
|
Thanks, was a clear merge now :) Happy building! |
… every thread since July is recorded - `README.md` tested devices: the Garmin Forerunner 955 row no longer claims a failing test under investigation. @dasJ confirmed the full read-only suite (11/11) on 2026-05-03 after the split-receive fix; uploads work with the auto-applied split-header mode. - `docs/notes/community-threads.md`: - #6: Garmin marked confirmed (destructive suite never re-run), plus the two 2026-09-11 reports (Pixel 8 Pro from @max619, Galaxy S23+ via Android Bridge from @WildBenji) - New entries for #11 (CLI), #20/#22/#23 (Switch responders), #21/#24 (root `SendObjectInfo`), #29 (TP-7 session reuse), and open PR #32 - #12 moved to closed with its last round and the 17/17 final run - Quirk table: dropped the wrong "Android rejects root uploads" row (that was our `0` vs `0xFFFFFFFF` bug) in favor of the real `SEND_ROOT` quirk; added Venu 2/2S, Switch, Sphaira, TP-7, and the Lumix 32-bit partial-read rows; replaced references to the removed `list_objects_recursive_auto` / `is_android()` - Contributors: added @dtretyakov, @oenderg, @worm-emoji, @max619, @WildBenji
Summary
Teenage Engineering TP-7 firmware treats
CloseSessionas a request to leave MTP mode. Its companion workflow instead uses a stable session ID across host processes and continues whenOpenSessionreportsSessionAlreadyOpen.The current
mtp-rsrecovery path closes and reopens any existing session. That makes one-process-per-command TP-7 clients knock the recorder out of MTP mode after ordinary file operations. This behavior is needed by the TP-7 CLI work in totocaster/tp7#4.Changes
PtpSession::open_reusing_existingfor the low-level opt-inMtpDeviceBuilder::reuse_existing_session(id)as the single high-level setting for a stable session ID plus reuseMtpDevice::close()still sendsCloseSessionAGENTS.mdCloseSessioncommandNo TP-7 identifiers or automatic device quirks are added to
mtp-rs.Test plan
cargo fmt --all -- --checkcargo clippy --all-targets --all-features --quiet -- -D warningscargo test --quiet -- --skip fs_watcher(460 passed; 26 expected hardware/platform tests ignored; 6 watcher tests filtered into the separate pass)cargo test --all-features --quiet -- --skip fs_watcher(471 passed; 26 expected hardware/platform tests ignored; 6 watcher tests filtered into the separate pass)cargo test --all-features --quiet fs_watcher -- --test-threads=1(6 passed outside the sandbox)cargo doc --no-deps --quietHardware A/B
Hardware-verified on a TP-7 running device firmware 2.5.7 and MTP firmware 1.1.11 over macOS/nusb on 2026-08-27, with the documented
ptpcameradblocker active.The control and patched binaries were built from the same TP-7 CLI commit (
503577d). The control differed only by changingreuse_existing_session(true)toreuse_existing_session(false); both used the same stable session ID (0xBAAA_AAAD).tp7 --json statusestablished the recorder inmtpmode.tp7 --json statussucceeded.TP-7 ... is in audio-midi mode; no MTP-compatible interface is visible.tp7 --json --auto-connect connectreportedinitial_mode: audio-midi,final_mode: mtp,mtp_ready: true.tp7 --json statusprocesses both succeeded and reportedmode: mtp.This A/B used only mode switching and read-only status queries. No files or recordings were transferred, changed, or deleted, and no explicit
eject/CloseSessionwas sent after the patched run.The Rust 1.85 MSRV check is not available locally because this machine has a single Homebrew Rust toolchain and no
rustup; the prior PR revision passed the upstream Rust 1.85 CI jobs on Linux, macOS, and Windows.