yashsingh1/xdaforums huggingface dataset:
[Nexus S Android Development] sztupy:
Build 5 released

ChangeLog

Added ability to turn charging on/off while the USB is connected

Added ability to change the Host mode driver. Currently three drivers are present: S3C High-speed (the default), S3C Low-speed/Full-speed (this disables USB 2 mode. Use this if you want to have USB 1 compatibility), and DWC (a separate driver for the same OTG specification, that will probably get into upstream)

Fixed some small issues regarding cleanup after cable is disconnected

The DWC driver does NOT yet work, it will probably crash your phone if you try to use it. I however hope that I will be able to fix it. The other two drivers work well of course. Note that you have to turn off host mode if you want to change the driver (then turn it back on).

Also note that to change the charging mode you have to unplug every cable from the phone before changing the charging mode. In ICS it seems that the small battery icon on the top and the lock screen will still say the phone is charging, but the battery menu in the settings will properly tell you they are mistaken and the battery does not charge indeed.

Usb Host Controller has also changed to version 0.2.

I made a separate thread for it: http://xdaforums.com/showthread.php?t=1468531

Changes include stability fixes, a new icon, support for the new features mentioned above (changing drivers, disabling charger, etc.) and two nice commands:

Reset USB device

Re-read partition table

The latter command should probably solve a few issues where the flash drive was recognized, but there were no partitions to mount. It also solves the issues of connecting other Android devices. (Simply re-read the partition table after you have enabled usb mass storage mode on the other android, and you will be able to get files from the other phone too)

This is now an anykernel based ROM, I hope it works, and doesn't break the WIFI

Downloads at the usual location
[Nexus S Android Development] deani77:
Just get SGS2 USB OTG cable today... using combo with Y-cable and USB hub... Manage to make my thumb drive... Nokia phone and Galaxy Y connected... I can access all the data. But still failed to get my digicam work... can't find way to mount it...
[Nexus S Android Development] MaXAiRO:
Do simple USB sticks, mice (wireless or wired) and keyboards work with this mod just by using USB OTG cable? I don't care about other drives, cameras etc. and don't want to mess with Y-cables.
[Nexus S Android Development] sztupy:
No. The phone does not give out power, so you'll need a source of external power be it a simple flash drive or mouse, or a large external powered one. And the simplest way to power the external devices is using an Y-cable.
[Nexus S Android Development] sztupy:
Does it use the mass storage protocol? Some cameras use the PTP protocol to access the images, which is not (yet) supported.
[Nexus S Android Development] deani77:
My aged digicam only have PTP protocol... thanks for the clarification...

Sent from my CM9 Nexus S
[Nexus S Android Development] sztupy:
Most Canons are still PTP/MTP only. Looking at the Android ICS API, it does have some PTP support though, so I might create an app for this, if there is none yet.
[Nexus S Android Development] deani77:
that great... thanks for bring USB otg to our NXS... with ICS and USB OTG now... I will stay with this device longer... no need to get new device in this near features...

Sent from my CM9 Nexus S
[Nexus S Android Development] deani77:
https://www.youtube.com/watch?v=1R16kf4WYtc&feature=youtube_gdata_player

Sent from my CM9 Nexus S
[Nexus S Android Development] skitapa:
Wow, build 5 is really awesome. Suddenly I can enumerate almost everything i put in the Usb slot. Keyboard, usb hub, played a little shine runner with my joypad. Now I was using sztupy kernel and got a SOD. I had setup host driver to full speed Usb, and am using cm9. I had mathkids awesome kernel before but so far he has not upgraded to build 5. I just flashed over his kernel wiping dalvik, could this be the issue?

I got my happy hacking keyboard to work in build 5 and even its own hub, is it possible to change layout to say swedish just changing key values in /system/usr/key*?

In linux I would have used xev to find the keycodes and i guess i could and just transfer them from linux for a localized keyboard?

Awsome job sztupy on this, donated small amount.
[Nexus S Android Development] sztupy:
I think this is what you're looking for: http://www.kandroid.org/online-pdk/guide/keymaps_keyboard_input.html
[Nexus S Android Development] Epic_VS:
I am still not able to mount my 4gb flash drive. Even after I reset the device and reset partition table. All of my other 2gb flash drives work.
[Nexus S Android Development] developersdevelopers:
That is rather strange. All three of my flash drives seem to work. What model/brand is your 4 GB one?
[Nexus S Android Development] skitapa:
Check if you burned it in another Computer. I wrecked two flashdrives hooking up the wrong power cords :-)

