yashsingh1/xdaforums huggingface dataset:
[Nexus 4 Original Android Development] ziddey:
As far as requiring multiple attempts to get a usb device to register, it may come down to a finicky otg cable. I haven't seen this personally (and believe me, I've used a fair share in my testings), but there have been enough reports to confirm that it is in fact common. Beyond that, the only possible issue with the "mod" is that the phone will try to draw power before usb device enumeration (as a compromise to allow proprietary chargers to work). This could potentially result in the power supply being overloaded, causing the device to drop out. You could try disabling charging to rule this out (see first post). However, if using an external hard drive with its own power supply, this wouldn't be a factor. Beyond that, there's nothing in the code that's different from any other "properly" implemented otg setup. I have been using a custom battery/usb-microsd "case" daily for almost half a year now with no issues.

Regarding non-FAT partitions, these are simply not supported in stock Android. CM has modified native mounting provisions for ext/ntfs/exfat. Other than that, a third party tool / manual mounting is needed. This is out of scope of the "otg patch" itself, and if you can't get it to work, help should be sought in the appropriate thread (a search would be best). That said, I have been able to use these other partitions both with CM and StickMount in the past, so it does indeed work.

For gamepad support, do re-read the first two posts (I believe the link is in the 2nd). Popular gamepads are supported via kernel modules included with the patch. Since gamepad usage represents an extremely small demographic, these modules are not automatically loaded (i.e. YOU will need to understand how to load them). These modules have long been compiled for the franco builds, and are now also made for the latest aosp version. I do not have any gamepads to test with, but have received enough feedback that it works.
[Nexus 4 Original Android Development] rohit297:
Sorry to ask this, but i really didn't get that, i mean i am on stock4.4 with franco r195,can i flash this patch, i want to use gamepad with my phone
[Nexus 4 Original Android Development] Sturdy_99:
how can i disable usb charging....any commands to use in terminal manager...or how and where can i make the script mentioned
[Nexus 4 Original Android Development] keyra74:
works for me
[Nexus 4 Original Android Development] Sturdy_99:
Have you written that it will support gamepads....how can i use it.....just connect......which app do u prefer to config the gamepad....and will i flash this over the kernel...

flashed....gamepad working.... :)
[Nexus 4 Original Android Development] rohit297:
Can you please tell me on which rom you are and kernel, n which kind of gamepad you use, n what you did to make it work
[Nexus 4 Original Android Development] ciao99:
guys i have a usb y cable, this one:

connecting the cable to source, as pc, (without plugging it in the phone), then a joystick to cable, it doesn't power up. The analogic led doesn't turns on. The joystick is working without the y cable. How can this be possible?
[Nexus 4 Original Android Development] Sturdy_99:
bro using psx v2...with this modded kernel r195....then flashed aosp r3 on it....then simple just connect the wires and then press the analog power key...i am using usb pc controller of some enter company....working great but i need a app to map the games:good:

---------- Post added at 04:28 PM ---------- Previous post was at 04:24 PM ----------

bro just plug in the phone too......Use the latest kernel given in this thread...and flash the aosp r3 zip given here.......then connect everything...the phone cable the pc cable the the controller....if the light doesnt come up then just reconnect the pc and the gamepad controller.....that it....;):good:

NOTE:- That when connect all the cables then only the female usb gets the power....if u have not connected the phone then it will not work...lol..

---------- Post added at 04:45 PM ---------- Previous post was at 04:28 PM ----------

Which app can i use to map the games.....guyz someone please help...:confused:
[Nexus 4 Original Android Development] ciao99:
for mapping i think you can use Gamepad Enabler.

I'm on 4.2.2 so i'm using the old version of patch, based on franco r165. The fact is that the cable seems not to supply power to controller. But it works with usb key. i don't know if you can understand what i mean.
[Nexus 4 Original Android Development] Sturdy_99:
the app is paid app....:rolleyes:...i cant pay for it......and according to my knowledge, the problem is not that the power is not getting supplied to the controller.....but the 4.2.2 and 4.3 patch does not contain gamepad modules.....but 4.4 does....so why dont you upgrade...
[Nexus 4 Original Android Development] rohit297:
So i flashed the r195 patch first and then i flashed the aospr3 patch, now there are no gamma control settings in fku app, please any solution
[Nexus 4 Original Android Development] ciao99:
aah ok, thank you! i'm waiting for custom 4.4 roms as PA or CM because i don't like stock ones.
[Nexus 4 Original Android Development] Sturdy_99:
ok...i tried many apps now gamepad connect , gamepad enabler....but were not working...they are for bluetooth controllers.....i tried usb/bt joystick controller.....but again that verification is annoying...can someone find a better one..
[Nexus 4 Original Android Development] ziddey:
Oops, overlooked something in my script, and modules got compiled into the kernel itself in aosp r3. Should be fixed in r4:

< # CONFIG_MODULES is not set
---
> CONFIG_MODULES=y
> # CONFIG_MODULE_FORCE_LOAD is not set
> # CONFIG_MODULE_UNLOAD is not set
> # CONFIG_MODVERSIONS is not set
> # CONFIG_MODULE_SRCVERSION_ALL is not set

http://source.android.com/source/building-kernels.html still describes using the 4.6 toolchain, but stock krt16s uses 4.7, so that's what will be used from r3 on.

4.4: 2013.11.30 1328ET: [aosp r4]
[Nexus 4 Original Android Development] rohit297:
I got the gamepad working on aospr3 but not on aospr4, n also after installing the aosp r3 patch i lost the franco kernel modules and settings anf phone is not working in the way it used to work with franco kernel
[Nexus 4 Original Android Development] Sturdy_99:
which app are you using to play games

---------- Post added at 07:22 AM ---------- Previous post was at 07:14 AM ----------

Cant we make a zip of this patch which will replace the ramdisk or flash the ramdisk for any kernels..........And this zip can support all the kernels...as it will replace the zip...

Is this possible?:good:
[Nexus 4 Original Android Development] rohit297:
I am using usb/bt joystick center v8+, working nice with its touch control, n also i flashed the r195 kernel and the r195 otg patch over aospr4 patch, now everything seems to be working, i got my gamma settings back n also the gamepad is also working, one bug i found is that the device sometimes gets restart while connecting gamepad, not sure its the driver bug or the app i use bug, but a lot of thanks to the developer
[Nexus 4 Original Android Development] ziddey:
aosp r4 had CIFS built as a module. I didn't realize it's actually included in the kernel itself. Note that CIFS is completely unrelated to OTG, but I had been building it as a module due to many requests since franco's config doesn't include it. Future franco builds will no longer include the CIFS module, although current versions should continue to work (make a backup of it if it's something you use). If it breaks, let me know and I'll compile a new one. Again, it's completely irrelevant to OTG, and there's reason to upgrade from r3 unless you use CIFS (and don't want to load it as a module).

Also no longer including kernel NTFS support. It was read-only, and not supported by the stock rom anyway. CM and StickMount both use ntfs-3g, so there's no reason to include the kernel driver.

Franco builds have been rebased to r196.

4.4: 2013.12.01 0349ET: [fk r196] [fk r196-CM] [aosp r5]
[Nexus 4 Original Android Development] dimaka1256:
fk-r196 works with crDroid CM11 b6 and latest stickmount from the market

causes systemui to force close on flash drive connection but works in ES file explorer like a charm!

thank you!
[Nexus 4 Original Android Development] keyra74:
fk 196, applications fcs in parameters and titanium backup can't mount memory

same with 195 in fact
[Nexus 4 Original Android Development] provolinoo:
same here, flashed 196-cm on latest cm11 and I have problem accessing internal memory

it seems rom-side otg patches break the access to internal memory somehow
[Nexus 4 Original Android Development] ziddey:
Are you trying to mount multiple partitions or something? Otherwise, there shouldn't be a need for stickmount with CM since it should be support all the common partition types.

Parameters? Could you be more specific? I'm assuming this is the cm version?

Will look into it today
[Nexus 4 Original Android Development] dimaka1256:
the stickmount is installed and auto launches my single partition flash disk, i can use it like /mnt/usbdisk

and yes, the system tells that /sdcard and /mnt/sdcard doesn"t exist, I can only use it like /mnt/shell/emulated/0

so for example camera and quickpic fail
[Nexus 4 Original Android Development] keyra74:
yes sorry cm11 built today
[Nexus 4 Original Android Development] ziddey:
AOSP doesn't define internal storage as primary, but CM needs it. storage_list.xml has been updated. All else should be the same. Please report.

4.4: 2013.12.01 1619ET: [fk r196-CM]
[Nexus 4 Original Android Development] ziddey:
No, stickmount does not mount to /mnt/usbdisk. That's the native mounting mechanism.
[Nexus 4 Original Android Development] eran1243:
Ziddey, I didn't visit this thread for a while and few months ago there was a discussion here regarding DSLRs. I'm wondering if you found a solution for this (as DSLRs do not require external power)
[Nexus 4 Original Android Development] dafnis:
I think this is what messes up my storage: I'm on Bruce's de-CAF CM11, so aosp-r5 works fine but as soon as USB external is mounted, /storage/emulated/0 is unmounted and can't be found at any alternative location.
[Nexus 4 Original Android Development] ziddey:
4.4: 2013.12.01 1855ET: [aosp r6]

Should work for "de-caf" builds of cm.
[Nexus 4 Original Android Development] keyra74:
works like a charm! thx :)
[Nexus 4 Original Android Development] alguien24:
Well done ziddey, working perfect in krt16s stock, thank you very much for your job. Just a question, is there any app that allows r/w access to a exFAT drive?

Enviado desde mi Nexus 4 mediante Tapatalk
[Nexus 4 Original Android Development] nigelhealy:
Stickmount.

https://play.google.com/store/apps/details?id=eu.chainfire.stickmount

Then RTFM...."StickMount can utilize ... "mount.exfat-fuse" binaries to add support for ... exfat, but these are not included. If you place the .... "mount.exfat-fuse" files in the root of your internal storage ( /sdcard ), StickMount will automatically use them.

You can find the needed files here:

....

mount.exfat-fuse: http://xdaforums.com/attachment.php?attachmentid=806200&d=1323109372 "

Read-

WRITE

? Good luck, we don't have read-write NTFS but I never tried ex-FAT.
[Nexus 4 Original Android Development] Sillik:
Hello,

I did try patching the latest TWRP with the patch from this thread: http://xdaforums.com/showthread.php?t=2412689

I managed to flash a stock KitKat rom without issue (then the OTG mod of course!).

So everything is OK! :)
[Nexus 4 Original Android Development] dafnis:
aosp-r6 usb storage working fine with de-CAF CM11, thank you
[Nexus 4 Original Android Development] defrt:
can i use this http://www.meenova.com/st/p/m3r.html product with this patch or need something else ?
[Nexus 4 Original Android Development] ziddey:
4.4: 2013.12.03 1522ET: [fk r197] [fk r197-CM]
[Nexus 4 Original Android Development] karol1981:
Any possibility to make an stock kernel for ktr16s with otg support?

