kbhit() function (uses termios)

Joel Sherrill joel.sherrill at OARcorp.com
Mon Sep 8 14:25:46 UTC 2008

Gene Smith wrote:
> The code I am trying to port to rtems uses kbhit() function (you hit a
> key with no echo and no ENTER/RETURN) to cause an action based on the
> key pressed. Although I am not a big fan of having important things
> happen based on an unconfirmed key press, it does not seem to work for
> me in rtems. kbhit always returns 0 even after I press a key.
> The 3rd party code is copied from here:
> http://www.flipcode.com/archives/_kbhit_for_Linux.shtml
> but with the addition of a flag to turn off echo:
> term.c_lflag &= ~ECHO;
> Is there a reason this might not work in rtems?  It works ok in linux.
The code uses select on a serial port and select only
works on sockets in RTEMS.  This version uses standard
termios functionality to get to a non-blocking read.


May not be a perfect fit since it is just an example but it
uses things that work under RTEMS.
> Thanks,
> -gene
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users

Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

More information about the users mailing list