- Thread Starter
- #26
oOiOo
Thanks for the correction. Added a debug function to print out the contents of the termio struct after various operations within the open function. One after the initial getattrib and set speed functions, to set a baseline, another after setting various flags, another after the setattrib call, and a final getattrib again, and printing the results. It's clear that the setattrib id doing something, as there are changes on the final getattrib, but nothng works now, and seems like that the serial port has been left in an unrecoverable state. Haven't analysed the printed out values, but there are changes, which means that setattrib is doing something..Have done a for amount of network related and other programming on FreeBSD, but this is the first effort with serial lines. My code inspired by the Stevens Advanced programming in the unix environment, an excellent resource, as are the rest of his works.
Here's the debug function:
/* Debug: Print termios Struct Values */
void debug (struct termios *termio) {
printf ("\n%d", termio -> c_iflag); /* input modes */
printf ("\n%d", termio -> c_oflag); /* output modes */
printf ("\n%d", termio -> c_cflag); /* control modes */
printf ("\n%d", termio -> c_lflag); /* local modes */
printf ("\n%d", termio -> c_ispeed); /* input speed */
printf ("\n%x\n", termio -> c_ospeed); /* output speed */
return;
}