Requirement: 1.Jailbroken Iphone with BSD Subsystem installed (Search the web for jailbreak tutorials) 2.Iphone development toolchain for Mac OSX, Linux, Windows (Cygwin) or other OS. I use this http://code.google.com/p/winchain/ in Windows. 3.Sparkfun Ipod connector or breakout board see http://www.sparkfun.com/commerce/product_info.php?products_id=633 or http://www.sparkfun.com/commerce/product_info.php?products_id=8295 4.PC USB UART – optional, but used in this tutorial. You will need either a 3.3V level UART for PC (see http://www.sparkfun.com/commerce/product_info.php?products_id=718) or you will need an old style 12V level serial cable with a level converter like this one http://www.compsys1.com/workbench/On_top_of_the_Bench/Max233_Adapter/max233_adapter.html (see warning below) 5.A soldering iron will help you out 6.Microsoft Visual Studio – optional, but used in the source code examples for the PC serial port communication.
WARNING! Do not try to use a 12V level RS232 port for this without a level converter to ~3V, it will severely damage your Iphone or render it non-functional.
Hardware: The Dock Port In the Ipod/Iphone dock port, the pins we are concerned with are as follows Pin 1 Ground Pin 18 3.3V Power (+) Pin 12 TX also known as Serial Transmit Pin 13 RX also known as Serial Receive
To see a full description of all of the pins in the dock connector, see here: http://pinouts.ru/Devices/ipod_pinout.shtml
Connections: iPhone/iPod Touch RX should connect to TX of the connected device, TX to RX of the connected device, and Ground to the Ground of the connected device. If your device can be powered by a low amperage, 3.3V power source you may chose to connect PIN 18 as well and power your device directly from the iPhone/iPod Touch.
Sample Codes:
001
#include <stdio.h> /* Standard input/output definitions */
002
#include <string.h> /* String function definitions */
003
#include <unistd.h> /* UNIX standard function definitions */
004
#include <fcntl.h> /* File control definitions */
005
#include <errno.h> /* Error number definitions */
006
#include <termios.h> /* POSIX terminal control definitions */
007
008
static struct termios gOriginalTTYAttrs;
009
010
static int OpenSerialPort()
011
{
012
int fileDescriptor = -1;
013
int handshake;
014
struct termios options;
015
016
// Open the serial port read/write, with no controlling terminal, and don't wait for a connection.
017
// The O_NONBLOCK flag also causes subsequent I/O on the device to be non-blocking.
http://devdot.wikispaces.com/Iphone+Serial+Port+Tutorial Requirement:1.Jailbroken Iphone with BSD Subsystem installed (Search the web for jailbreak tutorials)2.Iphone development toolchain