PDA

View Full Version : [Req] Use iPhone as an USB Host Storage Device ?


lh99
09-16-2007, 03:52 PM
Now that the free SW unlock solution is here, maybe some of the iPhone hardware experts out there have had some time to dedicate to other cool hacks.

Any word on using the iPhone as a USB host? The iPods have had USB On-The-Go (which supports USB in both host and client mode) for quite some time now, but no one seems to have figured out how to use it. Except for the photo card reader, that is.

I really want to be able to plug my iPhone into my 80gb iPod to give me full access to my music library and videos on the big screen. I'm sure plenty of others are frustrated with the capacity of the iPhone too...

Girl.luvzer.mac
09-18-2007, 06:16 PM
Hey, this is what I've found: http://jima4media.wiki.zoho.com/iPhone-Contents.html
(My little geek-heart is soaring!).

I, too am looking in to connecting peripherals to the iphone via it's dock connector/pin out so as to extend the iphone with external memory/memory cards.

I'm a complete n00b as far as programming goes so I don't have much experience to offer you, but I'd love to plug away at this project with you if you'd like!

lh99
09-19-2007, 01:38 PM
This is actually looking a lot more feasible than I initially thought. According to this:

http://www.roughlydrafted.com/RD/RDM.Tech.Q3.07/4F7A7875-05C6-4018-AD86-6DC5A410D108.html

...the iPhone is already running a USB host kernel extension -- the touch screen is connected internally by USB HID. The Human Interface Device protocol isn't useful for data transfer (not at any significant speed anyway), but at least some of the framework for USB host mode is present.

I was also able to find some references to USB OTG C stacks (drivers) for ARM out on the web. Nothing free yet, but I'll keep looking around.

lh99
09-20-2007, 06:00 AM
Apple has a whole lot of information on interacting with USB through IOKit, which appears to run on the iPhone as mentioned above. Here's the main link:

http://developer.apple.com/documentation/DeviceDrivers/Conceptual/USBBook/index.html

I only spent about 10 minutes on this today, but I was able to compile USBSimpleExample from Xcode's example files and run it on the iPhone. The source code is in /Developer/Examples/IOKit/USB/ in case anyone wants to play around with it.

USBSimpleExample as-is doesn't do anything particularly useful, but if it finds the Product/Vendor ID specified in main, it will spit out some stuff. If it doesn't find anything, it runs and terminates silently. Since I can't connect any USB devices to my iPhone yet, the program does nothing. But it does compile and run without errors, so that's at least semi-encouraging.

If anyone knows the product & vendor ID for the touchscreen (or how to find it), I could try to access that. At least this would give us an idea of whether or not the IOKit stuff is working.

My plan now is to pull the USB pinout standards for OTG devices and see if I can make up an adapter to connect a USB memory stick. I'd have to imagine that the iPhone dock pinout is the same as the iPods as far as USB is concerned.

lh99
09-21-2007, 03:42 PM
We all know that the iPod 'Camera Connector' doesn't work with the iPhone, but I think it's a great platform for testing the feasibility of getting the iPhone to work as a USB host. I disassembled one last night and confirmed that according to this iPod pinout:

http://pinouts.ru/Devices/ipod_pinout.shtml

the Camera Connector wires the USB D+, D-, and GND signals directly from the dock connector to its USB port. The iPod/iPhone supplies +3.3v on pin 18, but +5v is required to operate as a USB host. To achieve this, the Camera Connector appears to have a DC-DC converter that supplies the V_bus pin on the outgoing USB port.

There is also a microcontroller on the board which I'm assuming communicated via the iPod serial lines to tell it to go into photo download mode. Based on limited testing, it probably controls the DC-DC converter as well, so when connected to the unsupported iPhone, the required 5v supply is turned off. I'm going to see if I can get that supply turned on manually...

Will see if I can post some pictures of the board tonight.

lh99
09-24-2007, 03:01 AM
So I was crossing my fingers that the iPhone would recognize that a device had been connected to its USB port and switch into Host mode. Didn't think it was that likely, but it was a bit of a letdown. I got no sign of a USB device from my test program with my memory stick plugged into my hacked Camera Connector.

So now I'm off to find a way to switch on host mode for the external port. I can't believe that Apple would have disabled it completely; I'm sure they plan to take advantage of OTG at eventually.

skyKing964
07-03-2008, 06:29 AM
If so can we speak?

louisk2
09-29-2008, 04:55 PM
Any progress?

kneeslasher
10-02-2008, 01:32 PM
This would be one of the most useful additions to the iPhone, which should have been there to begin with.

louisk2
10-10-2008, 09:29 AM
If the iPhone "does" have USB OTG (which isn't confirmed), then in order to use the dock connector as a Host Port, we need to find the USB ID pin.

Standard USB has 4 pins (D+ D- 5V G). USB OTG has 5 Pins (D+ D- 5V G & ID). The cable is what determines if the port is used as Host or Peripheral. The ID Pin is grounded to the G Pin on the host side of the cable, and on the peripheral side the ID Pin is left open.

So far in all of the iPod / iPhone Dock Connector Pinouts, the D+ D- 5V and G pins have been identified, but not the ID pin. That Pin needs to be found.

Then, all you need to do is get a dock breakout board, solder the ID Pin to the G pin and then solder a Female USB Host Port to the 4 standard USB pins.

louisk2
10-14-2008, 10:11 AM
If anyone has a jailbroken iPhone 3G with ssh and the bsd subsystem installed, could you run ioreg and dump the results on http://pastie.org and post the link?