Enable Native OTG usb easily in KitKat 4.4

Search This thread

webdroidmt

Senior Member
Dec 20, 2011
1,674
1,156
NJ
***THIS FIX APPLIES ONLY TO THE NEXUS 7 (2012) 1ST GEN TABLET***

EDIT 12/30/13*** This vold fix is no longer needed on any CM based or SlimKat roms. A patch has been merged in CM upstream. ***

http://forum.xda-developers.com/showpost.php?p=48974402&postcount=2892


There seems to be some confusion regarding native OTG usb with KitKat roms. In the transition from 4.3 to 4.4, roms like CM or Slim that used to have native OTG lost that capability. I had discussed this briefly with fattire in his "How to build" thread and it appears that something was changed in the vold binary, that ended up breaking native OTG usb. I believe that a vold commit or commits in CM are the culprit and hopefully, someone much more knowledgeable than I will be able to solve this with a revert of the commit, or a patch. EDIT: It now appears that this can be fixed with edits to the CM ramdisk. See here for XDA Recognized Contributor Temasek's patches submitted for approval to CM Gerrit. EDIT: Merged as of 12/30/13 . http://forum.xda-developers.com/showpost.php?p=48746670&postcount=113

Native OTG usb means not having to use an app like stickmount or OTG helper. With native OTG, you can mount and unmount usb storage from within settings/ storage. If your flash drive is plugged in at boot, it will automatically be recognized by the OS in settings/storage and various apps. Additonally, in settings/storage and file managers, you will be able to see the correct total and available space for your flash drive. In applications such as file managers and TB, your flash drive will be automatically recognized and show up as usbdisk.

FYI, stock and stock based roms do not have native OTG capability. These type of roms must use an app like stickmount. This is also true of Omnirom, as it uses the same storage setup of a stock rom.

Anyway, I'll stop rambling and get to the point. :D Through trial and error, I found that by substituting the vold binary in 4.4 with the one in 4.3 roms it worked just as it did in 4.3. So, I made a zip that will provide a fix for native OTG until it gets fixed in CM upstream.

Here is a link to my original post in fattire's thread with download links to the appropriate vold fix zipfile, either CM11 or SlimKat. Simply flash this over your rom and you've got native OTG, that's it! Of course, you'll have to flash this everytime you flash a new rom or update the rom.
http://forum.xda-developers.com/showpost.php?p=47564220&postcount=1665

Again, this does not work with stock or stock based roms, as they have a different storage setup. This will work with all current CM based roms, as well as SlimKat. Here's a list of roms that I tested on and all worked. I have a grouper but it should also work on any CM based rom as well as SlmKat for tilapia, as it uses the same storage.
Official CM11
Unofficial CM11 by koko98
Unofficial CM11 by swordrune10
Unofficial CM11 by Temasek- no longer requires vold fix-native OTG now works right out of the box!
Unoffiical CM11 by Zeljko1234 - no longer requires vold fix-native OTG now works right out of the box!
Unofficial CM11 by (Skanky) makelegs
BS Harmony CM 4.4 by mar5hal
Vanir KitKat betas
SlimKat 4.4/4.4.1/4.4.2

EDIT 12.25: Franco kernel r76 fixed by Osmosis for CM11 now works right out of the box and no longer requires vold fix. http://d-h.st/aZY

Note: For CM11 4.4.1/4.4.2 roms, (builds from Dec 07 and later) this will not work unless you also flash a custom kernel with a CM compatible ramdisk. M-Kernel and Lean Kernel have been tested and they both currently work. See post # 6 in this thread.

This works! If it doesn't work for you, something else may be wrong with your setup ie; OTG cable, flash drive, or N7 usb port. For NTFS support, you will need a third party app like stickmount etc.

Mike T
 
Last edited:
I'm sure it's obvious to more experienced people, but I had to turn off zipfile verification in TWRP in order to flash this fix. Cute thing: maybe I have OTG fever, but this OTG fix installs fine using OTG in TWRP :) In fact I found flashing the kitkat rom & gapps zip from a USB stick beats fiddling with hugely temperamental ADB drivers on my windows 7 setup.. Thanks for making this available, stickmount uninstalled for good now.
 
  • Like
Reactions: webdroidmt

webdroidmt

