termios B0 and drivers

Joel Sherrill joel.sherrill at oarcorp.com
Wed Nov 26 14:11:42 UTC 2014


Hi

Chris asked me about the valid use of B0 in termios. I
recalled it had special meaning and decided to dig it up.
It means hang up.

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/termios.h.html

tcsetattr() is clearer and says "the modem control lines shall no longer be
asserted. Normally, this shall disconnect the line."

http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcsetattr.html

I added debug asserts() to some libchip drivers since B0 == 0 which means
that converting it to a baud for division purposes can give a divide by 0.

Chris suggested catching it in termios somewhere in libcsupport and not
supporting it. Reading the Open Group pages, I think it is the obligation of
every setAttr method in drivers to protect themselves from divide by 0
or support it.

If we decide that drivers need to protect themselves, I will go back and
add an error check to the ones I modified to return not supported.

Thoughts?

--joel


More information about the devel mailing list