Luckily they are relativly cheap.
[Nexus S Android Development] Epic_VS:
it is generic, but it comes up as "FLASH Drive AU_USB20" on the computer and on the nexus s. pic(here)

The strange thing is that it works perfectly on the computer.
[Nexus S Android Development] skitapa:
Hmm, I noticed Now that there seems to be a problem with latest otg host software, The mount command seems to be fouled up. I cannot mount anything either right now.

Unfortunatly I have not backed up the otg host versions to be able to verify.
[Nexus S Android Development] sztupy:
You can download all versions from here: http://xdaforums.com/showthread.php?t=1468531
[Nexus S Android Development] sztupy:
1. What operating system(s)?

2. Does it have a partition table?

3. Have you tried reformatting / repartitioning it?
[Nexus S Android Development] Epic_VS:
Windows 7 64bit and Windows XP 32 bit

I don't know. I will get my ubuntu vm and use gparted maybe tomorrow

Yes. Reformatted within Windows to fat32. Will try to repartition/ reformat tomorrow.
[Nexus S Android Development] melvinchng:
Does it work with galaxys 2 OTG cable?
[Nexus S Android Development] SA-07:
Matrix v15.5 has build 5!
[Nexus S Android Development] deani77:
Yes... I'm using that cable now for my NXS...

Check my post...

http://xdaforums.com/showthread.php?p=21942556

Sent from my CM9 Nexus S
[Nexus S Android Development] developersdevelopers:
If you want a really cheap OTG connector, try this one http://www.dealextreme.com/p/micro-usb-on-the-go-host-otg-adapter-pair-50774

It works on my NS.
[Nexus S Android Development] melvinchng:
I'm outside US. I've found the cable, it is about ~4US$. Will get the cable when I'm free.

I've modified my old USB hub, add another USB input for the power, I have a 5000mAh battery as power input for the USB. And I don't have to use wall charger as power source...
[Nexus S Android Development] cahir_cz:
Doesnt work on my nexus s :/ Ive got the lil usb (m)-usb(f) from dealextreme, old hub with added power supply. I can manage to get "root hub detected", but no devices show up. Also getting lots of "inconsistent conditions" stuff.

Trying on oodie's miui. Tried two different thumb drives, one mouse, one keyboard. Nothing shows up :(
[Nexus S Android Development] developersdevelopers:
I couldn't get it to work initially either, until I made my own Y cable used in conjunction with the Nexus S charger. So you can try doing that, or maybe get a different hub (make sure its a 2.0 hub).

There are a couple other things you could try like using different cables, power sources, etc. Just keep trying. Its definitely worth it. :P
[Nexus S Android Development] sztupy:
As developersdevelopers pointed out there are unfortunately a lot of things that can go wrong as both the harware and the software is a bit off. You should try out different combinations, like not using a hub first, or using other types of cables, etc.
[Nexus S Android Development] cahir_cz:
The hub was sort of buggy. Removed it, made Y usb cable, got mouse working (cool thingy). Now it also detects my flashdrive but refuses to mount it because of "Mount: no such file or directory"
[Nexus S Android Development] sztupy:
Try mounting it somewhere else. Is it fat32?
[Nexus S Android Development] cahir_cz:
yes, it is fat32. and ive tried all sorts of places (both existing and not). Somewhere i get the "read-only filesystem", somewhere just the previous one

I don't really mind, the top priority for me is the keyboard, which works (from time to time). Now I have to make it battery powered and I'll be good to go

Also tried mounting via terminal, same result
[Nexus S Android Development] anubiss:
Pendrive OK, but Mouse not function. Why?
[Nexus S Android Development] sztupy:
Please post a dmesg log
[Nexus S Android Development] cahir_cz:
Wow, somehow i managed to get all the stuff working. Amazing job sztupy
[Nexus S Android Development] Romonster:
I just tried connecting my hdd trough Y-cable and otg cable. With otg mode and HS usb2 driver selected, nothing shows up on USB tab in the app, tried reconnecting everything many times but still nothing.

Then I changed host driver to usb1 and my drive showed up and i was able to mount partition and move stuff though it was slow.

Why doesn't my drive work in usb2 mode?

Btw, thanks for your amazing work.
[Nexus S Android Development] elfie:
+1

Got mouse to work but flashdrive is no go. It detects flash drives, but when I try to mount it it gives "Mount: no such file or directory"

