Linux, Serial, C, and Intel vs. ARM

I'm working on some mcu stuff and I kept running into the same problems when writing code to talk to it on Linux. I've been writing code on my desktop, moving it to either my Chromebook or an RPi.

So I'm writing it down sos I remember. I thought it might be because of the ch341 UART adaptor I had on my shitty arduino clone, but I'm running into it elsewhere.

  • In c_iflag, IRCNL is set on be default on ARM, converting CR's into NL's. Annoying when you write stuff designed to be understood by humans and machines.
  • cfsetispeed and cfsetospeed don't seem to work. cfsetspeed does.
  • O_NONBLOCK never seems to work right. Leave it alone and use c_cc[VMIN || VTIME] instead, because that's smarter anyway.

There will probably be more here.