Search code examples
clinuxubuntuserial-portcanonical-form

Writing to a serial port in C in linux: differences between canonical and non-canonical methods


Is there difference in code for writing to a serial port in C using canonical or non-canonical method?


Solution

  • yes, there is a major difference.

    The parameters of the communication port need to be modified to be transferring 'raw' or 'cooked' characters.

    'raw' transfers every char, exactly as it is received.

    'cooked' makes the I/O module handle control characters, back space, etc

    Suggest starting by reading the MAN page for tcgetattr() and reading about (and understanding) all the related functions.

    The functions are all part of the termios family of functions.