I'm having issues trying to log and forward data to a program (opencpn). I've got NMEA data coming in from a serial device via a RS232>USB converter. This is fine. I was having issues with opencpn resetting the ttyUSB1 connection which terminated the logging to the txt file, so I added tee and used socat to forward the data on to a virtual serial port so that opencpn can't interfere with the logging.

stty -F /dev/ttyUSB1 115200 raw
cat /dev/ttyUSB1 | formatdata | tee -a ~/LoggedData/formatteddata.txt &
sudo socat /dev/ttyUSB1,raw,echo=0 pty,link=/dev/ttyUSB13,mode=555,raw,echo=0,crnl &

I've got this to run on startup and after login when I 'cat /dev/ttyUSB13' I can see data, however it's a mess instead of a new NMEA sentence each line. If I enter the code into the terminal from scratch all is fine, NMEA sentences appear over ttyUSB13 just fine. The socat man page is a little confusing, can anyone put me in the right direction? Is there a better way to approach this?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.