[KERNEL][ICS-CM9 or JVU] USB Host mode (OTG) driver for SGS i9000 [BUILD 5]

siky_dude

Senior Member
Nov 21, 2010
3,218
1,531
0
Constanta
Hopefully this will be ported to the Nexus S. I am so excited. I will finally get expandable memory on the phone. Will the USB port be able to power a low powered usb device like a flash drive? :D:D:D
Is there a chance that this will work without having an external power source?

Maybe. In theory the S3C controller has the appropriate functionality, but in practice it might not work (for example there might be missing connections inside the PCB, etc.)
 

jamesd256

Senior Member
Feb 10, 2007
230
7
0
It would, but you don't actualy need to connect 4-5 pins together, it's just for auto-detection. My code has support for "simple" inverted cables using "auto-host" mode (which will trigger host mode for every type of cable plugged-in)
OK, I'm confused now - in your original series of posts you said that you need an OTG cable, but isn't that what an OTG cable is when you ground pin 4? Could you or someone perhaps explain briefly what a 'simple' inverted cable means?

Or could someone point to a definitive reference for how we can butcher a cable. I am definitely going down the carve->solder->glue gun route, because I'm cheap.

I can't wait to try this with my wireless USB set!
 

iJimaniac

Senior Member
Oct 19, 2011
1,365
418
0
Hey, I have a Samsung galaxy player 4.0; essentially the GT-I9000 without the phone part! How hard would it be for someone (me) with no developing experience to port this to the player? Could someone give me instructions on how to get started?
 

sztupy

Inactive Recognized Developer
Dec 21, 2008
1,061
876
0
London
sztupy.hu
OK, I'm confused now - in your original series of posts you said that you need an OTG cable, but isn't that what an OTG cable is when you ground pin 4? Could you or someone perhaps explain briefly what a 'simple' inverted cable means?
It means you simply chop of one end of a male USB-A - male micro-USB connector and solder a female USB-A connector on the chopped end. You get a female USB-A - male micro-USB connector just like any OTG cables, but _without_ the pins 4-5 shorted. This way it's not a "real" OTG cable, as it lacks this shorting, but that's only used for auto-detection anyway. My kernel code has features for this types of cheap, homemade cables, but they won't work on devices with "real" OTG support, as they depend on the autodetect functionality.
 

jamesd256

Senior Member
Feb 10, 2007
230
7
0
I have been waiting for a way to record high quality stereo sound into a smartphone for years - could this be it?

Let's say you could enumerate a USB 2.0 audio interface via this kernel that had linux drivers available. Would it then be possible to access this device via the NDK or SDK?

---------- Post added at 11:57 PM ---------- Previous post was at 11:50 PM ----------

It means you simply chop of one end of a male USB-A - male micro-USB connector and solder a female USB-A connector on the chopped end. You get a female USB-A - male micro-USB connector just like any OTG cables, but _without_ the pins 4-5 shorted. This way it's not a "real" OTG cable, as it lacks this shorting, but that's only used for auto-detection anyway. My kernel code has features for this types of cheap, homemade cables, but they won't work on devices with "real" OTG support, as they depend on the autodetect functionality.
Thanks for the explanation. I was hoping that's what you meant. Awesome that you could do that in your code. You don't really need to butcher anything then - if you're going into a powered hub that takes a USB-A male like the guy in this post:

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

Edit:

Shouldn't it be made clearer in the FAQ that a client cable is possible? I also note you state an OTG cable is required in your youtube video. Seems a shame, as it makes it more accessable that you can use a non OTG cable.
 
Last edited:

sztupy

Inactive Recognized Developer
Dec 21, 2008
1,061
876
0
London
sztupy.hu
Hopefully this will be ported to the Nexus S. I am so excited.
I definitely want to make a Nexus S port, but for that I need help from people, and probably also from some kernel/ROM developers mainly doing CM9/ICS work. (I don't yet want to port the stuff back to CM7/stock Gingerbread).

The captivate build was easy to make (although I still don't know whether it works or not), mainly because it shares code with teamhacksung's SGS CM9 build for which this kernel first appeared.

Whether self-powering will work or not is a grey zone. One thing is sure: it doesn't work yet. It can also happen that it works on some brands and not on others (for example it will work on a NS but not on an SGS, etc.)

My current priority is to get USB 1.x devices working, so keyboards, mice, game controllers, midi controllers, etc. should work too. After that comes stability, which the first release really lacks. And external power is the last in line (as it might be the hardest to solve... but I actually hope I'm mistaken here)
 

sztupy

Inactive Recognized Developer
Dec 21, 2008
1,061
876
0
London
sztupy.hu
Let's say you could enumerate a USB 2.0 audio interface via this kernel that had linux drivers available. Would it then be possible to access this device via the NDK or SDK?
If not from the SDK or NDK, you could still write native linux code to access the external sound card, and run your application as root (like the mounting of external storage devices is done in UHC at the moment). I don't know if there are any usb sound card drivers for ARM in the linux kernel though.
 

sztupy

Inactive Recognized Developer
Dec 21, 2008
1,061
876
0
London
sztupy.hu
have you got a uart setup? 619k between usb 4-5 d+and d- function as tx and rx... you can debug from within the SBL> prompt and turn on the power manually.
Haven't used a serial console on the phone. What's the easiest way to get / create a cable where pins 4-5 have a 619k resistance?

I saw this one here: http://attachments.xda-developers.com/attachment.php?attachmentid=443036&d=1289991784 which seems to be nice, though the best I thing I could find in the local store is a miniusb-microusb converter, where I could solder some wires to the miniusb part (as it's a bit easier to handle than a microusb). Not sure whether it has all 5 pins connected though.

Could you also direct me to a link where I could find more about SBL commands that can be used in a serial console? Thanks!
 

coooolboyz

Member
Jun 23, 2010
45
8
0
London
Yep, that would me an that. Although I don't know how much power we'll get out of it (for example it might not be enough to power an external, "powerless" hard drive. But even a small power should be enough to get usb devices work, that have their own power (like large external hard drives with separate power supply or digital cameras)
Hmmm the board's manual raises the hope by a lot regarding the phone's ability to power connected peripherals! I'm sorry - but I've to say this again, but it will be just plain amazing to get this working without external power!! :D

And let me say this what I've screamed in my head a hundred times - sztupy, this work which you have done so far is abso-f***ing-lutely spell bounding!!

I guess your priorities are as the following now:-

1. Get USB 1.x get working
2. Get NTFS working
...
...
...
n. Get self powered OTG working

Hopefully this will go in to CM9 tree - from where this will remain to be a part of all CM9 based kernels!!!

Once again - astounding work!! Take a million bows from me!
 

Unrealwolf

Senior Member
Jan 10, 2007
237
14
0
Saint-Petersburg
Great work, sztupy! Hope that you'll find a way to squeeze some power from SGS.

My setup (the same OTG cable that i bought for HP Touchpad (SGS2 one, i suppose), $12 chinese external 2400 mah battery charger, triple male USB-Y cable, female-to-female USB thing) works, 16gb flash card is visible, mountable, readable. Cyrillic file and folder names are all ???????????, but that's OK.
 

Attachments

Last edited:
  • Like
Reactions: bitblaster