Friday, November 6, 2009

stty on a mac

Okay, I bought a mac. First step: listen to PrintfUART messages. Normally on Linux, you can do a
stty -F /dev/ttyUSBX 57600
tail -f /dev/ttyUSBX
Unfortunatly, this doesn't work on a mac. No combination of stty options seem to do the trick to change the baud rate. Since other programs can change the rate, I assume tcsetattr actually works correctly. Fortunatly, a quick python script will do the trick:
import sys,serial
ser = serial.Serial(sys.argv[1], 57600)
while not done:
try:
sys.stdout.write(ser.read(1))
except:
done = True