[DEV] Native usb storage otg - Nexus 7 Android Development

Made some progress with USB storage without the use of an app. Setup so far is really simple. Add a line to /system/etc/vold.fstab that looks like this:
dev_mount usbdrive /mnt/usbdrive auto /devices/platform/tegra-ehci.0
Still need work on getting the external storage managed by the system.
WARNING:
This is just a first step and with no way to unmount using Android's storage manager you may corrupt your external storage.

calmfury said:
Made some progress with USB storage without the use of an app. Setup so far is really simple. Add a line to /system/etc/vold.fstab that looks like this:
dev_mount usbdrive /mnt/usbdrive auto /devices/platform/tegra-ehci.0
Still need work out how to unmount. hope this helps someone.
Click to expand...
Click to collapse
Does that mean I can back up and restore stuff via otg as if it were my external sd card?
Sent from my Nexus 7 using XDA Premium HD app

mrnovanova said:
Does that mean I can back up and restore stuff via otg as if it were my external sd card?
Sent from my Nexus 7 using XDA Premium HD app
Click to expand...
Click to collapse
u can with the new twrp
Sent from my Galaxy Nexus using xda premium

smirkis said:
u can with the new twrp
Sent from my Galaxy Nexus using xda premium
Click to expand...
Click to collapse
NOOOO! I Seriously! And you tell me this now. Thanks I'll give it a whirl.
Sent from my Nexus 7 using XDA Premium HD app

Wow I JUST got my OTG yesterday. Fantastic timing.

what this means... hopefully
As it stands now, adding this line will cause your N7 to automount a usb drive to /usbdrive. You will see "preparing usb storage" in the notification bar and your file explorer of choice will see the data in /usbdrive. Unmounting is an issue at this point. I hope to fix that in a few days when I get the time.

https://play.google.com/store/apps/details?id=eu.chainfire.stickmount
I believe this works on the N7 I am waiting on my cable to test. I realize you want to do it without a app but the syntax should be close.
Sent from my Galaxy Nexus using Tapatalk 2

calmfury said:
Made some progress with USB storage without the use of an app. Setup so far is really simple. Add a line to /system/etc/vold.fstab that looks like this:
dev_mount usbdrive /mnt/usbdrive auto /devices/platform/tegra-ehci.0
Still need work out how to unmount. hope this helps someone.
Click to expand...
Click to collapse
Correct me if I'm wrong but I believe that CM10 already has USB Storage OTG built into it with the last few nightlies.

djkinetic said:
Correct me if I'm wrong but I believe that CM10 already has USB Storage OTG built into it with the last few nightlies.
Click to expand...
Click to collapse
Yes it does from what I know
Sent from my Galaxy Nexus using Tapatalk 2

a day late and a dollar...
Haven't been following the cm10 builds. Still gonna push forward for the exercise.

People who don't run CM10, can use this method. Would be cool if unmount is done.

Guys, quick question as I'm receiving my N7 tonight, the usb stick format can be ntfs? Or only fat32? Thanks
EDIT: saw from other thread, ntfs seems ok as well. i already got the tab and will start unlock and root.
Tapatalked from my HOX

Versatile1 said:
https://play.google.com/store/apps/details?id=eu.chainfire.stickmount
I believe this works on the N7 I am waiting on my cable to test. I realize you want to do it without a app but the syntax should be close.
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
Just wanted to confirm that stickmount works well with the N7.
I have it installed and I've used it on two different usb drives.
A 32GB PNY USB2.0 Flash Drive Stick
And an 8GB uSD card inserted into an elago II USB Reader.
Both worked without any issues.
However, I'm still intrigued by a method to get usb mass storage support natively w/o an app

That does it...I give in! I gotta try the twrp recovery. Feel like I just decided to cheat on my girlfriend.
Sent from my Nexus 7 using xda premium

I will be following your progress.

calmfury said:
As it stands now, adding this line will cause your N7 to automount a usb drive to /usbdrive. You will see "preparing usb storage" in the notification bar and your file explorer of choice will see the data in /usbdrive. Unmounting is an issue at this point. I hope to fix that in a few days when I get the time.
Click to expand...
Click to collapse
But stickmount already does that and it unmounts it as well.
Sent from my Nexus 7 using XDA Premium HD app

Can someone point me to an otg cable thats on a uk site pleae?
Sent from my Nexus 7 using Tapatalk 2

leelaa said:
Can someone point me to an otg cable thats on a uk site pleae?
Sent from my Nexus 7 using Tapatalk 2
Click to expand...
Click to collapse
I saw a post about it somewhere around here. Referenced Amazon.uk, the title was USB otg that work and ones that don't I believe. Google can probably get it. If I wasn't using the app I would hook you up.
Sent from my Nexus 7 using xda premium

