Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Handhelds Hardware Hacking Iphone Build

The iPhone Serial Port Hack 217

An anonymous reader writes "The iPhone's little known secret, a hidden serial port, is revealed. 'The real benefit in all of this is that there are so many console packages for iPhone in Cydia now that you can have a fully functional computer, as useful as a Linux box, but without carrying around a laptop.'"
This discussion has been archived. No new comments can be posted.

The iPhone Serial Port Hack

Comments Filter:
  • by Anonymous Coward on Thursday October 28, 2010 @12:27PM (#34052666)

    Get a Nokia N900 or Android.

    • by H310iSe ( 249662 )

      exactly, this differs from what you can do with a new moto (or other snapdragon) phone... how? I mean, maybe I miss something

    • by rsborg ( 111459 ) on Thursday October 28, 2010 @01:47PM (#34053998) Homepage

      More recent ones have anti-tamper (Droid X [androidpolice.com]) or auto-reflash (G2 [maximumpc.com]), making it a pain to root.

      I honestly think Google is very disingenuous to say Android is open when many currently-selling actual devices are locked tighter than the iPhone.

      Perhaps Google is just happy that Android is "open to the carriers".

      You want a sure bet for an open system, go with the N900.

      • by mlts ( 1038732 ) *

        The N900 is nice, but like the Nexus 1, it isn't sold in the US anymore, unless one buys it from an importer for an inflated price. Visit store.nokia.com and hit the US link... page not found, and it isn't offered anywhere on the site.

      • by Spykk ( 823586 )

        I honestly think Google is very disingenuous to say Android is open when many currently-selling actual devices are locked tighter than the iPhone.

        I'm sure there are some cheap Linux based routers out there loading from an unflashable ROM chip. Does that mean Linux isn't open? Claiming that software isn't open because you can find it on locked down hardware doesn't make sense.

  • ipad (Score:3, Funny)

    by Anonymous Coward on Thursday October 28, 2010 @12:28PM (#34052684)

    i want to know why everytime i plug in my ipad the pc asks what kind of camera it is

  • by FranTaylor ( 164577 ) on Thursday October 28, 2010 @12:28PM (#34052690)

    I'm reminded of Linksys WRT-54G routers and such.

    You might need to do some surface mount soldering to get to the required connections.

    Very handy for booting up a Sun server.

    • by bhsx ( 458600 )
      Yeah, and for the amount of extra hardware you have to lug around for this "hack," you might as well just pick-up an old zaurus or something considerably more apt(no pun) in delivering a remote terminal.
      • I like the WRT54GL myself... I've got about 6 currently deployed, most running Tomato, one with OpenWRT... (at my parents, grandparents, ex's and my apartment) ... the best thing is that it's consistant, widely used and well supported hardware. The down side, is it's a bit under-powered by today's small net appliance standards, which many support USB file/printer sharing etc... I'd really like to see a current/next generation device as well supported... In this case, it's an extremely locked down piece of
      • I used to use an HP200LX [wikipedia.org] for that.

        I've still got it somewhere, haven't switched it on for a while though.

    • Re: (Score:3, Insightful)

      by AJ Mexico ( 732501 )
      How last century! What are we going to see next -- how to interface your iPhone to a paper tape reader/punch? Instead of this -- cut the cable, and get an RS-232 - to Bluetooth adapter, similar to this. [provantage.com] They are cheaper than the parts for this hack. The iPhone is a wireless device.
      • by RicoX9 ( 558353 )

        OK - That is COOL. No more being tied to the switch while trying to rewire? Killer.

      • Re: (Score:3, Interesting)

        by Miamicanes ( 730264 )

        > How last century! (...snip...) cut the cable, and get an RS-232 - to Bluetooth adapter

        Spoken by someone who's either a glutton for punishment, or has never experienced the joys of interacting with some piece of embedded hardware at low level through a bitchy, finicky translation layer like Bluetooth that was designed to fail rather than accidentally work without authentication and authorization.

        Remember, people use the phone's serial port to do things that are almost by definition unsupported, undocume

    • by makomk ( 752139 )

      More interestingly, on some of the HTC Android phones, the ExtUSB connector can apparently double up as a serial port if you use the correct cable. Not sure why - hardly anything uses that feature.

      • by Miamicanes ( 730264 ) on Thursday October 28, 2010 @05:27PM (#34057386)

        The Samsung Galaxy S family appears to have (among other things) a UART hidden on its USB port via the Fairchild FSA9480 chip.

        This thread at xda-developers ( http://forum.xda-developers.com/showthread.php?p=8834946 [xda-developers.com] ) suggests that if you put a 150k resistor (1% tolerance) between pins 4 and 5 and power up the phone, the two pins normally used for USB data will be repurposed as a serial console for the bootloader.

        You can also explicitly toggle the FSA9480's mode via software (though not necessarily without root and your own kernel extensions).

        Note that it's not using USB as serial... it's acting as an electronic crossbar, disconnecting the D+ and D- pins from the USB circuit, and connecting them to pins elsewhere that are a real UART. Think: old-fashioned telephone switchboard with patch cables and jacks that dynamically establish and tear down circuits as needed so a few physical pins can be put to occasional niche uses that wouldn't merit full-time pins of their own.

        Personally, I suspect two pins on the headphone jack can be nudged into acting as a UART as well. Sigh. What the mod community really needs is for someone to raise the cash to pay a company that does intelligence reports for consumer electronic devices to tear down the Epic4G (or some other variant) and draw up a schematic showing which externally-accessible pins are connected to what (and how) inside the phone. There's a lot of good stuff inside of these phones that's undocumented publicly or via the official kernel source. Lots 'o happy bitbanging ahead! :-)

  • Not a secret (Score:5, Informative)

    by m2pc ( 546641 ) on Thursday October 28, 2010 @12:30PM (#34052710)
    This isn't a "secret"... it's been in the iPhone (and iPod for that matter) for quite a long time. This same serial port is how 3rd party docks and cables control the device from the outside: http://www.adriangame.co.uk/ipod-acc-pro.html [adriangame.co.uk]
    • Re: (Score:3, Informative)

      by unts ( 754160 )

      THANK YOU!

      This is so far from a secret it's not even funny. Imagine if we'd only just discovered what those two pins on the connector did?

      Hell, even the breakout board the guy (who's original, non full page ad-encumbered article can be found here [blogspot.com]) bought has the bloody serial pins labelled.

      It's not remotely surprising that an embedded device has a UART on it. It's even less surprising that a device designed to interface with very simple dock devices has a UART exposed via its peripheral connector.

      What is su

  • by Anonymous Coward

    The iPhone's little known secret, a hidden serial port, is revealed. 'The real benefit in all of this is that there are so many console packages for iPhone in Cydia now that you can have a fully functional computer, as useful as a Linux box, but without carrying around a laptop.'

    Personally I think it would be far more practical and useful to use an iPad. The iPhone screen is just too small for practical use, however in an emergency the iPhone could be quite useful. But for somewhat frequent normal use, I have doubts.

    • by Hatta ( 162192 )

      The iPhone screen is just too small for practical use

      We're talking about a serial connection here. Is the iphone screen really too small to handle an 80x25 console?

      • by mattdm ( 1931 )

        The iPhone screen is just too small for practical use

        We're talking about a serial connection here. Is the iphone screen really too small to handle an 80x25 console?

        It's workable, but barely. There's already a bunch of SSH clients in the app store. If you want to actually interact, you need to have an app which has a translucent keyboard, and that takes some getting used to.

      • by mlts ( 1038732 ) *

        Android has a lot of good terminal emulator apps. However, the iPhone has a few ssh clients, and there are only two clients for jailbroken devices, one of them supports some gestures, one doesn't. Both are named Mobile Terminal, so good luck finding the right one. To boot, Cydia has a Mobile Terminal app, but will bomb out if installed and an attempted is made to be run.

        I'd love to see a full featured terminal app that can both work as a ssh client, as well as locally on Cydia. This, I'd pay decent mone

  • by Kenja ( 541830 ) on Thursday October 28, 2010 @12:30PM (#34052718)
    Could have sworn there was more to these computer things then that.
    • by $RANDOMLUSER ( 804576 ) on Thursday October 28, 2010 @12:58PM (#34053164)
      Reminds me of the story from The Zen of Programming:

      A novice went into the master's cubicle and saw a new computer sitting upon the master's desk. "What is that computer?" asked the novice. The master placed his hand upon a small box that was connected to the computer by a wire. "Behold," said the master, "This device controls what we see on the screen. The screen simulates a desk. For example, here is a filing cabinet and a trash depository. Here also is a typewriter and a calculator." "This is a wonderful invention," whispered the novice in awe. "It is not as wonderful as it seems," said the master. "Can you see the two desks?" The novice nodded. "One is on the floor, the other is on the screen," he remarked. "Just so. Now, is there something missing on one of the two desks?" The novice pondered for a moment. "One of the desks does not have a computer on it," he said. The master shook his head. "Neither of the desks has a computer on it."

  • by kat_skan ( 5219 ) on Thursday October 28, 2010 @12:32PM (#34052766)
    If you'd like to read the article instead of Computer World's stupid-ass slide show, it's at http://resolvehax.blogspot.com/2010/10/iphone-serial-port.html [blogspot.com]
  • Linux box? (Score:2, Insightful)

    by Anonymous Coward

    Just get a Nokia N900. Nothing hidden there.

  • Cease and Desist (Score:2, Informative)

    Please don't use the hardware you purchased and is now yours for non-Apple authorized activities. Apple reserves the right to REMOVE and/or RESTRICT functionality in order to support our business model as we see fit.

    Apple
    • by Shadow Wrought ( 586631 ) * <.moc.liamg. .ta. .thguorw.wodahs.> on Thursday October 28, 2010 @12:46PM (#34052990) Homepage Journal
      Please don't use the hardware you purchased and is now yours for non-Apple authorized activities.

      How soon until you're just licensing that iPhone?
      • by idontgno ( 624372 ) on Thursday October 28, 2010 @12:59PM (#34053178) Journal

        Never. There's no need. You can own the hardware. You just can't use any of the software included until you agree to the license, and thereby agree to Apple's restrictions on how you use the hardware.

        That's the cleverness, really. They don't control your ownership of the hardware. So to a naive observer, you're completely in charge. But the moment you actually try to use any functionality embodied in the included software (i.e., anything capability beside "crappy doorstop" and "blender fodder"), Apple owns you. As long as your path coincides with Apple's decisions, you're golden. But try to do anything they don't want you to do... "You get nothing! you lose! Good day, Sir!"

        • Actually, you can now legally jailbreak your phone, and get your applications from the Cydia store. Then you can have your cake and eat it too.

          Nice FUD though. Let me guess, Android fan?

  • by Kynde ( 324134 ) <kynde.iki@fi> on Thursday October 28, 2010 @12:51PM (#34053060)

    as useful as a Linux box

    Sure.

    What next? They'll discover a hidden parallel port and what? It's supposed to stop world hunger?

  • Oh Christ No!!!! (Score:5, Insightful)

    by OzPeter ( 195038 ) on Thursday October 28, 2010 @12:52PM (#34053074)

    <sobbing level="softly">I don't want to go back to carrying gender changes, null modems, 9/15 pin changers as well as worrrying about DCE/DTE and handshaking ..... </sobbing>

    • Re: (Score:3, Funny)

      by clone53421 ( 1310749 )

      Pff. I’m still fiddling with gender changers, null modems, 9/15 pin changers, RS232 and RJ45 cables... oh, and this ancient boxy thing called a 1747-PIC...

    • I don't see any handshake signals, just transmit and receive data. No complicated protocol, no worry about host vs peripheral, just bits of data flowing in each direction. Sometimes simple is good.
    • I don't want to go back to carrying gender changes...

      Changing gender is a life-long thing. While I got my new birth certificate with an F on it nearly 25 years ago, I will need a new hormone prescription (if nothing else) from my doctor every year as long as I live.

  • "There you have it! All parts were acquired from eBay, Ridax and Jaycar."

    Steve Jobs: "NOOOOOOOOOOOOOOOOOOO!!!!"
  • by quarkoid ( 26884 ) on Thursday October 28, 2010 @01:00PM (#34053208) Homepage

    ...given that you can buy ipod breakout boards on ebay with the serial connectors clearly marked, it doesn't seem to be a particularly well kept secret.

    See http://cgi.ebay.co.uk/Enhanced-Breakout-Board-Ipod-Iphone-Ipad-/370447835814?pt=UK_CE_MP3Access_RL&hash=item56406962a6 [ebay.co.uk] for an example.

    • by BitZtream ( 692029 ) on Thursday October 28, 2010 @01:19PM (#34053506)

      Yea, its rather well documented on Apple's website actually. Its how third party vendors can control the iPod/iPhone.

      When you plug you iPod/iPhone into a car and start using your radio or steering wheel controls to change songs or whatever ... thats done through the serial port.

      Its all documented on Apples website for registered developers, including the control protocol. You can also find the information elsewhere on the web by those people who reverse engineered it to avoid being bound to Apples rules.

    • Re: (Score:2, Interesting)

      by Anonymous Coward

      The person who "discovered" the serial port in the article was even using such a break-out board.

  • ......I can put the psion5 out to grass.

    • Funny enough, I keep a Psion 5 on my desk for those odd occasions when I need a portable serial terminal.
  • Old News (Score:5, Informative)

    by stokessd ( 89903 ) on Thursday October 28, 2010 @01:09PM (#34053354) Homepage

    This serial port has been around forever. All those cars with iPod integration use it for control and data. I've controlled the iPod functionality on every iPod I've had (since 3rd gen) as well as three iPhones using an Atmega controller. I year or so I shared some controller code for Arduino based atmega microconrollers.

    Here's how you control your iPhone or iPod music with an Arduino, easy peasy:

    Sheldon

    * /* Control iPod/iPhones from Arduino
    Sheldon Stokes
    Jan 3, 2009

    Standing on the shoulders of ipodLinux.org
    http://ipodlinux.org/wiki/Apple_Accessory_Protocol

    This send comands to the iPod as though it were a remote.
    These are the simple 2 byte commands that should work on all
    Apple iPods and iPhones starting with the 3rd Generation iPod

    *********** Commands (array index, command value, command description) **************
    0 0x00 Button Release
    1 0x01 Play/Pause
    2 0x02 Vol+
    3 0x04 Vol-
    4 0x08 Skip >
    5 0x10 Skip
    6 0x20 Next Album
    7 0x40 Prev Album
    8 0x80 Stop
    */

    int commandBytes[]={0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
    int checkSum;

    int playPin = 2;
    int stopPin = 3;
    int fwdPin = 4;
    int backPin = 5;

    int playVal, stopVal, fwdVal, backVal;

    void setup()
    {
    Serial.begin(19200);

    pinMode(playPin, INPUT);
    pinMode(stopPin, INPUT);
    pinMode(fwdPin, INPUT);
    pinMode(backPin, INPUT);

    }

    void loop()
    {

    playVal = digitalRead(playPin); // read play button
    stopVal = digitalRead(stopPin); // read stop button
    fwdVal = digitalRead(fwdPin); // read fwd button
    backVal = digitalRead(backPin); // read back button

    if (playVal == LOW)
    {
    sendRequest(commandBytes[1]); // send play command
    sendRequest(commandBytes[0]); // send button release
    }
    else if (stopVal == LOW)
    {
    sendRequest(commandBytes[8]); // send stop command
    sendRequest(commandBytes[0]); // send button release
    }
    else if (fwdVal == LOW)
    {
    sendRequest(commandBytes[4]); // send stop command
    sendRequest(commandBytes[0]); // send button release
    }
    else if (backVal == LOW)
    {
    sendRequest(commandBytes[5]); // send stop command
    sendRequest(commandBytes[0]); // send button release
    }

    delay(100);
    }

    void sendRequest(int val) {
    checkSum = 0x100 - ((0x03 + 0x02 + val + 0) & 0xFF);
    int request[] = {0xFF, 0x55, 0x03, 0x02, 0x00, val, checkSum};

  • Apple decided to allow devices to use serial over the dock connector in February 2010. Why does the summary list it as a "little known secret"? It's hardly a secret that the dock connector which uses USB communicates via a serial connector. That's what the S stands for in USB, btw.

    Here's an article telling about the serial port OK from Apple last February:
    http://www.ilounge.com/index.php/news/comments/apple-approves-serial-port-to-dock-connector-design/ [ilounge.com]

  • by Animats ( 122034 ) on Thursday October 28, 2010 @01:12PM (#34053402) Homepage

    Yeah, it's got a serial port, with TTL levels, at its external connector. Big deal.

    It's also possible to attach USB devices [arstechnica.com], which is somewhat more useful today. For example, you can plug a real keyboard into an iPad.

    • Re: (Score:3, Funny)

      Yeah, it's got a serial port, with TTL levels, at its external connector. Big deal.

      You mock, but it IS a big deal.

      This means I can plug my iPhone into my Vic-20!

      • Seriously, a whole lot of embedded devices - sensors, microcontrollers, machinery, vehicles, booths - use RS232 (as simple, universal and VASTLY easier to program than USB)
        It would be pretty exciting news... if it wasn't iPhone, a platform so locked down that it's nearly useless for homebrew like that.

        • by Animats ( 122034 ) on Thursday October 28, 2010 @03:02PM (#34055420) Homepage

          Seriously, a whole lot of embedded devices - sensors, microcontrollers, machinery, vehicles, booths - use RS232 (as simple, universal and VASTLY easier to program than USB)

          Yes, when you do embedded work, you often find yourself going back 20 years in technology. There's progress, though. The trend in the embedded world is to put sensors and controllers on 10baseT. The traditional alternatives were either huge numbers of serial ports, or nonstandard proprietary networks. Both suck. 10baseT is quite robust electrically; it's noise-immune, balanced, and AC-coupled. This matters when you have heavy machinery around.

          USB is making some headway in the embedded world, but there's a problem - the standard USB connector has no retention mechanism. Ethernet cables latch in place, but USB connectors do not. There are now "high retention" USB connectors (they're orange) for industrial use, and at least three incompatible latching mechanisms. This is not happy-making for embedded system designers, who would like to use USB more, but can't tolerate plugs falling out.

  • Now you can use your iPhone to program your Arduino. </sarcasm>
  • The iPad uses the same pin outs and has serial port support as well.

    Cool hack for an iPhone, but you could do the same thing with an iPad to USB adapter [apple.com] and a USB=>RS232 adapter [dealextreme.com] in a smaller form factor.

    Two thumbs up for the hack though. I'm going to have to get a few of those breakout boards, my Sansa e200 has the same connector, just different pin outs.

You know you've landed gear-up when it takes full power to taxi.

Working...