Jump to content

Talk:Serial Programming/Serial Linux

Page contents not supported in other languages.
Add topic
From Wikibooks, open books for an open world

The termios simple example contains:

while (c!='q') {

 if (read(tty_fd,&c,1)>0) write(STDOUT_FILENO,&c,1); // if new data is available on the serial port, print it out if (read(STDIN_FILENO,&c,1)>0) write(tty_fd,&c,1); // if new data is available on the console, send it to the serial port 

}

This liveloop is terrible resource hog, but novices don't know this; nevertheless this get into many implementations.

  • In termios example variable rdset looks unused; looks like "select" part of loop was forgotten
  • Are you sure you want to explicitly set c_*flag to 0 after memsetting the whole structure?

Start a discussion about Serial Programming/Serial Linux

Start a discussion