EDIT:

Using Peter's ROM 02-02-12

Matr1x 15.5
[Nexus S Android Development] skitapa:
Check if you have the folder and that it is writable.
[Nexus S Android Development] melvinchng:
Just wanted to know does it support multiple drive? E.g. I have a hdd and pendrive connected, then can I copy the data from pendrive hdd?
[Nexus S Android Development] skitapa:
Of course it should, I cannot verify it right now. But you can mount several drives. It's no different from a computer, if it's found, it works:)
[Nexus S Android Development] hedpe:
I tried using the build 5 kernel with CM9 on my Nexus S, and the phone doesn't boot past the first Google screen. Is this kernel not available to run with CM9? I see it says ICS, but which ROM is this? The OTA ROM that was pushed out? I have a i9020a ... I thought that OTA was pulled... so I'm not sure which ROM to use this kernel with. It is an AnyKernel so I was hoping it would run with CM9.
[Nexus S Android Development] Epic_VS:
It should work. Try clearing dalvik cache. Or you can try Matr1x kernel
[Nexus S Android Development] hedpe:
thanks for the help, I tried clearing /cache in the recovery mode, and then installing the kernel, but that didn't help. Still stuck at Google.

Let me see if I can run the Matrix kernel... but I'm still curious why this won't run on CM9. Hmm...

---------- Post added at 05:19 PM ---------- Previous post was at 04:38 PM ----------

which is the exact kernel you are using? saw a matrix kernel in the kernel forum, but not sure it supports usb host
[Nexus S Android Development] SA-07:
Lmao it supports it.. its in the features list
[Nexus S Android Development] hedpe:
thanks, was on my phone and the code box with the features list wouldn't scroll
[Nexus S Android Development] elfie:
I do have the folder. It is on sdcard, so i would assume it is writable.
[Nexus S Android Development] skitapa:
OK, weird. Try this then, as a Longshot. Mount mnt rw, either by terminal or the easy way with root explorer. Create ehdd there and try to mount there instead of on sdram.
[Nexus S Android Development] elfie:
Will try in the evening once I get home.

Just to make sure, there is no size limitation on usb drives right? Mine is a 16 gig.
[Nexus S Android Development] developersdevelopers:
Not sure if there is a size limitation but my 16 GB drive mounts just fine.
[Nexus S Android Development] sztupy:
No size limitation. It has to be FAT32 though.
[Nexus S Android Development] melvinchng:
A hdd must be fat 32 too to run???
[Nexus S Android Development] cahir_cz:
Hi, i does anyone have a guide somewhere how to change the external keyboard (connected via usb) layout? Fiddling with the settings just affects the software keyboard layout which i do not want. Any help appreciated. Thank you
[Nexus S Android Development] hedpe:
I am having trouble getting my Nexus S to recognize my hub. I have loaded the kernel successfully on the phone, but the hardware side does not seem to work. I tried host mode, OTG, and auto-host. OTG and auto-host do not seem to do anything. Host mode says it finds a 7 port hub, however my hub is 4 ports and it will say this even if I don't plug in anything at all. Fully dmesg output:

http://pastebin.com/KhDCNQh6

I am using a powered USB hub:

http://www.amazon.com/D-Link-DUB-H4-High-Speed-4-Port/dp/B00006B7DA

From the hub, I connect to the phone by using a regular USB cable, and then a USB to usb micro adapter:

http://www.amazon.com/Micro-USB-Mal...YMU6/ref=sr_1_7?ie=UTF8&qid=1328849350&sr=8-7

No matter what I do, it doesn't seem to recognize it as a hub properly, and none of the devices connect to the hub.
[Nexus S Android Development] skitapa:
Try in usb1 mode
[Nexus S Android Development] hedpe:
no luck :\ when I do that it says "inconsistent state detected, reboot device" so I do and try again, and I get the same message.

I did some testing of power on my hub, and the ports to the connect devices give out power, but the port which connects the host (the phone) does not put out power. Is it important that power is given to the port the Nexus S is connected to?

Also, the port lights on the hub light up when the host detects/inits the hub, and this never happens

EDIT: Sorry, I just realized in all of the graphs that a USB OTG cable is necessary as the "last hop" to the phone. I believe that my cable from the hub to the phone is a regular USB cable, and a regular USB to micro-USB adapter. I don't think there is anything OTG about either connector.
[Nexus S Android Development] sztupy:
It's not nescessary. If you do not have an OTG cable just a simple gender-changer you have to use "auto-host" mode. Although it might not work correctly as in your case.
[Nexus S Android Development] Epic_VS:
maybe the hub doesn't support upstream power.
[Nexus S Android Development] FoulDroid:
how to install the .zip ?

