[Empeg-technical] Re: download.c and serial programming

wfaulk@empegbbs-noreply.merlins.org wfaulk at empegbbs-noreply.merlins.org
Fri Apr 4 10:36:00 2003


It seems like the major problem was depending on cfmakeraw() to DTRT.  That's a glibc extension, AFAICS.  On top of that, it appears that GNU's cfmakeraw manpage is incomplete as to what it does.*

Add to that my lack of prowess with serial programming (and, as I said, lack of programming prowess in general), and it became very complicated.

Regardless, despite the time it took me to make it work, it's not a complicated fix.  I don't really think you'd need my permission to fix it anyway, as you could just steal GNU's code, but you have my permission, nonetheless.


* Here's what the man page says:<pre>_cfmakeraw_ sets the terminal attributes as follows:
           termios_p-<c_iflag <= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
                           |INLCR|IGNCR|ICRNL|IXON);
           termios_p-<c_oflag <= ~OPOST;
           termios_p-<c_lflag <= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
           termios_p-<c_cflag <= ~(CSIZE|PARENB);
           termios_p-<c_cflag |= CS8;</pre>Here's the code from glibc-2.3.2 termios/cfmakeraw.c:<pre>/* Set *T to indicate raw mode.  */
void
cfmakeraw (t)
     struct termios *t;
{
  t-<c_iflag <= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
  t-<c_oflag <= ~OPOST;
  t-<c_lflag <= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
  t-<c_cflag <= ~(CSIZE|PARENB);
  t-<c_cflag |= CS8;
  t-<c_cc[VMIN] = 1;            /* read returns when one char is available.  */
  t-<c_cc[VTIME] = 0;
}</pre>Fine work, GNU guys!    




More information about the Empeg-technical mailing list