Mounted USB Drive on Nexus 4

Owners of previous Nexus devices have enjoyed the ability to directly connect to USB flash drives and other peripherals using USB OTG (On The Go). The online help manual for the Nexus 4 originally said it would also have this feature, until Google removed it, instead suggesting the use of Bluetooth accessories. Many speculated about why this happened, and wondered if this was a hardware limitation or simply something missing from the software.

Thanks to the proof of concept by CaptainMuon and the subsequent work of ziddey at XDA Developers, we now have a clearer picture of exactly what went wrong with the Nexus 4's OTG capabilities, as well a working solution for those still wanting connectivity to things like thumb drives, mice, and keyboards.

This is no simple app install - root is required, as well as modifying your phone's software. No hardware modifications to the phone itself are needed, but you will need a special cable, which can be purchased or built at home. Ready to jump in? Hit the break for the complete guide.

Background

The first problem with getting OTG working on the Nexus 4 is that the kernel does not support it. This has been solved using a modified version of Franco's kernel. The second problem is that the Nexus 4 cannot physically supply the necessary 5 volts. The way around this is to use a Y-cable, and supply the needed voltage from an outside power source such as a wall outlet or external battery pack. Some users have also reported success using a powered USB hub.

Part 1 - preparing the software

To solve the software problem, you'll need to root your Nexus 4 if you haven't already done so. Make sure you're on a deodexed ROM - I'm using CyanogenMod's 10.1 M2 release. Once you're set up, head over to ziddey's thread and download his zip file (found at the bottom of the first post; "ziddey-otg-03192013.zip" is the latest as of this writing), which you'll flash in your custom recovery. This zip contains the the modified kernel, framework, and system files needed to make OTG work.

Part 2 - preparing the hardware

OTG Y-Cable

To solve the hardware problem, you'll need a special cable. I chose to purchase an OTG Y-Cable. If you have the tools and extra parts, you could also build your own. Whichever you choose, make sure your cable has a male micro-USB and female micro-USB leading into a female USB as pictured above. The portion of the cable that data is transferred through is the male micro-USB to female USB, with the female micro-USB supplying the extra juice.

Getting everything connected

Powered OTG with USB Drive

Once you have your cable, you can connect the components. I've mounted my 16 GB thumb drive to my Nexus 4, and attached an external battery pack that provides an output of 5 volts. If you don't have a battery pack and don't need to be mobile, using a wall outlet for power works just as well.

The modified interface

Mount USB Storage in Settings

Thanks to ziddey's modified framework, no additional app is needed to mount USB storage. Just go into Settings and then Storage, and tap "Mount USB Storage".

Mounted USB Storage

Once mounted, you can see how much total space your drive has as well as how much free space is available. Make sure to tap "Unmount shared storage" before disconnecting your drive to avoid corrupting any files.

Working with external storage

Files in mounted USB drive

To access the files on your USB drive, use your favorite file manager to navigate to "/storage/usbdisk0/". Everything on your USB drive will be accessible as if it were on your phone's internal storage.

Playing music from USB drive

When you connect a USB drive, your media library will automatically be rescanned. This means if you have any movies or music on the drive, they will immediately show up in your media player, and can be played without having to copy them to your phone.

USB accessories

OTG mouse

Thumb drives are great, but peripherals are where the fun's at. Here I've connected my $5 laser mouse in place of the USB drive. Notice the extra settings that appear under Language & Input. A mouse pointer is great to have if you need more precision than what touch input can provide.

OTG keyboard

Full sized keyboards work great too. Connecting one will also give you some extra settings, as well as a notification as long as you have it plugged in. I never considered the possibility of writing a novel on my phone, but it's nice to know if my laptop ever gets stolen it won't slow my Word docs down.

The wrap-up

So far ziddey has done an amazing job with the usability of this mod. I've yet to come across anything that would prevent daily usage. The phone charges fine, USB works great, and I've yet to see any force closes or instability. One minor annoyance with the current version of this mod is a notification you get after unmounting USB storage; the only way to clear it is to reboot the phone. Also, I've yet to get my Dualshock 3 controller working, but my mouse and keyboard work flawlessly.

It's still relatively early in the development of the Nexus 4's USB OTG capabilities. In just over a month, we've seen this project go from proof of concept to fully functional modification. It's too bad the Nexus 4 did not come with OTG working out of the box, but if the recent progress is any indication, we might have a factory quality solution in the near future.

A big thanks to ziddey and CaptainMuon!

 
There are 52 comments

