Files
Abdurrahman Kaan DikeçandClaude Opus 5.5 3c2235983f Installers: Android's USB set to adb alone for the run (MTP off)
On an F50 the stock firmware's MTP function hangs, and Windows then resets the
USB device about every ten seconds, which cuts the adb session the installer
uses each time. Reported by kanoqwq, who suggested turning MTP off from the
installer.

Early in every run (right after root is confirmed) install.sh, install.ps1,
uninstall.sh, uninstall.ps1 and the web installer push tools/android-usb.sh
and switch sys.usb.config to "adb" when it holds mtp or ptp: "none" first,
until sys.usb.state says none, then "adb" - what Android's UsbDeviceManager
does (UsbHandlerLegacy: no USB gadget HAL on these units). The F50's stock
vendor rc (init.ums9620_2h10_ufi.usb.rc, B09) builds "adb" as ffs.adb alone
(19d2:1352) for every persist.vendor.sys.modem.diag value, and AOSP's
init.usb.configfs.rc has it on every configfs Android, so the U30 Air and the
V50 get it too. Never persist.sys.usb.config: the next start of Android has
the user's functions again. The switch runs detached (adb drops with its
first step); the host then waits for adb with sys.usb.state "adb", bounded by
MU300_USB_WAIT (60 s), and stops with what to do when the device does not come
back. Android that sets its functions again is gone on with. MTP already off:
nothing happens. MU300_USB_ADB_ONLY=0 leaves the USB alone.

Where a run ends with the device still in that boot of Android (uninstall,
--check, a backup, a failure) the functions of before are set back; never
after a reboot (sys.powerctl set, or another boot_id). The web installer
switches after staging and tells the user to choose the device again (it
comes back as another USB product). Our Linux gadget (ncm/ecm/rndis + acm +
ffs.adb) has no MTP or PTP function; a test says so.

Not run on a board: it needs the owner's test in Android.

Reported-by: kanoqwq
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VVN2zDgf76kMDVSuWhHPUE
2026-11-01 14:29:24 +03:00
..