Senior Member
Dec 20, 2011
1,674
1,156
NJ
I'm sure it's obvious to more experienced people, but I had to turn off zipfile verification in TWRP in order to flash this fix. Cute thing: maybe I have OTG fever, but this OTG fix installs fine using OTG in TWRP :) In fact I found flashing the kitkat rom & gapps zip from a USB stick beats fiddling with hugely temperamental ADB drivers on my windows 7 setup.. Thanks for making this available, stickmount uninstalled for good now.

Glad it has been beneficial for you. :) I can't do without OTG and I also flash pretty much everything in TWRP from my USB flash drive. Although it's not a big deal to flash this zip, I'm hoping that the smart guys from CM eventually get this fixed.

Mike T
 
  • Like
Reactions: sengit

bland.life

Senior Member
Oct 21, 2010
661
117
iron2000.deviantart.com
Is this only for Grouper?
Flashed it on Flo, desperately hoping it will work but did not.


Ok, changed the vold file to the one in Flo's CM10.2 and also changed the updater-script to use busybox.
And it worked!
 
Last edited:

webdroidmt

Senior Member
Dec 20, 2011
1,674
1,156
NJ
Is this only for Grouper?
Flashed it on Flo, desperately hoping it will work but did not.


Ok, changed the vold file to the one in Flo's CM10.2 and also changed the updater-script to use busybox.
And it worked!

Glad you got it working but yeah, this was meant for Nexus 7 1st gen, grouper/tilapia. That's why it's posted in the N7 1st gen forum. ;) Good that you took a chance and applied the same principle of the CM vold binary to Flo, as you had nothing to lose but something to gain. :D

Mike T
 
Last edited:

webdroidmt

Senior Member
Dec 20, 2011
1,674
1,156
NJ
Looks like this workaround does not work with CM11 Official/Unofficial android 4.4.1. I think something has changed in the CM11 stock ramdisk in builds starting from Dec 07. If you still want to use this workaround, you need to use a custom kernel with a ramdisk that is compatible with CM11.

I have tested with M-Kernel a64 (should also work with a65) and Lean Kernel 3.0 and it works. These kernels could also stop working in future releases if they make changes to their ramdisk similar to CM but for now they do work.

M-Kernel: http://forum.xda-developers.com/showthread.php?t=2168787

Lean Kernel: http://forum.xda-developers.com/showthread.php?t=1950858

So to be clear, on CM builds of 12/07 or later, you need to flash both the 4.3 vold binary zipfix and a custom kernel, either M-Kernel or Lean Kernel. This works and will work until CM either fixes it so we don't need it, or breaks it again with commit or two. :laugh:

Mike T
 
Last edited:

dcpathak

Senior Member
May 22, 2012
243
22
USB OTG for 4.3 Stock based rom

Hi,
I'm using drketan's V6 hybrid rom on my note 2 and I do not see USB OTG support here. It was there till some previous version (v3) for the same rom. Is there any way, any app so that I can enable usb otg support again?
 

webdroidmt

Senior Member
Dec 20, 2011
1,674
1,156
NJ
Hi,
I'm using drketan's V6 hybrid rom on my note 2 and I do not see USB OTG support here. It was there till some previous version (v3) for the same rom. Is there any way, any app so that I can enable usb otg support again?

Sorry, you're in the wrong forum. This fix is only relevant for the Nexus 7 running CM based KitKat 4.4 roms. You should be asking your question in this Note 2 forum thread http://forum.xda-developers.com/showthread.php?t=2472270 and I see you already have asked in that forum.

Either wait for an answer, or ask in that forum/thread again.

Mike T
 

Suxsem

Senior Member
May 14, 2010
297
346
hi, can i ask you if this work with:

leankernel 3.1
and
Kang-aroo 1.1
?

cause i don't have my nexus 7 at the moment. i think that leankernel 3.1 may not work because i read from changelog: ramdisk: merged latest cm-11.0...
 

dilzo

Senior Member
Apr 24, 2011
540
39
Hey webdroidmt, basically I'm on BS Harmony rom and whenever I flash this successfully however whenever I try to mount my usb drive all that happens is that it gives a notification and just stops. The usb works with my computer just fine however whenever I try stick mount it gives me mount server is busy error so I'm thinking it's the tablet.
 
Last edited:

webdroidmt

Senior Member
Dec 20, 2011
1,674
1,156
NJ
@Suxsem

I thought the same thing but it worked for me with Lean 3.1. Sorry, don't know about Kangaroo...cool name Kangaroo. LOL

@dilzo