deltatux says:

It is rather sad that the Nexus 4 doesn't supply +5V in its USB connector, the previous Nexus phones did. Here's hoping Google will include it again in the next generation Nexus phone.

thla says:

I'm pretty sure it wasn't absent on purpose.

crxssi says:

?? Of course it is absent on purpose. And Google also intentionally removed USB mounting stuff. AND they intentionally removed the SD card slots from all the Nexus devices. And they spec'ed the Nexus 4 with a ridiculously small amount of onboard storage.

Google is pushing a consumer-hostile strategy by trying to "encourage" everyone to store everything in Google's "cloud". There can be no other reason, because storage is *CHEAP* and while CPU speed, GPU speed, memory capacity, and screen resolution are all going up and up, Google's device's storage went DOWN.

Weirdo0815 says:

Ya know, I vaguely remember hearing that Apples are very good this time of year... and they come in 16, 32, and 64 GB flavors! Who knows, maybe they are genetically engineering a 128 GB flavor just for people like you!

Suntan says:

Stop being a dink.

There's a lot of us out here that like Android but don't like some of the things we're seeing coming out of Google.

-Suntan

Uma100 says:

Great work!! For me this is important, I always have a usb with me that I take for my holidays with my movies, videos, music...all I need for entertainment without having to use the phone's limited storage. Where I go on holidays not necessarily I have Internet connection to use the goolgle cloud, dropbox ..etc or the connection can be too poor so this can be a hassle. I got my nexus 4 because I got a good deal and I like it but if there is people working to improve its features to bring a factory solution.... or there are any upgrades I can make in the future I am very happy. Thanks again and I hope this materializes.

lightyear420 says:

"This is no simple app install"

It's not??? Last I checked, flashing a zip in recovery is about as elementary as it gets! 7:|

If you're rooted and deodexed, but don't know how to flash a simple zip file, please do us all a favor and just step away from your keyboard for the rest of your life, because the online android community is NOP for you!!

dwhall says:

Have to love the elitest attitude of some people in various communities. Your comment was uncalled for.

Jay Holm says:

I agree dude, a lot of people are rude!

FreudSlipped says:

He has Nick Burns syndrome. http://m.youtube.com/watch?v=ETYThmhPLRc

MERCDROID says:

Some of us actually have lives outside of a computer screen. You should try it sometime.

johnnyi1222 says:

If you're going to spout crap like that, at least how to spell and/or type correctly. Or you could just step away from the keyboard for the rest of your life.

jj2339 says:

I am very sad that Android is now NOP for me. Apparently English and manners and typing are NOT for you though.

moosc says:

Simplest solution 1tb WiFi hard drive. That's how to share between multiple devices. And no root required.

DaVince says:

Oh yes, right. I guess I'll just throw away my portable USB thumb drives then. I'll just buy the bigger and more powerful 1 Tb wifi drive since I have so much cash lying around anyway. I guess I just need to figure out how to make something so powerful work without a power outlet.

JK. I guess that'll work if you're at home all the time without a need for portability.

Jay Holm says:

I would ready like to see this functionality built right into the Android OS! Imagine being able to dock a Monster phone like the Note 2, and connect a real keyboard and type, for real, that would be ready nice!

cj100570 says:

I'm not sure if you're being serious or taking a stab at the Nexus 4.

The Note II comes with this ability straight out the box; http://www.youtube.com/watch?v=A9MSX10RZRE&list=WL9AF838F8B2453C3D

clubbtraxx says:

Works a charm on my HTC One S, no root required.
Just plug an OTG cable and connect storage, mice keyboards and what not.

The USB port has limited power output ofcourse so be sensible ;-)

TenshiNo says:

Dude. It *is* built right into the OS. The problem here is the Nexus 4, not Android. Get an OTG cable and plug in a USB keyboard to your Note 2 and it will most likely work. My Note 2 even works with the wireless dongle from my Logitech keyboard/mouse combo.

Doesn't the Nexus Media Importer App with an OTG cable and either a flash drive or SD card reader work on a Nexus 4 (NO ROOTING REQUIRED)?

I currently use the importer app on both my Samsung Galaxy Nexus Smartphone and my Nexus 7 and it works great. I don't have to anything to either device outside of installing the Nexus Media Importer app from the Google Play Store.

MrCheesecake says:

Was about to say exactly the same thing, works for me:

https://play.google.com/store/apps/details?id=com.homeysoft.nexususb.imp...

kenkiller says:

Do you have a Nexus 4?

1031Vulcan says:

"This app is incompatible with your AT&T LGE Nexus 4."

The dude you replied to said he used it with his Galaxy Nexus and Nexus 7. Not a Nexus 4.

kenkiller says:

Go get a Nexus 4 and you'll realize that it's not that simple anymore.

kenyee says:

FWIW, the Samsung Galaxy III supports USB OTG out of the box. I've connected USB flash drives to it w/o problem.
It also supports USB DACs out of the box.

I'm surprised the Nexus 4 doesn't...seems like a major oversight when even the N7 could do it :-P

In the case with Nexus 7, you can connect mouse or keyboard with the OTG cable out of the box.
But to read Flash Drive, it has to be rooted.

warthog293 says:

Learn what you are talking about, you don't need to be rooted to read a flash drive on the N7. I do it all the time, it will even read my 1TB hard drive. All you need is the Nexus Media Importer app

vinny jr says:

I use to be a Nexus nut, everything was a Nexus or I wouldn't even look at it. When I seen the Nexus 4 was limited to only 16mb of storage I figured they must at least support the USB OTG storage, then I found out they didn't. I was really pissed off at Google for limiting the phone with shit for storage and no ext possibilities either. I said screw it no more Nexus for me, My SGS3 supports that and I have 32gb of int storage and sd card support. I also have CyanogenMod flashed on my phone so in reality I have the better Nexus phone with unlimited storage. The Nexus brand is killing themselves, they shot themselves in the ass, many, many people didn't buy that phone for that reason, no storage. I would like nothing better than for Nexus to come back with a new phone with enough int storage that makes the phone usable in my eyes. I need certain files on my phone at all times and the cloud just doesn't cut it. Give the Nexus some juice, give it storage and the phone will sell off the shelves.

Mak K says:

What I am a little confused on is the cost. Looking at your set up, it would run about $40. Wouldn't it be better to just spend the $50 extra to get the 16 GB version of the phone if you do not have the cable and the battery, let alone the right size flash drive. that is, if you have to add in the flash drive, maybe this is over spending for the ability to read from a flash drive? In photos it just seems cumbersome and klunky to work around this. While I think it is good it is possible, when I started adding up the cost, I was starting to think the value might not be there unless you can explain why this is worth considering.

Also what does this allow me to do? that is, aren't there an APP or two that allow me to read from the USB drive without rooting or is this just for the tablets?

When streaming music or a movie from the flash drive, how much power is drawn from the back up battery and how long will it last If I am correct, yours is 5200 mA?

Thanks

Francois Roy says:

So many questions, so little interest..

Ok I'll do an effort.

1- If one's already got the 16gb model, you just can't add 50 more bucks to get extra storage. Neither can you plug in mices and keyborads. That's why.
It is cumbersome and clunky.
The point is it's always better to have an option.

2- People shouldn't buy a Nexus 4 if they are afraid of rooting, period. If you don't feel comfortable and/or able of customizing your own experience, simply make sure the phone you buy provides everything you need out of the box.
You don't even know what you'd do with it.
Why bother?

3- Normal USB devices shouldn't suck more than 500mA @ 5v. Draw your own conclusions.

Casey Rendon says:

I already owned everything pictured, besides the $10 Y-cable, so cost was not an issue for me. Everyone will find different uses for OTG, from accessing large amounts of movies/music for long trips, being able to copy files from a flash drive to your phone without a computer, or connecting accessories.

No app alone provides OTG functionality for the Nexus 4, hence the need to modify your Android software.

I've never tried running my battery until dead, but if you want your power supply to last a long time there are much larger batteries than the one I used available online.

Jay Soto says:

Weird. My friend's S3 does it by default on stock rom.

return_0 says:

This isn't really worth it for me as I don't need extra storage, but it's nice to see someone has found a way to use USB OTG on the N4.

Gearu says:

Epic click bait pic.

Suntan says:

Agreed. When I read you had to have external power I scrolled back up to look at the picture again... ...then I went, "Aha.... Shifty."

-Suntan

Kvoth says:

Great article but a few questions:

1) Does the flash drive need to be ext4 or can it read ntfs?
2) Why does it need to be a deodexed ROM? The XDA thread says "It is built on Franco's M1 milestone kernel (thanks Franco), and should work with any 4.2.2 rom"
c) What kind of transfer speed does it have? Enough to stream a ~5GB 720p movie?

Weirdo0815 says:

Its amazing how many people are pissed at Google for not making a 32GB+ Nexus 4. Or not having a Micro SD card slot. Or not having OTG built in. Or not having their phone make them breakfast in the morning...

Seriously, I understand disappointment in a product not being as expected or as you want it to be (looking at you, my old Blackberry Curve). Thankfully Google was up front about the storage amounts available and the absence of a MicroSD and OTG in the Nexus 4. Its not like you purchased the phone expecting it to magically have 128GB of internal storage and 4 MicroSD slots... I hope...

And there are plenty of options to choose from when you want an Android phone; find a phone that works for you and be happy with it.

My comments are in no way directed at the author, but instead to all the "Google sucks because I didn't get a Galaxy S3 equivalent in a $300 Nexus 4" people.

Suntan says:

Its amazing how many people are apologists for Google not making a 32GB+ Nexus 4...

None of us would have an issue if this was a $300 phone from Sony.

This is supposed to be a phone that shows the design direction and intent for all other Android device makers to emulate. Presented directly by Google. We're not complaining because this is only one of *many* options. We're complaining because this is Google making choices about the direction Android is going and we don't agree with it.

-Suntan

jteesy says:

I wholeheartedly agree. And to take it a step or two further, I'm amazed that there's so many people who keep saying that there are lots of options. There AREN'T a lot of options for similarly speced, unlocked, flagship devices. I have an N4, and for the most part love it. Of all the gripes leveled at it, the one that can't be easily worked around is the storage. Having a 720p 4.7" screen, but not having the on board (or OTG) storage options to take full advantage of it, is pretty annoying. Nevermind the limitations on keeping music, other large files, etc. on board. Sure, the cloud and video streaming are an option, but it's a waste of bandwidth (assuming you have a suitable connection at all). There's a sweet spot for on board storage these days, and 16GB isn't it any more than 1TB would be. The N4 is heavily subsidized...I get that, but I think most people would rather at least have the option to spend more for usable storage, and absent that have the option of OTG without having to root.

cobrakon says:

+1 To Casey for the TRON soundtrack. Daft Punk FTW!

:-)

jpothorst says:

The ability to use keyboard and mouse is nice but what if you could read/write to your internal storage via http?

https://play.google.com/store/apps/details?id=com.dooblou.WiFiFileExplorer

YaSo says:

Is there such a cable to have a normal male USB (power in), female USB (out to thumbdrive), and male microUSB? (to phone) I've got a bunch of small battery packs and it would be convenient to plug in the cable directly to my N4, the battery pack, and thumbdrive without having to also spool up a micro to normal USB cable in my jacket pocket.

Though I was upset when I found out the N4 won't support OTG natively, since T-Mo upgraded me to 'unlimited' interwebz ($70 a month) I cloudified most of my music.Now I've got a decent amount of space open on the phone. The ability to quickly share files from my phone to another's is the main reason I'd want to use OTG now.

(My friends keep losing my thumbdrives)

(Oh, and a co-worker's brother got a $300 8gb N4, will never bother to root it, streams his music and videos and is very happy with it. Different uses for different folks)

japxbo says:

I have heard about not having calls if you do this on 4.2.2, is this true? If nothing happens to the phone ill do it. Anyone has tested it on 4.2.2? Thanks :)

Gee the audio jack has power why not make an app that passes the correct current of power the otg cable like the y cable. Mixed into a case.

Hi! Does anybody know if the mod works with midi keyboard?Thanks!

swawif says:

Hello guys! Does anybody can do this hack without using the cyanogenmod? i don't really like the mode, i prefer the stock JB.

Cheers!

MMOBYTES says:

2 Q's,

Can you install/play games to the OTG USB drive?

And, that is alot of wires! Is it at all possible to do this over bluetooth? Bluetooth microsd device?

ericski2112 says:

Would this setup work with a WD 2TB portable drive? I know I would need the adapter. What kind of portable battery pack would I need (brand, amps, etc...) I couldn't find any any as to how much power my portable drive would need...

Please help!!!

Can this work on a Samsung Epic 4g Touch?

regoldo says:

Does not work with 4.3

shikhar623 says:

in a video on youtube i saw nexus 4 connected
to the pendrive and other peripherals without
any extenal power source. he had used a simple
OTG cable. how to do that??
-Shikhi

Octaviannn says:

hey everyone I need some help with this. i know that i can do this also without changing kernel, on stock. i just need ziddey's otg hack. could someone please help me, i just need this installed
thank you!

Sent from my Nexus 4