calmfury said:
Made some progress with USB storage without the use of an app. Setup so far is really simple. Add a line to /system/etc/vold.fstab that looks like this:
dev_mount usbdrive /mnt/usbdrive auto /devices/platform/tegra-ehci.0
Still need work on getting the external storage managed by the system.
WARNING:
This is just a first step and with no way to unmount using Android's storage manager you may corrupt your external storage.
Click to expand...
Click to collapse
Can I ask, does this support NTFS r/w? or r/o.
Everything I've tried, aside from USB OTG Helper--including a CM10 kang rom that claimed to support ntfs OTG--will only mount r/o.
Including the command $ mount -t ntfs /dev/block/sda1 /usbdisk. I guess it's the ntfs driver or something? but it will only mount r/o. Even $ mount -o remount,rw /dev/block/sda1 /usbdisk does not work, it still is ro.

leelaa said:
Can someone point me to an otg cable thats on a uk site pleae?
Sent from my Nexus 7 using Tapatalk 2
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=1812609
Sent from my Nexus 7 using xda premium

Related

ExtSdCard mount point?

Is there a way to mount the external sdcard somewhere other than /mnt/extSdCard? Many programs are only referencing /sdcard, so I thought it might make sense for the external xard to be mounted somewhere under that point, maybe /sdcsrd/external?
Sent from my Galaxy Note 10.1 using Tapatalk 2
Better write to the makers of that software to correct this bug.
blulite said:
Is there a way to mount the external sdcard somewhere other than /mnt/extSdCard? Many programs are only referencing /sdcard, so I thought it might make sense for the external xard to be mounted somewhere under that point, maybe /sdcsrd/external?
Sent from my Galaxy Note 10.1 using Tapatalk 2
Click to expand...
Click to collapse
edit: problem solved.
globalgpj said:
edit: problem solved.
Click to expand...
Click to collapse
And how?
I solved it by useing Directory Bind (here from XDA somewhere).

/storage/sdcard0 isnt mounted

I am currently on cm10 8/31. I tryed the new build of remjb and after flashing my imternal storage wouldnt mount. It shows 0 bytes of 0 bytes in fx file and root explorer says it is not mounted. So i restored nandroid back to the cm10 and it was mounted. Oh well its ok, i like cm10...... I tryed to take a picture a couple days later and it says i have no storage.... Now my internal isnt mounted on cm10 either. Did full wipe and reinstalled and it still wont mount. In recovery it shows up fine......... I guess what im asking is can anyone give me a terminal command the mounts the internal storage. Its just frustrating as i cant take pictures and half of my apps wont function right since they have stuff saved in android/data on the sd card.
Ps. My external works fine and mounts and shows in fx file fine....
Sent from my SGH-I997 using xda app-developers app
Look at this thread for answer. I think the external you are seeing is really internal. Real external might be /emmc.
http://forum.xda-developers.com/showthread.php?t=1883467
Sent from my SGH-i997 using xda premium
psal217050 said:
Look at this thread for answer. I think the external you are seeing is really internal. Real external might be /emmc.
http://forum.xda-developers.com/showthread.php?t=1883467
Sent from my SGH-i997 using xda premium
Click to expand...
Click to collapse
I am sure its the internal not mounted because external is both emmc and sdcard1 while sdcard0 is internal. And my external is 32gb so that helps further prove its my internal just not mounting right.
Sent from my SGH-I997 using xda app-developers app
Have you checked the Storage tab under the Settings to see if there is an option to mount it there?
Ryo Misaki said:
Have you checked the Storage tab under the Settings to see if there is an option to mount it there?
Click to expand...
Click to collapse
.........yup fixed it. Took all of ten seconds....... god, makes me feel SO noobish. THANK YOU SO MUCH!!!!!
Sent from my SGH-I997 using xda app-developers app
nim.whit said:
.........yup fixed it. Took all of ten seconds....... god, makes me feel SO noobish. THANK YOU SO MUCH!!!!!
Click to expand...
Click to collapse
Not a problem! I'm glad the solution was something easy. =D
It's often easy, especially when we do so much technical tweaking, to overlook the simple answers.
Don't feel bad about it. =P
exactly the same
Hey.
I have the exact same problem, but the "mount SD" in settings won't mount it. It just goes from "calculating" back to the "mount SD" button. Frustrating! It's been worked without problems till now and i haven't installed anything or changed anything!
WeWantWok said:
Hey.
I have the exact same problem, but the "mount SD" in settings won't mount it. It just goes from "calculating" back to the "mount SD" button. Frustrating! It's been worked without problems till now and i haven't installed anything or changed anything!
Click to expand...
Click to collapse
I am having the same issue, was a fix ever found?
c_k_42 said:
I am having the same issue, was a fix ever found?
Click to expand...
Click to collapse
No it wasn't. I just had to keep hitting mount USB in storage. But I switched to an old iPhone for a while then came back to this. Got the jellybean iemi issue and odined back to stock a couple times. That seemed to fix it. No longer have the issue. Weird.
PS I am in the latest Scott cm10 (11/04 with that kernel fix flashed 11/14 I think and latest gapps) fully went to stock and followed every step precisely. If you go back to stock be sure that when you get to the step where you flash an ICS ROM be sure to boot up the ICS rom once before wiping and flashing jellybean. Not doing that step messed up my iemi again haha xP had to Odin yet again.
Sent from my SGH-I997 using xda app-developers app
Let's take aside the noobish method. What would be the mount command for sdcard0 mounting anyway? So much garbage on the forum, that this simple question is impossible to find a resolution for.

