yashsingh1/xdaforums huggingface dataset:
[Nexus 4 Original Android Development] trybal057:
Thanks for the work and easy instructions, only problem I had was I had to make my own USB y cable, which was pretty simple, I do have a question about the recoverymod, is that for accessing the USB drive while in recovery, so as to flash zips held on a flash drive, cause if that's the case I'll have a different ROM for different times of the day.
[Nexus 4 Original Android Development] ziddey:
`For support in recovery, I've created a sort of "any-any" script. It replaces the recovery's kernel with the boot one. Therefore, by flashing this after the main patch, OTG will effectively be enabled in recovery (after a reboot). However, it is on the actual recovery itself to provide support for usb drives-- TWRP does. Otherwise, you'll have to manually mount any drives via linux console commands.`
[Nexus 4 Original Android Development] ziddey:
4.3: 2013.10.22 2201ET r191: [JWR] [JSS/JLS]

4.3: 2013.10.22 2204ET r191-CM: [JWR] [JSS/JLS]

I modified the code for automatic host mode to allow for potentially faster charging. As well, I re-added the code for manual host mode.

Also available are two versions with the required commits for recent CM builds (and its derivatives). init.rc was updated to support the current 10/22 nightly.

Make sure you download the right one..

As a note, the changes are very minor (and it's still based on r191), so it may not be worth flashing unless you require its features (want to flash current CM nightly, suffer from slow host mode charging, or need manual host mode).

As well, if anyone on stock rom is currently using the stock otg build, please report on it. I haven't tested it myself, so I'm reluctant to put it in the first post. Thanks
[Nexus 4 Original Android Development] Sacob:
first of all thanks!

can i run the CM version with the latest PAC rom?
[Nexus 4 Original Android Development] ziddey:
I figured out how to support PAC, but won't be implementing it until the next build. For the time being, you can modify the zip so it works. Add this line to tmp/otgmod.sh after the gzip -dc... line:

sed 's/\(apache-xml.jar\)/\1:\/system\/framework\/framework-pac.jar/' -i init.rc

Refer to http://xdaforums.com/showpost.php?p=46748007&postcount=51 for negligibly more information.
[Nexus 4 Original Android Development] shikhar623:
is the power source really required??

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??

www.youtube.com/watch?v=gZwPgyiEb84
[Nexus 4 Original Android Development] ritchea:
This was posted end of September, 2012. Nexus 4 wasn't out yet. As many posters there commented, N4 needs power. Ake Exorcist replied that he used a powered hub (with N4? ). I did not watch entire video.
[Nexus 4 Original Android Development] karol1981:
Is this patched kernel (r191) working with roms based 4.3.1 ? Trying flash r191 JLS on Orca and PAC ,and roms not booting.
[Nexus 4 Original Android Development] prateek80:
Thats Samsung Galaxy Nexus (Nexus 3), Not Nexus 4. Galaxy Nexus supports USB OTG out of the box..:cool:
[Nexus 4 Original Android Development] BrockenX:
Would this work on a samsung galaxy tab 2 just asking i know this is for nexus but just curios if there is one for the tab
[Nexus 4 Original Android Development] prateek80:
This thread is just for the nexus 4. And most of the tabs like galaxy tab 2 supports usb otg out of the box you just need an otg cable to connect your usb devices...:good:
[Nexus 4 Original Android Development] shikhar623:
OTG working with Ext Power souce 〓 OTG not working. the whole idea of OTG is mobility , which the power bank defeats.

I am asking this Q coz someone (a reputed dev owning N4) told me that N4 needs a power source if I want to connect power N4 with ext HardDisk. While penddrives work even without the external power source.

Thanks.
[Nexus 4 Original Android Development] SpasilliumNexus:
Plain and simple, when it comes to the Nexus 4 and OTG, it doesn't matter what type of USB device you try to use, you need a power source. If you want to use OTG without it, get another device.
[Nexus 4 Original Android Development] ziddey:
4.3: 2013.10.26 2030ET r193: [JWR] [JSS/JLS]

4.3: 2013.10.26 2031ET r193-CM: [JWR] [JSS/JLS]

I don't keep track of all the different ROMs so it's on you guys to figure out which one is appropriate. The -CM builds have the two "CAF" commits that are now required for CM and its derivatives (unless they have specifically reverted the associated commits).
[Nexus 4 Original Android Development] activexda:
Hello ziddey

After I apply this patch I'll not be able to receive OTA updates, right?

And I have another question, what about using an otg y-cable with an application like stickmount, will that do the job??

Thank you in advance
[Nexus 4 Original Android Development] shikhar623:
You will be able to update normally after installing this Patch. Better install the updates and then install this patch. :good:
[Nexus 4 Original Android Development] activexda:
Actually I'm using the latest update (4.3) but I was talking about further updates :) (like 4.4)

But anyway if it is still possible to get the the OTA updates after flashing then I'll go with the "ziddey-otg-STOCK-10171957.zip"

Thank!
[Nexus 4 Original Android Development] ziddey:
Always lose OTA with ANY modification.

Sent from my phone. Please forgive typos and brevity.
[Nexus 4 Original Android Development] activexda:
Aha so I have to update my device manually. It will be great if there is some way to use USB otg without modifying the kernel, but anyway I'll try stickmount with otg y-cable and if it didn't work I'll flash this patch.

Thank you so much! :)
[Nexus 4 Original Android Development] bombadier:
[MENTION=584916]ziddey[/MENTION] have you seen that franco has reuploaded 193 JWR to fix a minor deadlock issue(Which I experienced once) and was wondering if you were going update?

