The authors of the brand new iPhone Hacks have posted one of the coolest hacks from the book: using a Cypress PSoC to connect an external serial keyboard to the iPhone, without jailbreaking. The great thing about this hack is that it can be adapted for other serial devices, including TTL serial, and the authors show you how to do all this in Chapter 12 of the book. It's amazing stuff. I built the circuit myself to test it out when I was tech-editing the chapter, and it really blew me away:

A number of industrious individuals have achieved what to some is the holy grail of iPhone accessories: an iPhone keyboard. But most have done it in a very hard-to-repeat manner, and few have shared the methods they used.

Expanding on their audio port modem, PerceptDev engineers Zack Gainsforth and George Dean developed a hardware and software solution that allows infrared keyboards to be used for typing on the iPhone, using less than $20 of electronics.

Zack used a Cypress PSoC microcontroller to emulate a simple modem, and then expanded it to detect an infrared signal or read from a USB host controller, which converts this signal to FSK for transmission to an iPhone.