[Q] Usb otg disk compatibility..

I just a bought an otg cable and tested it with some usb device.. So far I can only mount an 8gb Kingston pendrive (which I thanked god its working).. Buy when I tried some other it wont event mount.. And theres nothing load in sys/dev/block... Mouse are working great so far..so if anyone have any experience with otg can share some info..
hafizkris90 said:
I just a bought an otg cable and tested it with some usb device.. So far I can only mount an 8gb Kingston pendrive (which I thanked god its working).. Buy when I tried some other it wont event mount.. And theres nothing load in sys/dev/block... Mouse are working great so far..so if anyone have any experience with otg can share some info..
Click to expand...
Click to collapse
how did you manage that the atrix 2 doesnt send out power through its usb port
did you use an external power source....???
darth_nihar said:
how did you manage that the atrix 2 doesnt send out power through its usb port
did you use an external power source....???
Click to expand...
Click to collapse
I bought an otg with power host.. Can be powered using wall charger or power bank..
hafizkris90 said:
I bought an otg with power host.. Can be powered using wall charger or power bank..
Click to expand...
Click to collapse
ohk where did u get tht can u show me the specs.....
and have u tried checking the dev/block what is it showing.....
If the disk can be detected. There a file named 8:1 8:2.. Idk whats that but it only present when the usb is detected.. Here a model of what I've bought..
http://www.ebay.com/bhp/microusb-otg-power
This may be useful to you:
http://forum.xda-developers.com/showthread.php?t=1334444
Brought to you by time and relative dimensions in space.
1BadWolf said:
This may be useful to you:
http://forum.xda-developers.com/showthread.php?t=1334444
Brought to you by time and relative dimensions in space.
Click to expand...
Click to collapse
Useful info man thanks.. But I only have prob connecting some other pendrive.. Like what I've mentioned.. Its like I have tried 10 usb thumb drive.. Only 2 of it usable..
edit: this is one the drive im able to mount
http://www.amazon.co.uk/DT101G2-8GB-Kingston-DataTraveler-Drive/dp/B0047ZCX4U
and the other one is 4gb version of this type..
hafizkris90 said:
Useful info man thanks.. But I only have prob connecting some other pendrive.. Like what I've mentioned.. Its like I have tried 10 usb thumb drive.. Only 2 of it usable..
edit: this is one the drive im able to mount
http://www.amazon.co.uk/DT101G2-8GB-Kingston-DataTraveler-Drive/dp/B0047ZCX4U
and the other one is 4gb version of this type..
Click to expand...
Click to collapse
Yeah, I haven't tried this yet so I don't know much about it. I just remembered that thread because I have been intending to try it out but just haven't gotten around to it.
If I had a dollar for every time I said that, I'd be making money in a very weird way.
hafizkris90 said:
I just a bought an otg cable and tested it with some usb device.. So far I can only mount an 8gb Kingston pendrive (which I thanked god its working).. Buy when I tried some other it wont event mount.. And theres nothing load in sys/dev/block... Mouse are working great so far..so if anyone have any experience with otg can share some info..
Click to expand...
Click to collapse
Hey i think i got your problem which file system did u format your pendrive in ???
try using FAT 32 open root explorer.....r/w (those 8.0 8.1 use their names)
in terminal emulator run dis command
su
mkdir /sdcard-ext/usb (this can be any directory you want on the internal or micro SD)
mount -t vfat /dev/block/sda1 /sdcard-ext/usb
see if this helps :good:
darth_nihar said:
Hey i think i got your problem which file system did u format your pendrive in ???
try using FAT 32 open root explorer.....r/w (those 8.0 8.1 use their names)
in terminal emulator run dis command
su
mkdir /sdcard-ext/usb (this can be any directory you want on the internal or micro SD)
mount -t vfat /dev/block/sda1 /sdcard-ext/usb
see if this helps :good:
Click to expand...
Click to collapse
Is it mounting script? Im using usb otg helper from play store.. I think it does the same thing.. About fat32.. Yes it is.. Buy none of that file appears.. So i guess u can mount any usb drive?
Sent from my ME865 using XDA Premium 4 mobile app
hafizkris90 said:
Is it mounting script? Im using usb otg helper from play store.. I think it does the same thing.. About fat32.. Yes it is.. Buy none of that file appears.. So i guess u can mount any usb drive?
Sent from my ME865 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Ya its a mounting script and since u sent me that otg cable specs i made one lol got my pendrive working .....
So if its fat32 and shows up on the dev blocks folder i think you should be able to mount just about anything .
---------- Post added at 04:29 PM ---------- Previous post was at 04:27 PM ----------
darth_nihar said:
Ya its a mounting script and since u sent me that otg cable specs i made one lol got my pendrive working .....
So if its fat32 and shows up on the dev blocks folder i think you should be able to mount just about anything .
Click to expand...
Click to collapse
can you sent me a screen shot of what you see in the dev blocks section what appears...??