Thanks in advance
[Nexus 4 Original Android Development] ziddey:
4.3: 2013.10.27 1518ET r193: [JWR]

4.3: 2013.10.27 1519ET r193-CM: [JWR]

Has the pertinent JSS commit reverted (i.e. no more deadlocks for JWR).
[Nexus 4 Original Android Development] karol1981:
I tried on AOKP and Wi-FI isnt working.
[Nexus 4 Original Android Development] ixbaderxi:
PC Connection

Hello,

After the installation of the version 193, I can not connect my mobile to my laptop. It only happen with the connection type MTP, because whe I try it with PTP works normally.

Do you know what's wrong with my device?

I'm using Paranoid Android 3.99 RC2 and Franco Kernel JWR 193.

Thanks in advance for your help.
[Nexus 4 Original Android Development] prateek80:
Have you tried enabling USB debugging in developers settings..?
[Nexus 4 Original Android Development] ixbaderxi:
Yes, is enable the USB debugging. I still having the issue :(

Other idea?
[Nexus 4 Original Android Development] keyra74:
no problem at all on PA + 193 :)
[Nexus 4 Original Android Development] ziddey:
^

Fine here with CM.

Verify what mode you're in. Navigate to /sys/kernel/debug/msm_otg and check the contents of chg_type and otg_state. You should see sdp charger and b_peripheral. Or you could watch your dmesg (# cat /proc/kmsg).

The OTG hack piggybacks off the detection of an Apple-compatible charger (proprietary) and should have no effect otherwise. Had it went on to set the charger type to proprietary (no OTG hack), it would have stopped further "initialization" of peripheral mode, so there would have been no MTP anyway. At the level we're dealing with (code/hardware-wise), there's no difference between MTP and PTP.
[Nexus 4 Original Android Development] ixbaderxi:
Hello ziddey,

I checked the files that you said.

chg_type contains the following text: USB_AC_DOCK_CARGER and the otg_state contains: a_host

If you said that not exist difference between MTP vs PTP I don't why my device is running only with PTP. Strange no?

Regards!
[Nexus 4 Original Android Development] ziddey:
Strange indeed. That's what I was kind of expecting-- I've received a few PMs about this in the past. Host mode doesn't get engaged until a proprietary charger has _already_ been detected. If you're interested in looking at the pertinent code, see https://github.com/ziddey/mako/commit/a78f59835568ffde6f1242f36be9a8b8c8d99da4

Let's take the scenario where there is no OTG hack-- the charger would then be set to proprietary. This is still not the required sdp charger (for mtp/ptp/etc). Up to this point, there's no differentiation among mtp, ptp, debugging, etc. The phone was simply trying to determine what it got plugged to. Next, we arrive at a conditional event. For a proprietary charger, it simply charges and does nothing else. For sdp, it then goes and starts the actual "usb device" process.

The code is fairly sound as far as this is concerned. So I don't understand why this is happening to you. Are you enabling force fast charge? Have you tried a different computer? Playing with the cable / trying a different one?

Chances are, the dmesg won't show anything new, but I'm still a little curious. The last person who PM'ed me actually had no intention of using host mode, but has the same problem you're describing. He tried manually setting peripheral mode, but without success.

Are you sure that everything else kept constant, it worked before the OTG mod?
[Nexus 4 Original Android Development] UnitedOceanic:
Hi all,

i am getting many msm_hsic_host wakelocks on carbon rom has anyone the same issue?
[Nexus 4 Original Android Development] ixbaderxi:
Hi again,

