managing termios for ser ports
I am trying to follow an example for simple serial port IO. ttyS0 for example.
I have a problem with the termios values particularly c_cflag and or cfsetispeed / cfsetospeed.
For the funtion cfsetispeed for example, it refers to a value like B38400, which they say is defined as 38400, or, #define B38400 38400. But using the other method to set termios.c_cflag it's supposed to be an OR of varios controls, like ( CS8 | B38400 | CLOCAL | CREAD ) for instance. Here obvious B38400 = 38400 is obviously not compatible to this flag setting. The bits would conflict with others.
In my termbits.h it says the following
#define B38400 00000017 !!!!
NOTE it does NOT say
#define B38400 0x00000017
If I use cfsetispeed (with B38400) c_cflag is not changed ( using 38400 or 0x00000017 or B_38400 ).
I cannot make the serial port work, even though the "open" returns a good fd.
What is going on??