[Q] What's a file explorer that can r/w to OTG USB?

I have the meenova micro SD OTG reader and the only way i can access files from through my phone is from TWRP when i flash roms and such. I want to be able to move files back and forth from my phone using the Meenova but i've only seen peopl;e suggest nexus importer but it doesn't really work for me that well, I'm using root explorer right now and it doesn't let me access my usb otg. Basically i want a file explorer that let's me use the meenova to move files and not have to boot into twrp to have to do it and i dont want to have to pay a fortune for an app that will let me do this.
Hi,
Take a look for these apps: https://play.google.com/store/search?q=stickmount&c=apps&hl=fr.
Apps like Stickmount have a free version, you can test... After that I use Root Explorer without any issue.
viking37 said:
Hi,
Take a look for these apps: https://play.google.com/store/search?q=stickmount&c=apps&hl=fr.
Apps like Stickmount have a free version, you can test... After that I use Root Explorer without any issue.
Click to expand...
Click to collapse
Thanks ! Some great results came out
Sent from my Nexus 5 using Tapatalk
zolo185 said:
Thanks ! Some great results came out
Click to expand...
Click to collapse
Re,
Yes , for my usage I use Stickmount (the free version). Once the USB is mounted I can move, copy, delete the files. With Root Explorer the path is /sdcard/usbStorage/sda1.
Depends what you want to do. Apps like stickmount are ok if you just want to read/write data on the card through a file explorer. However since these apps dont mount correctly (mount in sdcard for non-root users), they're useless if you want to move game data onto usb otg. Fir that you need it mounting in /storage so custom kernel like chaos is what you'd need
Sent from my Nexus 5 using Tapatalk
rootSU said:
Depends what you want to do. Apps like stickmount are ok if you just want to read/write data on the card through a file explorer. However since these apps dont mount correctly (mount in sdcard for non-root users), they're useless if you want to move game data onto usb otg. Fir that you need it mounting in /storage so custom kernel like chaos is what you'd need
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
How can I tell if its mounting to storage or not. I'm on purity using stock purity kernel.
Sent from my Nexus 5 using Tapatalk
zolo185 said:
How can I tell if its mounting to storage or not. I'm on purity using stock purity kernel.
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Im sorry, I don't understand the question. Does purity say it automounts USB otg in its list of features? Most roms / kernels do not offer this.
I only know 1 kernel and 1 rom that does. Chaos kernel and Mahdi rom. This doesn't mean more don't do it but I don't know the features if every rom or kernel.
Browse to /storage on the root of your device to see what's there
Sent from my Nexus 5 using Tapatalk
rootSU said:
Im sorry, I don't understand the question. Does purity say it automounts USB otg in its list of features? Most roms / kernels do not offer this.
I only know 1 kernel and 1 rom that does. Chaos kernel and Mahdi rom. This doesn't mean more don't do it but I don't know the features if every rom or kernel.
Browse to /storage on the root of your device to see what's there
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Sorry, and it does not mention it in the ROM features and I don't have the USB otg with me at the moment I'm in school. But here is what it shows me now.
*note* the SDA 1 is what I just added to see if it would mount there later on as vicking said above.
View attachment 2542308
Sent from my Nexus 5 using Tapatalk
The attachment doesn't work.
If you use stickmount, it will mount to /storage/sdcard0/usbStorage/sda1
Chaos kernel mounts to /storage/USBdisk
You don't create anything yourself. It creates as and when required
Sent from my Nexus 5 using Tapatalk