I made some test, all the test that I did was using the 4 usb ports that my laptop have.

First test:

I was using the fast charge, is disable now, also I change the cable, I check again the files and now I have the following texts:

chg_type: INVALIDAD_CHARGER

otg_state: b_idle

Second test:

I disable the fast charge, I'm using the same cable that used yesterday. The results:

chg_type: USB_SDP_CHARGER

otg_state: b_peripheral

Third test:

I disable the fast charge, I'm using other cable. The results are the same like the above.

chg_type: USB_SDP_CHARGER

otg_state: b_peripheral

Before the mod OTG was working fine, yestarday I said you that I'm using Franco Kernel, but I'm using Franco Kernel Plus, let me do other test with the Franco Kernel Nightly in order to know the results.

I will inform you.

PD. Sorry for my bad english.

Regards.

*******************Update*******************

I changed the Kernel for the Nightly, but I have the same results, only the PTP is working =/, also I re-install the driver. I did the following steps to install:

1. Wipe cache

2. Wipe dalvik cache.

3. Install the Kernel Nightly

4. Install the Ziddey Patch

I need to do something else?

Thanks
[Nexus 4 Original Android Development] mefistos:
Ziddey sorry to bother you but what's the difference between the last two kernels you released.. I am goin to get CM so I need them retarded CAF stuff they added
[Nexus 4 Original Android Development] MidtownHD:
Re: [OTG] [19MAR13] [DIRTY HACKS] Externally Powered USB OTG (Seeking Devs)

You should post these questions on the right subforum/thread. 2 complete different devices, with different internals.
[Nexus 4 Original Android Development] ziddey:
2013.03.23 2000ET: ziddey-otg-03231951.zip No new changes to OTG. Bumped kernel build number from #1 to #105 for compatibility with Franco's app. Minor revision to update scripts.

Franco's app now allows setting usb fast charge, gamma control, and whatever else might have been missing before.
[Nexus 4 Original Android Development] Arunabh:
Re: [OTG] [23MAR13] [DIRTY HACKS] Externally Powered USB OTG (Seeking Devs)

You guys are epic!!

Hats off really.ive been following you guys from captainmoun's thread and the amount of effort and brains you put behind this is amazing.

I'll be getting my cable today so im going to test this!!

Thank you guys.(especially ziddey)

PS: i dont wanna seem to be demanding here but are you trying to get this to work without supplying external power!!

IF i could donate i would really realllyyy do it but im only a student and dont have a cc or anything! Sorry..( i want to i swear).

Great effort!
[Nexus 4 Original Android Development] RussianCode:
Does anyone know if this will work with a Optimus G Converted to a Nexus 4? The Optimus G should have enough power to supply a USB Stick. Meaning no Y Cable needed. Thanks for any input.
[Nexus 4 Original Android Development] ziddey:
What's your source for this information? You have usb host mode working on an Optimus G rom?
[Nexus 4 Original Android Development] sixaxis94:
Firstly, great job on this! I'm getting an 8 gig version soon, sadly, and this would really help me a lot. But unfortunately I can't find the externally powered USB OTG cables in my country. So before I sit down and make my own cable, I had a question about how you get the power. Is the third end a standard USB end or is a micro USB end such that my stock wall charger is enough to power it instead of having to plug into my laptop?

And I know I shouldn't ask questions related to ETAs but are you by any chance working on a way to plug in smaller USBs (like 4 gigs or less) without external power?
[Nexus 4 Original Android Development] RussianCode:
Saw on multiple Forums and News threads that the Optimus G does have support. Or are they wrong? Still could not find anything Official though. Currently my phone is converted and really would like to keep it that way, that's why I can't use a Optimus G Stock Rom.
[Nexus 4 Original Android Development] :
Re: [OTG] [23MAR13] [DIRTY HACKS] Externally Powered USB OTG (Seeking Devs)

This is an amazing development. Hats off to you guys.
[Nexus 4 Original Android Development] MariusWildfire:
nice work!

but can i flash this on my nexus 4 with matr1x 8.0 kernel aswell?
[Nexus 4 Original Android Development] Roastmeat:
I'm wondering, would this work if I inject 5V (9V battery via 5V regulator) into the USB OTG cable?

Making this portable would be awesome.
[Nexus 4 Original Android Development] scream4cheese:
I found the article on AndroidCentral and it led me here.

http://www.androidcentral.com/android-advanced-usb-otg-nexus-4

Good job by the way. I tried it and it works.
[Nexus 4 Original Android Development] KarloHD:
AW: [OTG] [23MAR13] [DIRTY HACKS] Externally Powered USB OTG (Seeking Devs)

