Slashdot Mirror


The iPhone Serial Port Hack

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.'"

8 of 217 comments (clear)

  1. If u want linux in your smartphone by Anonymous Coward · · Score: 5, Insightful

    Get a Nokia N900 or Android.

  2. Not a secret by m2pc · · Score: 5, Informative

    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

  3. Re:Or by Joce640k · · Score: 5, Insightful

    Or, I dunno, a small netbook and a USB-to-serial cable. They're hardly massive.

    It's not like you don't know in advance when you're going to need a terminal. If you can remember to bring that massive dongle thing along you can remember a netbook.

    --
    No sig today...
  4. Oh Christ No!!!! by OzPeter · · Score: 5, Insightful

    <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>

    --
    I am Slashdot. Are you Slashdot as well?
  5. Old News by stokessd · · Score: 5, Informative

    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};

  6. Re:I may be missing something, but... by BitZtream · · Score: 5, Informative

    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.

    --
    Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
  7. Re:ipad by CannonballHead · · Score: 5, Funny

    You're plugging it in wrong.

  8. Re:Or by cbhacking · · Score: 5, Informative

    Meh... or you could get a N900 that comes with those tools *ALREADY INCLUDED* in the base OS.

    Package manager? Maemo is a modified Debian, and uses Apt.
    Shell? Default is Busybox, but the full system is in the repos.
    Build toolchain, including GCC? In the repos.
    OpenSSH and sshd? In the repos (also dropbear, if you prefer).
    Anything that's available as source and compiles on ARM? Go to town. You can even pull directly to the device using Subversion and other mackage managers.

    Seriously, arguing over whether iOS or Android is more open is like arguing over whether a Prius or a sports car is better for off-road driving. You're both doing it wrong. Get the right tool for the job.

    --
    There's no place I could be, since I've found Serenity...