Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.

kbhit() for NIOS terminal

Altera_Forum
Honored Contributor II
1,460 Views

I need an implementation of kbhit() for the nios terminal in eclipse. I found the following example 

# include <termios.h> 

 

int kbhit(void)  

struct termios term, oterm; 

int fd = 0; 

int c = 0; 

tcgetattr(fd, &oterm); 

memcpy(&term, &oterm, sizeof(term)); 

 

 

i tried but i got an error, so i insertet the function "tcgetattr" directly 

# include <termios.h># include <sys/ioctl.h> 

 

int  

tcgetattr(int fd,struct termios *termios_p) 

return ioctl(fd,TCGETS,termios_p); 

 

-> Now i have the problem, that he can&#39;t find "TCGETS" !! it seems to be defined nowhere ?????
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
496 Views

Hi, 

 

Did you solve this non-blocking getch() issue. I have searched and searched to no avail. My next thought would be to create a thread to do it... 

Thanks 

 

Simon
0 Kudos
Altera_Forum
Honored Contributor II
496 Views

fcntl() should be supported, non-blocking operations (including getch()) certainly are.

0 Kudos
Reply