just an idea ..
do you set up your serial port within your program ?
Perhaps there is a mix because of control lines .. try to do something like tcsetattr() with flags like CRTSCTS or ICRNL ...

PS : perhaps you can read a whole line using
ICANON (NMEA stuff is always smaller than 255)

PPS : I have
    modprobe proc_gpio
    echo "AF2 in" >/proc/gpio/GPIO46
    echo "AF1 out" >/proc/gpio/GPIO47
in my init script for ttyS2 ..

On 4/8/06, Mark Sayer <msayer@neocomm.com.au> wrote:
Howdy folks -
I have a little app which opens /dev/ttyS2 and reads NMEA data through the serial port. This application works fine while the usb cable is plugged in. But as soon as the usb cable is removed, it stops receiving serial data through ttyS2. If the unit is booted with no usb cable connected, it also doesn't read any serial data. However, if the usb cable is plugged in again, it starts receiving data.
Am using the following in a startup script (/etc/init.d/S99Serial) to configure the serial port:
        modprobe proc_gpio
        echo AF1 in > /proc/gpio/GPIO49
        echo AF1 out > /proc/gpio/GPIO48
        stty -F /dev/ttyS2 ixoff clocal ixany -ixon -echo -echonl ospeed 4800 ispeed 4800
My program uses open("/dev/ttyS2",O_RDONLY) to open the port, and read() to read 1 byte at a time. Nothing special.
I don't get it. I don't even have to log on using USBNET and ssh - as long as the cable is plugged in to the usb port, it seems to work. Not connected, no work.
I'm using a gumstix basix using the minidin connector.
Any advice really appreciated.

Jérôme Multrier
TinyCoach, un projet KaliBee