Can i use RomManager ? or something else ?

thx :)
[Nexus S Android Development] Epic_VS:
Clockwork Recovery mod
[Nexus S Android Development] FoulDroid:
ok thank you :)
[Nexus S Android Development] cahir_cz:
Has anyone tried hdmi output via usb? Ive seen in local store some thingy which you plug in into usb and it serves as hdmi output. Would it work with our phones?
[Nexus S Android Development] skitapa:
Yes you need power to the usb on the phone. Do you have the y-cable? Phone - otg - y cable - hub and hub port.
[Nexus S Android Development] skitapa:
Sztupy, will there be a build 6? Just curious, keeps looking in this thread every day :-)
[Nexus S Android Development] sztupy:
hub1-0:1.0 is the root hub, not the one you have connected. You lack upstream power, that means the hub has to power the host as well.
[Nexus S Android Development] sztupy:
For a new build there needs to be new features, but there aren't any new features yet. I'm still trying to get both power and the DWC drier to boot, but I also have other projects in mind. UHC will be updated to support exfat and ntfs though in the near future.
[Nexus S Android Development] hedpe:
Great, thanks to the both of you confirmed that the lack of upstream power is the problem here. I am going to try to find a reasonable hub that provides upstream power.

Edit: Out of curiosity, are there hubs that provide upstream power? None of the ones that I have found provide it, so it always seems a Y cable is necessary.
[Nexus S Android Development] skitapa:
You can do what I did and skip the y-cable by cutting an usb extension cord in two and of the four cables two are red and black. Take a broken nexus charger if you have one or an equal one providing 5 volts and hook it up to the red and black cable. Just twist/solder the other two ones with the equal color one. And you are good to go :-)

Or you can take a regular usb cable and create a y-cable yourself, thats what I would do in your situation.

Good luck :-)
[Nexus S Android Development] gouthamsn:
Does it support any sort of audio out ? Can it be connected to a USB sound card etc ? Has anyone tried to use with with HDMI cable ?

---------- Post added at 11:16 AM ---------- Previous post was at 10:57 AM ----------

I was looking for something like this:

http://www.buy.com/pr/product.aspx?sku=216778522&sellerid=29345858
[Nexus S Android Development] sztupy:
It seems you have powered both the hub and the device.

