File: mergeall-android11-updates-media/MORE--logs-and-code/Permissions-wireless-adb.txt
######################################################################################## # Run on Linux: go wireless for adb, attach USB drive to phone, and inspect its paths. # 6C2A-1618 is an on-phone microSD card's ID, 8145-191C is the attached USB drive's ID. # # Your adb path will vary; it's not shown in full here because it was added to $PATH, # but on Linux was /home/me/.buildozer/android/platform/android-sdk/platform-tools/adb. # You can also run 'adb shell' just once, and omit the 'adb shell ' prefix on commands. # # Note: wireless adb connection steps have also changed in Android 11; enable it in dev # options, pair if needed (see https://developer.android.com/studio/command-line/adb). ######################################################################################## ## Where necessary $ adb tcpip 5555 # see docs link above $ adb connect 192.168.1.2 # also: adb pair 192.168.1.2:xxxxx ## And disconnect from pc, plug in drive ######################################################################################## # The microSD card is still addressable by path in Android 11, but USB drives are not ######################################################################################## ## Device root $ adb shell ls / ...much, including these mnt sdcard storage $ ## All "volumes" $ adb shell ls /storage 6C2A-1618 emulated self $ ## Internal storage (same as /sdcard: see ahead) $ adb shell ls /storage/emulated/0 Admin Admin-Mergeall Alarms Android ...etc MY-STUFF ...etc $ $ adb shell ls /storage/emulated/0/Android data media obb $ ## The microSD card $ adb shell ls /storage/6C2A-1618 Admin-Mergeall Alarms Android ...etc MY-STUFF ...etc $ $ adb shell ls /storage/6C2A-1618/Android data obb $ ## ==> BUT the USB drive is MIA <== $ adb shell ls /storage/8145-191C ls: /storage/8145-191C: No such file or directory $ $ adb shell ls /storage/8145-191C/Android ls: /storage/8145-191C/Android: No such file or directory $ ######################################################################################## # Try /mnt/media_rw: one file explorer uses this, but it requires permissions or root ######################################################################################## ## The mount root works $ adb shell ls /mnt androidwritable appfuse asec expand installer knox media_rw obb pass_through product runtime sdcard sde secure shell user vendor $ ## But its device folder is off-limits (for both microSD and USB) $ adb shell ls /storage/6C2A-1618/Android data obb $ $ adb shell ls /mnt/media_rw ls: /mnt/media_rw: Permission denied $ $ $ adb shell ls /mnt/media_rw/6C2A-1618/Android ls: /mnt/media_rw/6C2A-1618/Android: Permission denied $ $ $ adb shell ls /mnt/media_rw/8145-191C ls: /mnt/media_rw/8145-191C: Permission denied $ $ adb shell ls /mnt/media_rw/8145-191C/Android ls: /mnt/media_rw/8145-191C/Android: Permission denied $ $ adb shell ls /mnt/media_rw/8145-191C/Android/data ls: /mnt/media_rw/8145-191C/Android/data: Permission denied $ ## Maybe it's time for a rootable phone? $ adb root adb cannot run as root in production builds $ $ adb shell sudo ls /mnt/media_rw /system/bin/sh: sudo: inaccessible or not found $ $ adb shell su -c ls /mnt/media_rw /system/bin/sh: su: inaccessible or not found $ ######################################################################################## # Alternate paths to internal storage (whose root is still accessible to Python code) ######################################################################################## ## Internal storage (same as /sdcard on this device) $ adb shell ls -l /storage/emulated/0 total 86 drwxrwx--- 2 root everybody 3488 2020-09-09 17:00 Admin drwxrwx--- 3 root everybody 8192 2021-01-02 17:51 Admin-Mergeall drwxrwx--- 2 root everybody 3488 2020-07-23 02:08 Alarms drwxrwx--- 6 root everybody 3488 2020-12-29 16:10 Android ...etc drwxrwx--- 13 root everybody 3488 2020-12-30 16:00 MY-STUFF drwxrwx--- 5 root everybody 3488 2020-07-26 14:37 my-OTHER-STUFF drwxrwx--- 3 root everybody 3488 2020-12-30 17:47 qpython -rw-rw---- 1 root everybody 4 2020-12-31 15:23 xxx.txt $ ## The many paths to your stuff (on this device) $ adb shell ls /storage/self primary $ $ adb shell ls -l /storage/self/primary/Android total 14 drwxrwx--x 94 root sdcard_rw 8192 2021-01-01 21:08 data drwxrwx--- 2 root everybody 3488 2020-12-29 13:42 media drwxrwx--x 10 root sdcard_rw 3488 2021-01-05 06:39 obb $ $ adb shell ls -l /storage/emulated/0/Android total 14 drwxrwx--x 94 root sdcard_rw 8192 2021-01-01 21:08 data drwxrwx--- 2 root everybody 3488 2020-12-29 13:42 media drwxrwx--x 10 root sdcard_rw 3488 2021-01-05 06:39 obb $ $ adb shell ls -l /sdcard/Android total 14 drwxrwx--x 94 root sdcard_rw 8192 2021-01-01 21:08 data drwxrwx--- 2 root everybody 3488 2020-12-29 13:42 media drwxrwx--x 10 root sdcard_rw 3488 2021-01-05 06:39 obb $ ## Transitive links (a historical legacy of obfuscation) $ adb shell ls -l /sdcard lrw-r--r-- 1 root root 21 2008-12-31 07:00 /sdcard -> /storage/self/primary $ $ adb shell ls -l /storage/self/primary lrwxrwxrwx 1 root root 19 2021-01-05 06:39 /storage/self/primary -> /storage/emulated/0 $ $ adb shell ls -l /mnt/sdcard lrwxrwxrwx 1 root root 21 2019-06-03 13:32 /mnt/sdcard -> /storage/self/primary $ ######################################################################################## # Back to wired (where required) ######################################################################################## ## Where necessary and desired $ adb disconnect disconnected everything $ $ adb usb restarting in USB mode