Thursday, September 07, 2006

OT: Talking to the screen

I've updated my new remote controlling setup further and I'm now able to manage my screen via it's serial port - yes the commercial grade Panasonic plasma screens come with a serial port! As my Shuttle's only serial port was already used for the IR-blaster, I bought a 2m USB-RS232C serial lead with an ftdi chipset from these guys.

It worked out-of-the-box and came up as /dev/ttyUSB0:

usb 3-1: new full speed USB device using ohci_hcd and address 2
usbcore: registered new driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
usbcore: registered new driver usbserial_generic
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB Serial Device
ftdi_sio 3-1:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT232BM
usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0
usbcore: registered new driver ftdi_sio
drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver

It even defaulted to the correct tty characteristics for me; 9600 baud, 8bits even, 1 stop bit. I now use this trivial script to control the screen via the usual irexec method:

#!/bin/sh
device=/dev/ttyUSB0

if [ -z "$1" ]; then
echo "Need to specify at least one command"
exit 1
fi

for cmd in $*; do
echo -en '\002'$cmd'\003' > $device
done