Send from my Nexus 4
[Nexus 4 Original Android Development] SpasilliumNexus:
That thing has no way to attach an external power supply to it.

Quote from OP:
[Nexus 4 Original Android Development] nigelhealy:
RTFM? OTG Y-cable, you plug power into it, not the device you want to use.
[Nexus 4 Original Android Development] SpasilliumNexus:
SMH you think I don't know how the OTG hack on the N4 works? What he posted looks like something he wants to plug directly into the phone without a Y-Cable.
[Nexus 4 Original Android Development] nigelhealy:
It is already, earlier text showed it but I think it has fallen off the top. If you go to the file upload site http://d-h.st/users/ziddey

and look down ziddey-otg-krt16s.zip

link: http://d-h.st/b5q

I used that first ..... and then Franco supported 4.4 and I jumped to those versions.
[Nexus 4 Original Android Development] nigelhealy:
no NTFS write support?

So ... I've been doing some digging and I can't get NTFS write to work.

I can see what Stickmount is doing, it is using ntfs-3g prog to mount. I took a few alternatives like NTFS Mount app apart and they do similar just using an older version of ntfs-3g.

At the command level I can run ntfs-3g, I do all I can to make it mount read/write (chmod 777 the mount point, ntfs-3g -o rw, etc) but it still ends up a non-writable outcome.

Ideas?
[Nexus 4 Original Android Development] howard bamber:
Well thanks ziddy! Ill flash right now and stop my Amazon order for a WiFi memory stick ?

Sent by reversed alian technology.
[Nexus 4 Original Android Development] const_char:
I tested 4.3 stock with 4.3 stock ziddey kernel from first post and 4.4 with the mentioned ziddey kernel and seemed to have OTG support, but immediately after I get the devices plugged into the powered USB hub recognized correctly, I get the message "*** UNFORCING USB HOST MODE ***" and then all the devices are disconnected.

Anyone experiencing the same?

Thanks!
[Nexus 4 Original Android Development] provolinoo:
r198 is out with 4.4.1 patches included :)
[Nexus 4 Original Android Development] ziddey:
4.4.1: 2013.12.06 1445ET: [aosp r7]

4.4.1: 2013.12.07 1623ET: [fk r198] [fk r198-cm]

