mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 21:54:00 +01:00
Prep for a Ulefone Armor X12 Pro (MediaTek MT6765) that has not arrived, validated read-only against the Pixel 6a that has. Partition discovery never hardcodes boot vs init_boot. It reads /dev/block/by-name/, derives the slot scheme from observed _a suffixes, and picks the ramdisk carrier by preference order init_boot then boot over what is actually present. The AOSP launch-version rule explains why that ordering is right; the code consults the filesystem, not the API level. One path therefore serves both a Pixel (no init_boot, falls to boot_a) and a 13-launch MediaTek device (init_boot_a taken). Patching the wrong one yields a phone that will not boot. Classification refuses rather than guesses: ULEFONE needs a positive MediaTek signal AND a vendor match, with no "not a Pixel therefore Ulefone" fallback. Carrier lock is always reported UNDETERMINED, because sys.oem_unlock_allowed, ro.oem_unlock_supported and settings global oem_unlock_allowed read identically whether a device is carrier-locked or merely has the toggle off; asserting a negative would wrongly rule out a path. No flashing script, deliberately. Automating irreversible partition writes defeats the confirmation steps that catch a wrong partition or missing slot suffix. Three bugs found by running the code rather than only linting it: - SIGPIPE: `adb version | head -1` under pipefail exited 141 and killed 00-preflight.sh mid-run - 20-dump-stock.sh exited silently when no recon had run, because find on a nonexistent cache dir fails under set -e - the read-only static scan had a hole: stripping all quoted strings to avoid false positives on printf text also hid `adb shell "reboot bootloader"`. Now only printf/echo/cat arguments are stripped, and a negative self-test asserts the scan fails on injected commands Also narrowed a world-writable udev catch-all (idVendor=="*", MODE="0666") that granted every local process read/write access to every USB device; commented with a backup, adb connectivity re-verified afterwards. Validated: 58/58 offline fixture tests; 00-preflight.sh HOST READY (12/12); 10-recon.sh read-only against the Pixel reports PIXEL, boot_a, A/B, no init_boot, path C-or-D indeterminate, with the device unchanged afterwards. Untested and labelled as such in READY.md: the init_boot branch on real hardware, mtkclient over BROM, and the whole flash/verify sequence. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ReVsw7qovYkkGbqcU9tn7
25 lines
1.2 KiB
Plaintext
25 lines
1.2 KiB
Plaintext
# mtk_root - USB access for Android debugging and MediaTek BROM recovery.
|
|
#
|
|
# Installed by mtk_root/install.sh. Scoped to two vendor IDs on purpose.
|
|
#
|
|
# MODE="0660" plus GROUP + TAG+="uaccess", NOT MODE="0666":
|
|
# - 0666 grants every process on the machine read/write access to the device
|
|
# - uaccess grants access to the user logged in at the physical seat, which
|
|
# is what is actually wanted, and it is revoked on logout
|
|
# A rule matching idVendor=="*" with 0666 applies to every USB device attached
|
|
# to the system - storage, security keys, everything - not just phones.
|
|
|
|
# Google (Pixel): adb + fastboot
|
|
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0660", GROUP="adbusers", TAG+="uaccess"
|
|
|
|
# MediaTek: BROM / preloader / DA modes, used by mtkclient.
|
|
# 0e8d covers the BROM (2000), preloader (2001) and DA download ports.
|
|
SUBSYSTEM=="usb", ATTR{idVendor}=="0e8d", MODE="0660", GROUP="adbusers", TAG+="uaccess"
|
|
|
|
# MediaTek devices also expose a CDC-ACM serial port in preloader mode;
|
|
# mtkclient opens it directly.
|
|
SUBSYSTEM=="tty", ATTRS{idVendor}=="0e8d", MODE="0660", GROUP="uucp", TAG+="uaccess"
|
|
|
|
# Ulefone's own USB vendor ID, if it differs from MediaTek's, is UNKNOWN until
|
|
# the device is attached: run `lsusb` with it plugged in and add a line here.
|