Does it work with the CarbonRom? Sorry for my English.

Vom Nexus 4 Gebeamt CarbonRom
[Nexus 4 Original Android Development] ritchea:
Gosh, try it.
[Nexus 4 Original Android Development] KarloHD:
AW: [OTG] [23MAR13] [DIRTY HACKS] Externally Powered USB OTG (Seeking Devs)

Can I use the cable as well, With the CarbonRom?Sorry for my English.

Vom Nexus 4 Gebeamt CarbonRom
[Nexus 4 Original Android Development] ziddey:
Sure it would work. The phone doesn't know or care what the power source is.. as long as it's getting 5V. The problem though is that the phone will go into charging mode, and will kill your 9V battery in short order. Perhaps you could incorporate something that would let the phone see 5V but not actually be able to draw any current. Otherwise, you could use /sys/kernel/debug/msm_otg/mode to force non-charging host mode, but of course, there are caveats to using that method. I may look into fixing that method in the future / creating some sort of widget to toggle mode, but it's not a priority at the moment. Plus, I've never actually done any Android programming before.

Please reread the first post.

Whatever means is easiest for you to provide 5V. The phone doesn't know or care what type of plug you use for power. It's faulty logic to assume that a 4gb usb drive would use less power than say a 64gb one. I've made some attempts at seeing if I could get the 3.3V output for slimport to work with any of my devices. Unfortunately, at best, it's probably just not enough current (4-50mA @ 3.3V). There is a slim chance that it might be possible to hack a microsd usb adapter to work with 3.3V by powering the sd card directly (sd cards only require 3.3V). However, the adapter itself may still require 5V, and the issue of available current may still be a problem. For the moment, I'm trying to figure out how to make/hack a microusb plug that has the least protrusion possible.
[Nexus 4 Original Android Development] kennyry:
Thank you sooo much ziddey! You are much appreciated!

What I used was a cheapo Targus 4 port unpowered USB hub, an old samsung cellphone charger I had laying around.

Clipped the end of the cell phone charger, opened the hub, soldered pos and neg to the plug that connects to the standard OTG.

So essentially its now a "Powered" usb hub that sends power both ways, powers usb devices and the phone (plus it was free since I had the stuff laying around :D)
[Nexus 4 Original Android Development] osi13:
First of all, thank you ziddey, CaptainMuon, and franco for all of the hard work.

My Nexus 4 is running the March 7th build of Paranoid Android (mostly because it's stable, and supports the BT bitrate tweak) and your patches from March 23rd. Everything I have set in Franco's application seems to still be working. My gamma settings, line-out volume boost, and power settings still work accordingly. I haven't noticed any ill effects with an 8GB flash drive using the following as a power source: a desktop PC, 1000mA wall charger, and a 500mA USB port in my car.

I've been primarily using OTG to play back FLAC, via Bluetooth, with Poweramp in my car. I have Poweramp set up to scan a folder on my flash drive for music, and everything works perfectly. I have not had to mess with Stickmount, or any other mounting applications. The flash drive also appears in Solid Explorer.

Also, the Y-cable does charge the Nexus 4. I've confirmed this with BetterBatteryStats.

Anyway, I don't know if this belongs here, but I can offer the OTG Y-cable Ziddey posted for a PayPal payment of $8.75 shipped to anywhere in the US. $8.75 is the cheapest price I've seen from a US based seller. I will test your cable with my Nexus 4, and ship it to you via USPS First Class parcel. You will receive a tracking number and the cable will arrive in 2-4 days. If I'm paid before 5PM EST, your package will go out the same day. PM me if you want details. I can also provide references. Again, I'm sorry if this doesn't belong here, but I figured that I could help a few people out.
[Nexus 4 Original Android Development] kennyry:
If I was you, I would just get a Y adapter that has a female micro USB port and use a portable backup phone charger link the one below.

http://www.amazon.com/Duracell-Instant-Charger-Includes-Universal/dp/B002FU6KF2/ref=pd_sim_e_5

They make some that take AA batteries as well.
[Nexus 4 Original Android Development] scream4cheese:
Re: [OTG] [23MAR13] [DIRTY HACKS] Externally Powered USB OTG (Seeking Devs)

It works with any ROM. You just need this modified kernel and you're good to go!
[Nexus 4 Original Android Development] ritchea:
Thanks for this detailed list of how it works. Two cables (one all standard and one with micros like you showed) may arrive today. I hope I can test this out, too. I paid $9.89 for my micro cable so you are offering a really fair deal--and if mine doesn't work (I do think the micro one will), you'll hear from me.

EDIT: This one works as I expected it would. The other regular usb did not work even though I tried it in my pc, in the ravpower battery source which is 5V, and in a wall wart. It did work to pass data through on my Nexus 7 using the OTG cable with the micro male directly into the device. Even though it was advertised as a male power cable, it wasn't able to utilize the power as needed. In any case, OTG is working for me, now.
[Nexus 4 Original Android Development] ziddey:
I don't understand what those tests are. Is that with this kernel? If so, and it's now showing sdp, that's the expected behavior. There are issues with forcing fast charge and connecting to computer (out of scope of this thread, but I've always had success by doing an unplug/replug).