CM build: Updated franco ramdisk mod. Make sure you're coming from a "clean" ramdisk (i.e. stock cm boot.img)

aosp build updated to kot49e.
[Nexus 4 Original Android Development] nigelhealy:
Working OK on stock 4.4 Krt16s Franco. On N4 I must plug in power to y cable then hard drive to y cable then connect y cable to N4.
[Nexus 4 Original Android Development] ziddey:
If the phone sees power but no device, it'll go into peripheral mode and attempt to connect to a host (e.g. computer). I've seen mixed results when attempting to plug in a usb device this way. It *should not* work, although often it does for my setup-- what I'm assuming is happening is that there's a sudden voltage dip when the device is plugged in, causing the phone to detect loss of charging and drop out of peripheral mode. Then, the return of power starts the detection process anew, and it goes into host mode.

Generally, it's a good idea to have the usb device powered up before plugging into the phone. However, the phone will start charging before device enumeration, and if that leads to a power dip, the usb device may drop out. I haven't seen this happen myself, but it is possible. The original code has the phone wait until after enumeration to start charging, but this breaks support for apple-compatible chargers. If this is suspected of being an issue, phone charging can be disabled as a test (see quote from RussianBear in first post). Of course, if your device has its own power (e.g. external hard drive with its own power source), then this is not relevant.

