yashsingh1/xdaforums huggingface dataset:
[Nexus 4 Original Android Development] ziddey:
On my phone so not going into detail again. Search thread or read past few pages for how to enable otg without charging. Will make changes to make this easier soon.
[Nexus 4 Original Android Development] parkedraccoon:
Can't seem to find it but I can just use the solution you're working on. Though, is it possible to, for example, slow it down to a normal USB charge rate (~500ma) so I still charge while using OTG stuff? I was hoping to also be able to do that.
[Nexus 4 Original Android Development] eris23:
Here's the framework-res.apk from my 20130706 build (with the same problem).

https://www.dropbox.com/s/6hg5vnp33b6n2wl/framework-res.apk
[Nexus 4 Original Android Development] sga999:
eris23, thanks for your framework-res.apk file. So far, I haven't been able to find the problem. I'm not running CM, so I'm just trying the script with your file, and it seems to be doing the right thing.

ziddey, it looks like 0x54e and 0x550 are the two values that get patched into storage_list.xml, and I think those values look right. So unless I install CM (I'm on stock right now), I can't go any further. I can install CM, of course, but since you are already running it, maybe it will be easier for you to check it out. Let me know if you need any more help.

EDIT: I know almost nothing about looking at the "commits" that eris23 mentioned. But it mentions something there about marking internal storage as primary. So it sounds like that may have messed up something with your code? I mean, maybe these two patches to storage_list.xml are working just fine, but something else in your code is affected due to these commits?

EDIT2: ziddey, I wonder if you just need to replace the res/xml/storage_list.xml in your otgmod folder with one that has that primary flag true instead of false? (android colon primary="true") Sorry if I'm way off base here.
[Nexus 4 Original Android Development] ziddey:
2013.07.08 1420ET: ziddey-otg-r162-07081420.zip Update storage_list.xml for compatibility with new CM nightlies-- rebase to Franco r162.

With regards to host mode without charging, I'll implement something in the next release to allow the use of an init.d script. For now, you can manually enable host mode prior to connecting your device+power:

# echo host > /sys/kernel/debug/msm_otg/mode

Replace "host" with "none" to disable host mode. Assuming this is done prior to connection, the phone will no longer charge.
[Nexus 4 Original Android Development] sga999:
ziddey, I see in your script that the one of the offsets to patch changed from 552 to 572. Do you know if the CM storage_list.xml format changed due to the primary flag change (false to true) mentioned above, or were there other reasons for the extra bytes? I'm just curious.
[Nexus 4 Original Android Development] ziddey:
<?xml version="1.0" encoding="utf-8"?>
<StorageList
xmlns:android="http://schemas.android.com/apk/res/android">
<storage android:storageDescription="@string/storage_internal" [color=red]android:primary="true"[/color] android:emulated="true" android:mtpReserve="100" />
<storage android:storageDescription="@string/storage_usb" android:primary="false" android:mountPoint="/storage/usbdisk0" android:removable="true" />
</StorageList>

primary was simply undefined before. No harm in setting to "true" for other ROMs. It's the way it is for pretty much every other phone.
[Nexus 4 Original Android Development] N_lover27:
how to mount OTG storage on TWRP ?
[Nexus 4 Original Android Development] gallardo5:
It probably won't work, as twrp uses it's own kernel
[Nexus 4 Original Android Development] N_lover27:
how about CWM ?
[Nexus 4 Original Android Development] gallardo5:
Sorry but it won't work in any recovery, as recovery needa to use it's own recovery
[Nexus 4 Original Android Development] ziddey:
Oh my ntfs-3g and exfat in latest cm nightly along with modified vold.

edit: Just tested. ntfs read/write is working out of box now in recent cm10.1 nightlies. Exercise caution when using ntfs partitions, making sure to unmount prior to disconnect. As well, be careful of loose connections...
[Nexus 4 Original Android Development] danizwam:
Hi,

i bought this ethernet adapter (http://www.amazon.com/BobjGear-Compact-Ethernet-Ultrabooks-ChromeOS/dp/B007RTACDM/) some days ago and it works flawless on my Galaxy Nexus and Nexus 7.

USB-Drives are working perfectly on my Nexus 4 with an USB-OTG-Y cable, external power supply and your mod.

I'm running CM10.1 nightly 07/09 on my Nexus 4.

Nothing happens, when i plug in the ethernet adapter.

I'm using CatLog and set the filter to "Ethernet". On my Galaxy Nexus and Nexus 7 i can see that the eth0 is initialized... On my Nexus 4, i see nothing...

Any suggestions or ideas?
[Nexus 4 Original Android Development] ziddey:
A relevant dmesg log would be absolutely crucial.

I see that the bobjgear adapter uses the ax88772a chip. ASIX AX88xxx support is built into the kernel, so as far as that goes, it should be supported. Not sure about other aspects of usb ethernet; I don't have one to test with.
[Nexus 4 Original Android Development] danizwam:
I can do that, but i am not very familiar with linux.

Just some basics ;)

Could you please tell me what to do?

dmesg -×××××
[Nexus 4 Original Android Development] ziddey:
After plugging in the ethernet adapter:

dmesg > /sdcard/log

Or before:

cat /proc/kmsg > /sdcard/log

and then ctrl+c after plugging it in.

Relevant part of log will start with the line "PMIC: BSV set"
[Nexus 4 Original Android Development] tarroyo:
July 8th build isn't working properly for me, I had 5gigs storage left after installing this I went down to 1gig, did a clean wipe reinstalled your mod and again same issue.

Gonna go back to the m3 build and test to see if I experience any issues

Edit: The issue is in the screenshot, whenever I tried copying a file. I have 5gigs internal storage and 1gig of ram left, Every time I get that message my internal storage goes down

Edit 2: I was unable to test M3 on CM10.1 7/8 nightly (the one I'm using) as it causes the android ui to crash upon flashing Ziggy's m3 file.
[Nexus 4 Original Android Development] ziddey:
Weird. I don't seem to be having that issue. The only change in the 7/8 build (besides the rebase to r162) was setting the internal storage as primary, as is now required for cyanogenmod.

Where is your space going?
[Nexus 4 Original Android Development] tarroyo:
Space should be going to internal running the CM10.1 7/8 nightly.

Have you tried flashing your m3 file over build 7/8 ?
[Nexus 4 Original Android Development] thegreyspot:
Hi,

I just got your recommend Y-cable from amazon. I installed the zip and I see it is installed. However, when I plug in my Nikon D7000 DSLR, nothing happens. It just says Insert USB storage for mounting. I can confirm that my setup works with a random jump drive.

Here is what my specs look like:

https://www.dropbox.com/s/txa9heqellz09dm/shot_130711_174804.png

I also tried to use your "echo host > /sys/kernel/debug/msm_otg/mode" hack, but still no result. Is there anything else I can try?
[Nexus 4 Original Android Development] Javier.D:
Ziddey, I'm making a rom and i'd like to add your mod to my rom. Can I?

Thanks

Enviado desde mi Nexus 4 usando Tapatalk 4 Beta
[Nexus 4 Original Android Development] drunknbass:
Ive scanned this thread looking for the answer, but didn't find it.

What is the current required to trigger usbhost on the N4? Im looking at making a custom cable if possible(if the peripheral can supply it).
[Nexus 4 Original Android Development] ziddey:
I've been on 7/9 and now 7/11 and can't seem to reproduce your issue. What steps cause it? That said, I'm running ridiculously low on space because I can't set a limit for how much Google Play Music caches. Will have to give some serious thought to making a full-time battery/sdcard case.

Anyone else with this issue, cm or otherwise?

I'm not familiar with these dslrs. How does the camera present itself to your computer-- usb mass storage or mtp/ptp? If the latter, perhaps you need some sort of "dslr" app then? Do you see the device when you issue "lsusb"?

Sure, thank you for asking. Refer to the 2nd post for details (and the otgmod script in the zip, although this shouldn't be relevant for you since you're making a whole rom).

It needs to detect a charger-- 5v between + and -. Currently, there isn't really a provision for limiting current (can't identify one charger from another..), so it tries to "fast" charge. In a less than ideal scenario, your usb device can drop out due to insufficient power. Or, the load may cause the voltage to dip low enough that the phone no longer "detects" the charger.

For now, the only way to prevent the phone from drawing current is to force host mode before connecting anything. It's on my to-do list to allow the use of an init.d script to set whether to charge or not in host mode. One caveat though is that Apple-compatible chargers (and battery packs..) will not work in this mode (unless the data pins are isolated).
[Nexus 4 Original Android Development] SynnyG:
Sorry for this nooby question, but by doing :

# echo host > /sys/kernel/debug/msm_otg/mode

I could use the otg mode without charging my N4 (the external power will go to the USB devices), and by doing this:

# echo none > /sys/kernel/debug/msm_otg/mode

I could charge my phone again with wall charger for example and no longer use the otg mode, is that true ?

I've understand the fact that I have to do these command before plug in any external power/usb device to my N4 !

I ask this because I do not understand terribly good English ^ ^ " Thanks !
[Nexus 4 Original Android Development] thegreyspot:
The camera only allows PTP. When I run lsusb I get:

Bus 001 Device 002: ID 05c6:9048
Bus 001 Device 001: ID 1d6b:0002

Same when I disconnect the device lol.

And yes Im using lots of DSLR apps that say they support my camera and none seem to find the device :(

Any other ideas? Thanks!
[Nexus 4 Original Android Development] ziddey:
Is the phone charging?
[Nexus 4 Original Android Development] thegreyspot:
Yes when it does not have the host setting on
[Nexus 4 Original Android Development] parkedraccoon:
I've tried forcing OTG before connecting, and nothing. My USB cable from my battery pack does not do data and charges at AC speed on a USB 3.0 port so i assume it has data pins crossed. But when I connect to the phone, it charges, and naturally I have the problem of not enough power. This happens when I use the 3.0 port, my battery pack, or an AC charger.
[Nexus 4 Original Android Development] danizwam:
I attached the files and i hope you can help me.

Thanks in advance
[Nexus 4 Original Android Development] ziddey:
<6>[81124.024470] asix 2-1:1.0: eth0: register 'asix' at usb-msm_hsusb_host-1, ASIX AX88772 USB 2.0 Ethernet, 00:0e:c6:f0:9d:b4

Looks like it's being detected and initialized properly.
[Nexus 4 Original Android Development] danizwam:
I saw this line too, but a few lines later (line 907), it's unregistered, but i didn't unplugged it...

I unplugged it a few seconds after pressing ctrl + c

<6>[81154.205989] usb 2-1: USB disconnect, device number 2

<7>[81154.206202] usb 2-1: unregistering device

<7>[81154.206233] usb 2-1: unregistering interface 2-1:1.0

<6>[81154.207057] asix 2-1:1.0: eth0: unregister 'asix' usb-msm_hsusb_host-1, ASIX AX88772 USB 2.0 Ethernet
[Nexus 4 Original Android Development] tarroyo:
I'm still on 7/8 I'll flash newer nightlies this weekend to see if I can reproduce this issue.

There's very few steps I flash your mod then connect the usb otg y to my device and put the flash drive in the other port.

I go to root explorer and see the 'usbdisk' folder present, next I go to a downloaded file music/movie copy that and paste it in the 'usbdisk' folder it goes thru the usual time remaining etc. then at the end I'll get that message from the screenshot above.
[Nexus 4 Original Android Development] hell-lord:
Is anyone else experiencing effective color/brightness alterations upon switching to this kernel. Change is not overridden by manipulating brightness. (Coming from PA 3.65 kernel)
[Nexus 4 Original Android Development] ziddey:
Going a few lines above it:

<7>[81154.205073] portsc = 8c00100a
<6>[81154.205256] anx7808_cbl_det_isr : detect cable removal

and below:

<7>[81154.778865] PMIC: BSV clear

If anything, it looks like a poor connection between your otg cable and phone (pin4 normally used for otg detection is instead used by slimport, and it's tripping its cable detection).

I believe Franco uses a different color profile. I wasn't aware that it's not included in his PA kernel. Either way, you can manually adjust the settings or buy his app to adjust it via UI.
[Nexus 4 Original Android Development] ziddey:
Oh, I think I was misunderstanding you before. So you're saying that you can't paste TO the usbdisk? I'll give that a test later. What file system?
[Nexus 4 Original Android Development] thegreyspot:
ziddey, so do you think I'm out of luck with my camera? Nothing else you can think of I can try.
[Nexus 4 Original Android Development] ziddey:
Not sure what to say. I did find a digital camera to play around with. Plugging into the phone:

<7>[39960.756740] portsc = 88001205
<6>[39960.821498] usb 2-1: new high-speed USB device number 2 using msm_hsusb_host
<7>[39960.877437] portsc = 88001205
<6>[39960.941646] unplug_check_worker: usb_now=850, usb_target = 1500
<7>[39960.972469] usb 2-1: default language 0x0409
<7>[39960.973232] usb 2-1: udev 2, busnum 2, minor = 129
<6>[39960.973262] usb 2-1: New USB device found, idVendor=04b0, idProduct=0318
<6>[39960.973689] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[39960.974117] usb 2-1: Product: NIKON DSC COOLPIX L19-PTP
<6>[39960.974361] usb 2-1: Manufacturer: NIKON
<6>[39960.974574] usb 2-1: SerialNumber: 0
<7>[39960.976680] usb 2-1: usb_probe_device
<7>[39960.976711] usb 2-1: configuration #1 chosen from 1 choice
<7>[39960.981258] usb 2-1: adding 2-1:1.0 (config #1, interface 0)

Gallery pops up with the camera's contents listed as an album with an option to import to phone.
[Nexus 4 Original Android Development] tarroyo:
yes can't paste, any file I attempt fails. Ext4 using Root Explorer
[Nexus 4 Original Android Development] thegreyspot:
So I figured out my problem with the Nikon D7000. I was using a USB cable to the camera that worked fine with the computer, but not with the phone. It also seems to work better, when plugging in the power source last.
[Nexus 4 Original Android Development] boogerlad:
Is anyone able to modify the file /sys/kernel/debug/msm_otg/mode ? I am rooted. If I try with es file manager, I can edit, and then save, but upon viewing again nothing has changed, even mounted as r/w. In terminal emulator, I do su and then get the # as the prompt to indicate I'm root.

echo host > /sys/kernel/debug/msm_otg/mode doesn't change the file either. What is going on?
[Nexus 4 Original Android Development] Javier.D:
I'm trying to run ubuntu with the files in a memory stick, the first time it works perfectly, but if I close it I can't open it again, because the ubuntu files that were about 2Gb now are about 2mb, What can I do??

Enviado desde mi Nexus 4 usando Tapatalk 4 Beta
[Nexus 4 Original Android Development] ziddey:
Hmm, I'll have to look into this more later. I tried formatting a usb stick as ext4, but it doesn't seem to automount ("damaged"). To my knowledge, the newer cm builds support ext4 natively. Do you run into the problem with fat32 or ntfs partitions? I copied a few big files back and forth a few times without issue.

Is there a reason you're wanting to manually set the mode? "mode" itself won't change from none until a usb device is connected. Check /sys/kernel/debug/msm_otg/otg_state for the exact state-- it'll be a_wait_bcon if in host mode and waiting for a usb device, and b_idle in peripheral mode with nothing hooked up ("none").

Interesting. So you can run ubuntu on top of android now? Got any more information on this?
[Nexus 4 Original Android Development] Javier.D:
Yes, it's too easy, you only have to dowload this app https://play.google.com/store/apps/details?id=com.zpwebsites.linuxonandroid , it will guide you un the installation

Enviado desde mi Nexus 4 usando Tapatalk 4 Beta
[Nexus 4 Original Android Development] boogerlad:
I was just looking at the first post and wanted to enable otg without charging my phone.
[Nexus 4 Original Android Development] RussianBear:
For those that want to stop usb charging, create a script modifying this to either 1 (disabled) or 0 (enabled). Works for me :) Not responsible for your phone(s) exploding.

echo 1 > /sys/module/pm8921_charger/parameters/disabled

echo 0 > /sys/module/pm8921_charger/parameters/disabled
[Nexus 4 Original Android Development] ritchea:
If you make any progress on this, please post. I have the same adapter which I purchased for my Toshiba Thrive and also works on my Galaxy Nexus and Nexus 7. Like you, no success with the Nexus 4. It's not an important fix for me (not like getting OTG working), but I may use it when functional. Thanks.
[Nexus 4 Original Android Development] ziddey:
2013.07.14 2015ET: ziddey-otg-r163-07142015.zip Allow automatic host mode without charging-- rebase to Franco r163.

By default, host mode will enable charging. If this is not desired, an init.d script can be created to disable charging (this has the side-effect of breaking support for Apple-compatible chargers):

echo disable > /sys/kernel/debug/msm_otg/aca
[Nexus 4 Original Android Development] buizon:
Hi! Sorry for the noob question, can I flash latest kernel over the latest franco kernel and should I need to retrun to franco kernel, can I just flash it over the ziddey's kernel?

Thanks!
[Nexus 4 Original Android Development] RussianBear:
Yes.
[Nexus 4 Original Android Development] buizon:
Thanks!
[Nexus 4 Original Android Development] parkedraccoon:
If I run that script in command line, can I undo it by switching enable for disable?
[Nexus 4 Original Android Development] hamtar0:
I can't make it to work. Help please.

I make the zip installation using the CWM and the option show up, but it's unselectable. I reflashed my rom many times. I'm using CM10.1.

Also tried many adapters, and nothing
[Nexus 4 Original Android Development] mi3zu:
Hello,

Sorry if this ain't the right place to ask this, but what are some cheap portable alternatives to use this?(either for the usb power or something else entirely)

I'm looking for some options to get my music with me without streaming/downloading it.

Thanks
[Nexus 4 Original Android Development] imeem:
Does this work with any usb dacs (usb-powered and AC powered dac).
[Nexus 4 Original Android Development] Juppehup:
Bought a usb otg cable, soldered my own usb y cable and working like a charm! Thanks for the fix/hack, good job!
[Nexus 4 Original Android Development] gobz:
Sorry for the noob ques but can anyone explain what this is? Is it the way to turn on usb otg feature that was absent on n4? And does it mean we can connect a usb with a cable to our phone? Pl excuse me if I said something terribly wrong

Sent from my Nexus 4
[Nexus 4 Original Android Development] fjsw:
Thanks! This one works perfectly!

btw I noticed that when i connect external battery with a male to male cable to one of the ports in a usb hub, it will become "powered hub", so it is portable but a bit cumbersome.
[Nexus 4 Original Android Development] RussianBear:
yes, just need to flash the included kernel and get a y-cable. you will need a power source at all times, however (hence the y-cable).
[Nexus 4 Original Android Development] prateek80:
Still not possible without power source...??
[Nexus 4 Original Android Development] tnw513:
I think it's impossible on n4
[Nexus 4 Original Android Development] Dark Fear:
hi guys

my transcend has this kind of cable.. i don't know second usb is for what..

can it use to be a power source while connecting first usb to a regular usb otg cable?
[Nexus 4 Original Android Development] ziddey:
Yes.

It's for extra power in case one port doesn't provide enough to power the hard drive.
[Nexus 4 Original Android Development] imeem:
does USB audio out work after doing this?
[Nexus 4 Original Android Development] Dark Fear:
tnx for answer..

but i didn't really understand.. (sorry for my bad english)

correct me if i'm wrong.. i can use this external hard with "regular" usb otg (not y) cable and i must connect that second usb to a power..

if yes, how much power is needed? usb port on the pc? usb port on the battery charger? or something else
[Nexus 4 Original Android Development] ziddey:
The reason you have an extra usb plug for that hard drive is in case it draws more power than your usb port can provide. Personally, I've never run into a situation when this was the case though (usb spec calls for up to 500ma per port).

You will have to test for yourself to see if your usb port can provide enough current. If anything, you may need to disable charging of the phone (see first post).

Please search the thread. These are two relevant posts made in the past:

You may be interested in trying that patch. I don't have any usb dacs to test with myself. Do share your experiences. I'll update the OP accordingly.
[Nexus 4 Original Android Development] imeem:
thx for the reply, I would be getting a dac in a few weeks. Before flashing ur patch, do we need to "reset kernel" ? I'm currently using trinity kernel.
[Nexus 4 Original Android Development] Corey@rabbit:
Well, lucky me it wont work on my phone. But im not sure if its the phone or possibly the otg cable. Can someone test something for me, i have tried this on both my S3 and N4. With one end of your Y cable plugged into wall charger ( doesnt matter which one of the male usb ports) and your otg adapter plugged into the other male usb. Does your phone charge? Does it still charge if you swap the 2 male usb's?

Im at a loss, I would assume its supposed to charge correct? Neither of my phones will.
[Nexus 4 Original Android Development] ziddey:
I'm assuming you're referring to a Y-cable like http://www.amazon.com/OEM-UTStarcom-USB-Adapter-Cable/dp/B002W8EDOM

Yes, the phone will charge if either male usb is plugged into power.

Also, for what it's worth, the S3 does support usb host mode out of box (I believe), but it uses an 11-pin microusb port and will need a special otg cable / converter. http://en.wikipedia.org/wiki/Mobile...-pin_.22samsungs_MHL.22-HDMI_adapter.2Fdongle

It will still charge with the setup you're describing though.
[Nexus 4 Original Android Development] Corey@rabbit:
that would make someone assume the OTG cable is bad, however it works with a thumb drive and attached directly to the S3...

Since power doesnt have to go to the phone only to the thumb drive, shouldnt it still work?
[Nexus 4 Original Android Development] socrates8310:
Can not flash the ziddey-otg-r163-07142015.zip, I am using TWRP v 2.4.4.0 and pacman rom v 22.0.2. TWRP failed at verifying package signature step. The file I downloaded has the same md5 hash as shown in the host wesite, so this is not a bad download file problem. Is anybody having the same problem?

---------- Post added at 07:12 AM ---------- Previous post was at 07:05 AM ----------

Well, never mind. I unchecked the verify package signature option in TWRP before flashing the zip. Now TWRP finished the flashing successfully. Hope it will work fine. I just got my USB OTG cable today. And hoping this will connect my Nikon D300 to my Nexus 4 and I can use DSLRdashboard. I will report the experience.
[Nexus 4 Original Android Development] Sillik:
Hello Ziddey,

Are you planning on porting your awesome work on Android 4.3?

I read somewhere that there is already a Franco Kernel for 4.3 so I guess (hope) it won't be too difficult?

I just want to evaluate if I should be waiting or not before upgrading...

Thanks!
[Nexus 4 Original Android Development] ziddey:
Franco is on vacation right now. When he updates his git, I'll be updating accordingly. Personally, I won't be moving to 4.3 until CM10.2 comes out.
[Nexus 4 Original Android Development] Sillik:
Oh OK, I see. I will be waiting for Franco's holidays to end then.

Seriously, he should have warned Google about his vacation to make them delay the release! :)

Thank you for the answer.