kbhit() function (uses termios)

Gene Smith gds at chartertn.net
Fri Sep 5 17:44:42 UTC 2008


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.

Thanks,
-gene





More information about the users mailing list