Closed iChitti closed 3 years ago
termux-usb is not right thing to access USB storage. Also Termux doesn't provide utilities or any capabilities to have a write access to such kind of storage.
At max you can get R/W access to Termux private directory on USB drive. It is usually located at
/storage/XXXX-XXXX/Android/data/com.termux
Where XXXX-XXXX is unique filesystem id. You may need to execute termux-setup-storage
to create this directory.
You need to be root in order to write files to other directories of USB drives.
Overview about supported storage types and their capabilities: https://wiki.termux.com/wiki/Internal_and_external_storage
Seems like there is No Way to access USB storage currently. But thanks for yours Respnoses. Your responses make me feel the questions can be answered.
I tried this too.
Using the explorer on Android, through the details of a file on the USB OTG, I found the path which was something like /mnt/media_rw/
Ooh, that actually worked. Great! Now I can use a script to transfer the video files from the DJI Avata over the USB OTG to my linux computer. On Linux, the Avata is seen as a USB device, but there seems to be no way to access the files (because I think I read somewhere that it is an ethernet device)
I tried this too. Using the explorer on Android, through the details of a file on the USB OTG, I found the path which was something like /mnt/media_rw/
/ I then granted termux extra permissions in the settings "allow apps to access all storage device internal and external". That didn't grant termux access to read from this path though. Perhaps I need to run the 'termux-setup-storage' again with the USB OTG connected and mounted
I have tried these steps but no luck
As described on the udroid link above, the trick is to get the storage device mounted under /storage via fuse (in addition to /mnt/media_rw). In this spot, it can be accessed by Termux.
The following command, executed as user shell (via adb shell over USB cable) sets up the device up so that both secondary SD card and USB sticks are mounted under /storage with fuse:
sm set-force-adoptable on
After this, these devices can be accessed from Termux. /storage directory is unreadable, but names are displayed just fine with df.
Setting only applies to devices inserted after command has been issued. Setting is remembered across reboots
Tested with stock Android 14 on a Pixel 7a, and with LineageOS 20 on a Galaxy Tab S3.
Same here.
It does require a root shell, as a standard shell is access denied.
Nothing 2a:~$ ls -al /mnt/media_rw/*
ls: cannot access '/mnt/media_rw/*': Permission denied
Nothing 2a:~$ sudo bash
.../files/home # ls -al /mnt/media_rw/
total 0
drwxr-x--- 3 root external_storage 60 Jul 15 21:09 .
drwxr-xr-x 16 root system 340 Jul 9 22:38 ..
drwx------ 2 media_rw media_rw 40 Jul 9 22:38 usbotg
.../files/home # ls -al /mnt/media_rw/usbotg/
total 0
drwx------ 2 media_rw media_rw 40 Jul 9 22:38 .
drwxr-x--- 3 root external_storage 60 Jul 15 21:09 ..
.../files/home #
Nothing 2a, Android 14 stock.
The usbotg
subfolder was still empty, despite a memory card was plugged in the USB of the phone and its contents shown in the file manager app.
Hello, I am kind of Novice in this field but. I am really curious about termux and the way it works. So I am trying to access the usb storage just like we access the internal storage like
cd /storage/emulated/0/...
Orcd /sdcard/...
. I've tried some of the fix but didn't worked for me. And I also tried the following fix: https://wiki.termux.com/wiki/Termux-usbEverything seems to work fine but after executing:
termux-usb -e ./usbtest /dev/bus/usb/001/002
It's giving me this error:So any help from the experts is appreciated.
Thank you!