[Q] OTG Problem?

Hi guys! Just got a new USB OTG cable and also got stickmount PRO, and i connected my flash drive to my phone and stickmount detected it and i clicked mount and after i was done i clicked unmount and the flash drive got unmounted and so did my sdcard partition and it wouldn't be mounted unless i reboot my device, i've heard of this problem before but never found a solution. Also i'm running the latest version of slimkat and franco kernel, If there's a rom and, or kernel that supports OTG could you point it out for me please cuz i don't want to use stickmount because of this problem. I also tried usb OTG helper and the app crashes when i mount. Please help me and i'm sorry for asking a noob question.
Chaos kernel supports otg. I haven't tried it though.
Chaos is a CAF kernel so you'd have to use an old version on slim.
I use elementalx on slim which also automounts otg via the storage menu.
I still use stickmount too though because elementalx hasn't exported external storage in the correct way yet so can't use foldermount. If you simply want to browse though, elementalx is fine.
I've never had this problem with stickmount. I've never used franco though
Sent from my Nexus 5 using Tapatalk
rootSU said:
Chaos is a CAF kernel so you'd have to use an old version on slim.
I use elementalx on slim which also automounts otg via the storage menu.
I still use stickmount too though because elementalx hasn't exported external storage in the correct way yet so can't use foldermount. If you simply want to browse though, elementalx is fine.
I've never had this problem with stickmount. I've never used franco though
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Thanks! I'm gonna flash elementalx and report back, also would you mind telling me what rom you're running just in case it didn't work for me.
gotenks22 said:
Thanks! I'm gonna flash elementalx and report back, also would you mind telling me what rom you're running just in case it didn't work for me.
Click to expand...
Click to collapse
Ha ha. Already mentioned it in the 2nd line of my first post
Have another look
Sent from my Nexus 5 using Tapatalk
rootSU said:
Ha ha. Already mentioned it in the 2nd line of my first post
Have another look
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
LOL I didn't see that. also i flashed elementalx and i'm still getting the same problem:crying:, i unmount and then a popup shows saying that youtube crashed and when i go to es file explorer it's the same problem. Is there another kernel which isn't CAF that natively supports usb otg?
You're unmounting via storage menu and not using stickmount?
No.point looking at kernels. This isn't a kernel problem. This is a you problem. By you, I.don't mean you yourself. Rather, I mean there is a problem with your config. Usbotg works fine with latest slim and elementalx without issue. Must be an app or something.
Sent from my Nexus 5 using Tapatalk
rootSU said:
You're unmounting via storage menu and not using stickmount?
No.point looking at kernels. This isn't a kernel problem. This is a you problem. By you, I.don't mean you yourself. Rather, I mean there is a problem with your config. Usbotg works fine with latest slim and elementalx without issue. Must be an app or something.
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Thanks for telling me bout elementalx unmounting and mounting via storage menu works now, but the problem is still there with stickmount, it seems like it's stickmount's problem. You also mentioned that elementalx had a problem with external storage does that mean that i can't use apps like GLtoSD so that i can put my game data in my flash drive?
I only use stickmount because of a setting that's missing that prevents foldermount mounting folders from /sdcard to USB. You don't need to use it simply to browse.
No idea why stickmount causes this problem for you. Works fine for me.
No idea what gltosd is. You'll have to test it yourself
Sent from my Nexus 5 using Tapatalk
rootSU said:
I only use stickmount because of a setting that's missing that prevents foldermount mounting folders from /sdcard to USB. You don't need to use it simply to browse.
No idea why stickmount causes this problem for you. Works fine for me.
No idea what gltosd is. You'll have to test it yourself
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
GL to SD does the same thing as foldermount except it's a more user-friendly interface made for games
Probably wont work then without stickmount
Sent from my Nexus 5 using Tapatalk
rootSU said:
I only use stickmount because of a setting that's missing that prevents foldermount mounting folders from /sdcard to USB. You don't need to use it simply to browse.
No idea why stickmount causes this problem for you. Works fine for me.
No idea what gltosd is. You'll have to test it yourself
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Just found out that the main problem was my explorer (after i unmount with stickmount es file explorer tells me sdcard not found but other explorers show it normally) it wasn't the kernel's problem nor stickmount's. Godammit i feel so stupid *facepalm*. Anyways thanks for helping me, also elementalx is amazing, really good battery life and performance.
Yep good kernel
Sent from my Nexus 5 using Tapatalk

Categories

Resources