For it to work with Harmony, you also need to flash a custom kernel, M-Kernel or Lean Kernel due to the changes made in stock CM kernel ramdisk.


However, soon none of this may be needed. XDA Recognized Contributor Temasek, who has an awesome CM11 build for both grouper and tilapia, has submitted a patch to CM Gerrit that is currently under review.
http://forum.xda-developers.com/showpost.php?p=48746670&postcount=113

Hopefully, it will be approved and merged soon and all CM11 based roms will have proper working native USB OTG right out of the box. It has been working on Temasek's CM11 for tilapia for a couple of weeks already. I also tested the fix with his CM11 build for grouper and it worked great.


Mike T
 
Last edited:
  • Like
Reactions: temasek

MaD_Stinger

New member
Jan 14, 2014
1
0
Write_external_storage

After the patch was merged I was still having problems with applications having access to my external storage. Specifically titanium backup. The following helped. The end goal being to modify /system/etc/permissions/platform.xml under "android.permission.WRITE_EXTERNAL_STORAGE" with the following, in that specific order.

<group gid="media_rw" />
<group gid="sdcard_r" />
<group gid="sdcard_rw" />



sed -e '/WRITE_EXTERNAL_STORAGE" >$/N;s/\n\(\([ \t]*\)<group gid="sdcard_rw".*$\)/\n\2<group gid="media_rw" \/>\n\1/' -i /system/etc/permissions/platform.xml

http://forum.xda-developers.com/showthread.php?t=1458021
 

dtlove74

Member
Dec 6, 2010
22
9
After the patch was merged I was still having problems with applications having access to my external storage. Specifically titanium backup. The following helped. The end goal being to modify /system/etc/permissions/platform.xml under "android.permission.WRITE_EXTERNAL_STORAGE" with the following, in that specific order.

<group gid="media_rw" />
<group gid="sdcard_r" />
<group gid="sdcard_rw" />



sed -e '/WRITE_EXTERNAL_STORAGE" >$/N;s/\n\(\([ \t]*\)<group gid="sdcard_rw".*$\)/\n\2<group gid="media_rw" \/>\n\1/' -i /system/etc/permissions/platform.xml

http://forum.xda-developers.com/showthread.php?t=1458021

