[uClinux-dev] tcsetattr(): Bug in setting Async I/O ?

Paul Romero paulr at rcom-software.com
Thu Aug 25 19:48:49 EDT 2005


Dear User Group:

When my program calls the following routine,
it seems to just hang forever after the first
call to tcsetattr(). The initial call to tcgetattr()
does work and returns  0 but, errno is set to 11--EAGAIN.

The environment is a  M5249C3 board with kernel version
2.4.x. and OS version 2.24.27--from uClinux-dist-20041215.tar.gz.

What I am trying to do is set  asynchronous I/O mode with
particular echo characteristics.

Has anybody seen this problem before ?


Best Regards,

Paul R.

************************************************************8

ROUTINE int UI_TOGGLE_RAW_ASYNC_INPUT()
{
 struct termios tsettings;
        tcflag_t echo;
 int n;
 int rval;

 rval = UI_OK;

 /*
  * Get current echo characteristics.
  */
 n = tcgetattr(STDIN_FILENO, &tsettings);
 echo = tsettings.c_lflag & (ECHO | ECHOCTL);

printf("RAWATT = %d, E = %d\r\n", n, errno);
fflush(stdout);
 /*
  * Make everything raw but preserve the current echo mode,
  * and async i/o. The variable indicates the current
  * echo mode.
  */
 cfmakeraw(&tsettings);
 tsettings.c_lflag |= echo;
 tsettings.c_cc[VMIN] = (cc_t ) 0;
 tsettings.c_cc[VTIME] = (cc_t ) 0;

 n = 0;
RETRY_RAW:
 errno = 0;
printf("%d\r\n", n);
fflush(stdout);
 if(tcsetattr(STDIN_FILENO, TCSAFLUSH, &tsettings) < 0)
   {
  if(errno == EINTR)
    {
   if(n++ < 10)
    goto RETRY_RAW;
    }
  printf("ui_init: Canon. Mode Config. Error = %d\r\n", errno);
fflush(stdout);
  rval = UI_ERROR;
   }
printf("RAW DONE\r\n");
fflush(stdout);

 return(rval);
}


--
Paul Romero

RCOM Communications Software

Phone/Fax: (510)339-2628
E-Mail: paulr at rcom-software.com





More information about the uClinux-dev mailing list