There is no need to wipe cache/dalvik. As for installing a kernel before the patch, that's pointless as well since it's just going to be replaced.
[Nexus 4 Original Android Development] ixbaderxi:
Nope, I have the same situation without the fast charge, only works the PTP. I tried in other PC, but is the same :crying:
[Nexus 4 Original Android Development] bmakk2055:
What app is everyone using to view files on external hard drive? Stickmount isn't working well for me.
[Nexus 4 Original Android Development] ziddey:
What ROM are you using? With stock, only vfat will get natively mounted. With CM and I'm assuming its derivatives, you get the whole set-- vfat, exfat, ntfs, ext.

Otherwise, yes, you'll need to use StickMount with the necessary fuse modules, but then, it'd work just the same. Whether native or Stickmount, it's just a front-end. As far as NTFS is concerned, it's done with ntfs-3g anyway. So what do you mean by "isn't working well"?
[Nexus 4 Original Android Development] bmakk2055:
By

I'm using PA rc2 but using stickmount it all way disconnecting
[Nexus 4 Original Android Development] ziddey:
poor connection or power supply
[Nexus 4 Original Android Development] :
nvm
[Nexus 4 Original Android Development] PinoDG:
perhaps conflict with drivers double

I have the same problem with the stock kernel,

this happens to conflict because drivers installed double in different place or in conjunction with other android,

i have nexus4 and 7

try to see hidden devices on the PC management

sorry for bad english...
[Nexus 4 Original Android Development] tarroyo:
Quick question [MENTION=584916]ziddey[/MENTION] do I need a certain amount of internal storage to use this mod? I have 1.6GB left reason I ask is this mod is not working for me.

In the past I have used this mod w/o issues when connecting the otg cable with a flash drive, I see a notification telling me that additional storage was detected. When flashing the latest cm mod from the OP power is detected but the flash drive is not, I don't even see the USB folder in root like I did with past mods. Running your mod on the latest 11/07 build

Any idea what could be or causing this? In the meantime I'll try flashing a older build.
[Nexus 4 Original Android Development] TheQuarterMile:
Will flashing 193 work on 4.4 ROMS?
[Nexus 4 Original Android Development] adidas007:
Try and let us know :P
[Nexus 4 Original Android Development] TheQuarterMile:
Bootloop :p
[Nexus 4 Original Android Development] Sick1:
Is it possible to create a flashable .zip to change only recoverys/TWRP:s kernel to your modified so roms kernel would be untouched?
[Nexus 4 Original Android Development] ziddey:
Fine here. Sounds like the patch wasn't flashed if you don't have /usbdisk and aren't getting FCs. I take it you're not seeing usb storage in settings->storage either?

Is possible. Take a look at the recoverymod script and modify as necessary.
[Nexus 4 Original Android Development] Sick1:
Thanks, gotta give it a try. First i must spend some time learning what to do :D . Im familiar mostly only editing theme file and few days ago got in touch a little bit with init.d scripts.
[Nexus 4 Original Android Development] tarroyo:
Nope not seeing that either, I tried flashing 191 on a clean install as well. Can u check these mods with the latest cm nightly and see if you get the same issue?
[Nexus 4 Original Android Development] ziddey:
I am always on latest cm

Sent from my phone. Please forgive typos and brevity.
[Nexus 4 Original Android Development] Subrad5446@aol.com:
[MENTION=584916]ziddey[/MENTION]-

What zip do I flash to get otg working on 4.4? I'm on gnome's 4.4 rom with kitkat kernel, which the op says has otg inside. When I asked about it over there, I was told (sorry don't know how to quote another thread) "You have to pactch also rom with the right mount point.

see ziddey thread." But the op says it should work with any ROM.l though all I needed was to flash a kernel that had otg inside....confused?:cyclops: Thanks in advance for your help.