Thanks!
This worked for me just editing the file and adding the line(s) that was missing (making sure the end result matched what you had there). I did have to reboot afterwards to get it to work (but perhaps that's a given?)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 8
    ***THIS FIX APPLIES ONLY TO THE NEXUS 7 (2012) 1ST GEN TABLET***

    EDIT 12/30/13*** This vold fix is no longer needed on any CM based or SlimKat roms. A patch has been merged in CM upstream. ***

    http://forum.xda-developers.com/showpost.php?p=48974402&postcount=2892


    There seems to be some confusion regarding native OTG usb with KitKat roms. In the transition from 4.3 to 4.4, roms like CM or Slim that used to have native OTG lost that capability. I had discussed this briefly with fattire in his "How to build" thread and it appears that something was changed in the vold binary, that ended up breaking native OTG usb. I believe that a vold commit or commits in CM are the culprit and hopefully, someone much more knowledgeable than I will be able to solve this with a revert of the commit, or a patch. EDIT: It now appears that this can be fixed with edits to the CM ramdisk. See here for XDA Recognized Contributor Temasek's patches submitted for approval to CM Gerrit. EDIT: Merged as of 12/30/13 . http://forum.xda-developers.com/showpost.php?p=48746670&postcount=113

    Native OTG usb means not having to use an app like stickmount or OTG helper. With native OTG, you can mount and unmount usb storage from within settings/ storage. If your flash drive is plugged in at boot, it will automatically be recognized by the OS in settings/storage and various apps. Additonally, in settings/storage and file managers, you will be able to see the correct total and available space for your flash drive. In applications such as file managers and TB, your flash drive will be automatically recognized and show up as usbdisk.

    FYI, stock and stock based roms do not have native OTG capability. These type of roms must use an app like stickmount. This is also true of Omnirom, as it uses the same storage setup of a stock rom.

    Anyway, I'll stop rambling and get to the point. :D Through trial and error, I found that by substituting the vold binary in 4.4 with the one in 4.3 roms it worked just as it did in 4.3. So, I made a zip that will provide a fix for native OTG until it gets fixed in CM upstream.

    Here is a link to my original post in fattire's thread with download links to the appropriate vold fix zipfile, either CM11 or SlimKat. Simply flash this over your rom and you've got native OTG, that's it! Of course, you'll have to flash this everytime you flash a new rom or update the rom.
    http://forum.xda-developers.com/showpost.php?p=47564220&postcount=1665

    Again, this does not work with stock or stock based roms, as they have a different storage setup. This will work with all current CM based roms, as well as SlimKat. Here's a list of roms that I tested on and all worked. I have a grouper but it should also work on any CM based rom as well as SlmKat for tilapia, as it uses the same storage.
    Official CM11
    Unofficial CM11 by koko98
    Unofficial CM11 by swordrune10
    Unofficial CM11 by Temasek- no longer requires vold fix-native OTG now works right out of the box!
    Unoffiical CM11 by Zeljko1234 - no longer requires vold fix-native OTG now works right out of the box!
    Unofficial CM11 by (Skanky) makelegs
    BS Harmony CM 4.4 by mar5hal
    Vanir KitKat betas
    SlimKat 4.4/4.4.1/4.4.2

    EDIT 12.25: Franco kernel r76 fixed by Osmosis for CM11 now works right out of the box and no longer requires vold fix. http://d-h.st/aZY

    Note: For CM11 4.4.1/4.4.2 roms, (builds from Dec 07 and later) this will not work unless you also flash a custom kernel with a CM compatible ramdisk. M-Kernel and Lean Kernel have been tested and they both currently work. See post # 6 in this thread.

    This works! If it doesn't work for you, something else may be wrong with your setup ie; OTG cable, flash drive, or N7 usb port. For NTFS support, you will need a third party app like stickmount etc.

    Mike T
    2
    Looks like this workaround does not work with CM11 Official/Unofficial android 4.4.1. I think something has changed in the CM11 stock ramdisk in builds starting from Dec 07. If you still want to use this workaround, you need to use a custom kernel with a ramdisk that is compatible with CM11.

    I have tested with M-Kernel a64 (should also work with a65) and Lean Kernel 3.0 and it works. These kernels could also stop working in future releases if they make changes to their ramdisk similar to CM but for now they do work.

    M-Kernel: http://forum.xda-developers.com/showthread.php?t=2168787

    Lean Kernel: http://forum.xda-developers.com/showthread.php?t=1950858

    So to be clear, on CM builds of 12/07 or later, you need to flash both the 4.3 vold binary zipfix and a custom kernel, either M-Kernel or Lean Kernel. This works and will work until CM either fixes it so we don't need it, or breaks it again with commit or two. :laugh:

    Mike T
    1
    I'm sure it's obvious to more experienced people, but I had to turn off zipfile verification in TWRP in order to flash this fix. Cute thing: maybe I have OTG fever, but this OTG fix installs fine using OTG in TWRP :) In fact I found flashing the kitkat rom & gapps zip from a USB stick beats fiddling with hugely temperamental ADB drivers on my windows 7 setup.. Thanks for making this available, stickmount uninstalled for good now.
    1
    I'm sure it's obvious to more experienced people, but I had to turn off zipfile verification in TWRP in order to flash this fix. Cute thing: maybe I have OTG fever, but this OTG fix installs fine using OTG in TWRP :) In fact I found flashing the kitkat rom & gapps zip from a USB stick beats fiddling with hugely temperamental ADB drivers on my windows 7 setup.. Thanks for making this available, stickmount uninstalled for good now.

    Glad it has been beneficial for you. :) I can't do without OTG and I also flash pretty much everything in TWRP from my USB flash drive. Although it's not a big deal to flash this zip, I'm hoping that the smart guys from CM eventually get this fixed.

    Mike T
    1
    @Suxsem

    I thought the same thing but it worked for me with Lean 3.1. Sorry, don't know about Kangaroo...cool name Kangaroo. LOL

    @dilzo

    For it to work with Harmony, you also need to flash a custom kernel, M-Kernel or Lean Kernel due to the changes made in stock CM kernel ramdisk.


    However, soon none of this may be needed. XDA Recognized Contributor Temasek, who has an awesome CM11 build for both grouper and tilapia, has submitted a patch to CM Gerrit that is currently under review.
    http://forum.xda-developers.com/showpost.php?p=48746670&postcount=113

    Hopefully, it will be approved and merged soon and all CM11 based roms will have proper working native USB OTG right out of the box. It has been working on Temasek's CM11 for tilapia for a couple of weeks already. I also tested the fix with his CM11 build for grouper and it worked great.


    Mike T