edit: thinking about it some more, the phone will stay in host mode properly when usb devices are unplugged/plugged. This may invalidate the voltage dip logic. Either way, the easiest way to see what is happening is to watch your kernel log (# cat /proc/kmsg).

I noticed that 4.4.1 KOT49E brings some updates to usb drive support-- specifically, there's now an option to erase usb storage, and it doesn't crash anymore. It works just fine, but obviously formats as vfat. The persistent usb storage removed message remains in aosp :(

SELinux: initialized (dev sda1, type fuseblk), not configured for labeling

vs when android vold mounts vfat:

SELinux: initialized (dev sda1, type vfat), uses genfs_contexts

SELinux: initialized (dev fuse, type fuse), uses genfs_contexts

SELinux enforcing does indeed prevent actual writing. Switching to permissive works. For a push-button method, see this thread: http://xdaforums.com/showthread.php?t=2524485

Otherwise, selinux can simply be manipulated via setenforce:

# setenforce 0

I'll look into adding the necessary contexts to allow the use of enforcing.
[Nexus 4 Original Android Development] nigelhealy:
Adding power last does not work with my non powered USB hard drive it makes a weird noise stickmount does not see it if I click mount.

---------- Post added at 04:04 PM ---------- Previous post was at 03:52 PM ----------

Just tried adding power last doesn't work. Only combo works for me is power drive n4. I am not concerned about the sequence only that others know what works so they have the benefit.

NTFS read write takes many components just right. I am no way an expert but I think the fact the is is not recognizing NTFS device means we are using stick mount and it uses ntfs-3g which appears to want a module fuse.KO rather than it being compiled into kernel? So either you make it a module or fully include so stickmount not needed. Also I found that the app "NTFS mounter" does not fix the problem either and it copies an older ntfs-3g than stickmount recommends and copies it to the path permanently so "fights" stickmount and is not truly uninstallable. So stock, your kernel, stickmount is the best combo but read only which is not that critical to me as my context is to copy off media to watch but writing would allow to do backups offline not over WiFi but then backups are small and so fit on cheap USB sticks so as I say NTFS read write not critical (to me)
[Nexus 4 Original Android Development] ziddey:
You are having a problem with a weak power source. A non-powered hard drive eats A LOT of power.

FUSE has been an integral component of Android since 4.2. There is no native support for ntfs/exfat. If you don't want to use a custom rom (e.g. CM), you WILL need an aftermarket means (e.g. stickmount) to support these partitions.
[Nexus 4 Original Android Development] nigelhealy:
NTFS writes works! Using SELinuxModeChanger_v1.2.apk

I installed SELinuxModeChanger_v1.2.apk and connected a USB NTFS harddrive (Y to power then hdd then to N4), Stickmount auto mounted and I could write to the NTFS drive. To minimiz chance of corruption I typed "sync" in terminal (might be needed) and I used Stickmount to umount (might not be needed), then connected to a laptop and could see the written file.

So have working NTFS harddrive writing.:good:

Does anyone know if writes are sync or async? If sync then don't need to correctly unmount, writes are commited at the time and not held in a write buffer.

---------- Post added at 04:48 PM ---------- Previous post was at 04:39 PM ----------
[Nexus 4 Original Android Development] punitthereddevil:
[MENTION=584916]ziddey[/MENTION], I had sent u a pm a few days ago with a request...I just needed to know what u think about it...

______________________________

| NEXUS 4

| XPOSED KITKAT 4.4

| GRAVITY BOX

| HELLS CORE B42 / ZIDDEYS OTG KERNEL

| TWRP 2.6.3.0
[Nexus 4 Original Android Development] duduzinho15:
I really happy with it! Thank you
[Nexus 4 Original Android Development] sga999:
ziddey, I'm wondering if the "unmod" zip file is still valid. It seems to be crossed out under the "old" category in your first post, yet a little bit above that under "Installation", you say "use the flashable unmod script to remove ROM-side modifications". I searched this thread for "unmod" to see why that unmod zip might no longer be valid, and I couldn't find anything. Sorry if I missed it. Thanks.
[Nexus 4 Original Android Development] ziddey:
The unmod script hasn't been updated since 4.3. The best method to restore to stock is still to reflash system and boot. There have been several changes required between 4.3 and 4.4, and the old script will not work. I got too many PMs with people being unable to flash OTA. Turned out they made other modifications to system-- build.prop, supersu, busybox, or whatever else (custom recovery, etc). On top, the script still didn't restore the original boot.img. Backups of most of the altered files are still made though, and if you can navigate through otgmod.sh, you can see what's actually being changed, and what the backups are. Plus, Franco's boot script made some further changes to system.

Most of the changes reside in ramdisk, which can be replaced by flashing the stock boot.img. On system, there's build.prop, framework-res.apk, platform.xml, handheld_core_hardware.xml, android.hardware.usb.host.xml, and any kernel modules.
[Nexus 4 Original Android Development] duduzinho15:
When I change to interactive my phone is rebooting :-$
[Nexus 4 Original Android Development] arlenwoot:
Are you using 197? Had the same problem but changing to 198 fixed it.
[Nexus 4 Original Android Development] duduzinho15:
No I'm using 198
[Nexus 4 Original Android Development] sga999:
ziddey, this is a very basic question which may not belong in this thread. But maybe it's simple enough for you to answer here.

If I look at various OTA files (several coming out for the N4 lately), some of them don't contain boot.img or system.img. Let's assume I was stock, then applied an OTA, and then flashed your .zip file. When another OTA comes and I want to flash the original boot/system.img files, where do we get them? As you answered before, I can do it by renaming individual files. But obviously, using the .img files would be simpler. Thanks.
[Nexus 4 Original Android Development] ziddey:
OTA's generally only contain patches, and so it is required to first check the integrity of the existing file. The assumption is that factory images will be released, providing you with system.img, boot.img, and whatnot. As well, it can be expected that members will provide appropriate dumps (of course you shouldn't be relying on this...). At the end of the day, it is on you to make your own backups as you see fit...

If you wanted to play the OTA game, you could of course flash the 4.4 factory images, and then apply the appropriate OTA(s).
[Nexus 4 Original Android Development] vishal007:
I cannot mount otg on twrp. Any solution?
[Nexus 4 Original Android Development] sga999:
Did you see the "recovery" section and recoverymod.zip in the OP? It works well.
[Nexus 4 Original Android Development] vishal007:
I found it out. Here's the link

http://xdaforums.com/showthread.php?t=2412689
[Nexus 4 Original Android Development] sga999:
Yes, you can do it that way, but ziddey gave you another way to do it in the first post of this thread.
[Nexus 4 Original Android Development] howard bamber:
Turns out my rom had it built in# Matr1x by math kid.

Sent by reversed alian technology.
[Nexus 4 Original Android Development] PinoDG:
recovery mod twrp+otg

Hi

this TWRP 2.6.3.2 recovery mod is perfect with everything working ...

install with old recovery or flashify

MultiROM key only works with lernel patch ...

the recovery works well on all

use only recovery here

http://xdaforums.com/showpost.php?p=46223393&postcount=2
[Nexus 4 Original Android Development] ziddey:
4.4.1: 2013.12.11 1604ET: [fk r199] [fk r199-cm]
[Nexus 4 Original Android Development] qltsar:
Thank you for your work ziddey :)!

Unfortunatelly I still cannot change the governor from Performance to Interactive since r195_CM :(. This bug is only affects the CM version, the other version is working fine :).
[Nexus 4 Original Android Development] provolinoo:
it seems to be a problem with the OTG patch, if you replace the kernel image in the 195 zip that comes without OTG patch, it works fine