What happens if you only connect the flash drive? (Or try another hub. It doesn't need to be powered as you already have power with the Y-cable)
[Nexus S Android Development] developersdevelopers:
The USB cables I used were from my local dollar store. I don't have the box anymore, but the next time I pass by that store I'll take a look at what brand it was.

There are some alphanumeric characters on the cables themselves, but with a quick google search I could not find them (LL84201 and E188601-1 if you're curious).

So basically I used the following for my set up:

-USB cables from dollar store (to make a Y cable with two female ends, one male)

-original Nexus S micro USB cable (not OTG)

-original Nexus S charger

Since you tried so many different power sources, I'm inclined to believe that your issue has something to do with cabling.

The cables used can definitely impact whether OTG works or not. I tried adding a simple USB extension cable (a different brand of cable) to my existing and working Y cable set up. I was no longer able to detect any USB peripherals with the extension in place.
[Nexus S Android Development] hedpe:
Thanks a bunch for the feedback, bud. You motivated me to roll my own 3-headed cable beast, and push aside the cables I bought online.

Now it works ;)

Connecting a micro-USB male, USB female, and USB male (for power):

IMG_0718 by gnychis, on Flickr

IMG_0719 by gnychis, on Flickr

The outcome:

IMG_0724 by gnychis, on Flickr

One working USB Host mode :D

Thanks for all of the feedback and help. In the end... the cables seem to make a huge difference.
[Nexus S Android Development] developersdevelopers:
Awesome! Glad to hear that it works.
[Nexus S Android Development] devgee:
THANKS sztupy , it WORKED for me!

I tried to connect a mouse, usb stick and a keyboard and everything worked for me!!!!!!

But a usb hub did not work!!
[Nexus S Android Development] coolfranz:
Yes!

The HDD won't light up, because it needs a signal from the device it is attached to. Without an external power source the HDD doesn't get this signal from the Nexus S.
[Nexus S Android Development] coolfranz:
Yes! Perhaps some time the Nexus is able to give out power, too.

There are also scenarios where it might be useful as it is now...
[Nexus S Android Development] Flukzr:
Well on the go IMHO means going more than a few days without the comforts of home. That means that you'd pack a small bag in which you could easily fit a Y cable and your charger or a battery pack.

I find it's more than useful for the SNS since the storage capacity is limited. With this you could potentially bring your whole music/movie collection to keep you entertained while on the go.
[Nexus S Android Development] sztupy:
This bug doesn't exist in stock Gingerbread Galaxy S. It exists on all ICS kernels on all other devices (including CM9 on SGS) though.

This is something I never experienced on SGS. Sometimes the usb host mode breaks, and usually it breaks client mode too, but the device works well after that, until you reset it. I only had a restart a few times. It might be because of NS is different than the SGS, or because of some other modifications of the kernel you are using impact USB host mode (CPU clock, memory settings, etc.)

This is not surprising if they are the only thing that you connect (eg no hub in between).

That won't work, as split transactions are not implemented in the kernel module. So you either use an USB 1.0 hub, or use an USB 2.0 hub, but switch the operation mode to USB 1.0. I managed to connect a mouse a keyboard an usb hard drive and a canon DSLR this way, and all worked, though it needed a lot of retries, and of course they only worked at USB 1.0 speeds.

I don't think there are that many differences between the two devices. You might try it using a kernel closer to stock (eg. the original usb host release), as a lot of other features might impact it's stability
[Nexus S Android Development] derekwilkinson:
i plugged in my nexus s to a usb hub and it will see a usb hdd enclosure and mount it but won't let me use a keyboard (tired a usb and one with a wireless usb adapter). any suggestions?
[Nexus S Android Development] samarium:
Read the original post and references were it refers to said devices.
[Nexus S Android Development] blackSVK:
Hi guys. I want to try this kernel. Are there any known issues?
[Nexus S Android Development] Lordofminor:
I have no luck with USB 2.0 hub, only USB 1.0, what can be the problem?
[Nexus S Android Development] Mario Christian Oquias:
Hi i have airkernel #186 that says it supports this functionality... i downloaded th usb host controller ,attached a usb otg cable.. attched a flash drive and it didnt work.. do i need to initialize the driver first? What do i do ? Need help ! Thanks inadvance
[Nexus S Android Development] Epic_VS:
USB Otg for the nexus s isn't powered it requires external power. Either make a y cable or use a powered USB hub
[Nexus S Android Development] Mario Christian Oquias:
i tried a hub that has external power . it still cant detect the devices . maybe my current kernel version is not capable yet .. can i just do a manual install of the files needed by this usb host controler ? so that it cn detect my usb. with out hurting air kernel.
[Nexus S Android Development] Epic_VS:
First make sure your hub supports upstream power. Does your phone charge when you plug it in? Also make sure you are using ics this doesn't support jb if I know correctly. I know that matr1x kernels for ics support this.
[Nexus S Android Development] kkkhattak:
Can i use this with stock jb/kernel??????
[Nexus S Android Development] Mario Christian Oquias:
thanks i found out that my hub has power supply but not so sure if its capable of upstream power . the phone doesnt charge .. what if i hack it and put a direct line from the power supply.. i think its just one of those ordinary hubs that has external power if the power is not sufficient... kinda like back up but still needs a power from the host...i know a bit when it comes to connecting wires and stuff..but i dont know the right connections..
[Nexus S Android Development] JAAPl:
First of all, tahnk you for your otg build!

I made myself a y cable and it recognizes my controller but it only works sometimes on my usb charger (5v 1a)

It doesn't work at all if i use my laptop as power source.

should i have a more powerful source or is my cable bad? (no soldering kit, just taped wire :o)
[Nexus S Android Development] superng888:
dude can you pm me how you made it working? :laugh: i have a usb otg cable but i dont know how to connect to it eventhough i used the right rom+kernel :highfive: thanks in advance!
[Nexus S Android Development] steven676:
You either need to turn off battery charging (not sure if there's an option in the app to do that, I've always used the shell), or use a more powerful charger. In my experience, with battery charging on, 0.7-1 A intermittently works, but the 0.5 A that a USB port or hub will provide doesn't. A 2 A charger (for a tablet, for instance) will happily charge your phone and supply bus power for USB at the same time. (With battery charging disabled, the 0.5 A from a powered hub or USB port is sufficient.)