#include "../include/CommUart.h"#include"ComCommon.h"#include#include#include#include#include#include#include#include
using namespacestd;#define USR_DEBUG
static structtermios ori_attr, cur_attr;static __inline int tty_reset(void)
{if (tcsetattr(STDIN_FILENO, TCSANOW, &ori_attr) != 0)return -1;return 0;
}static __inline int tty_set(void)
{if ( tcgetattr(STDIN_FILENO, &ori_attr) )return -1;
memcpy(&cur_attr, &ori_attr, sizeof(cur_attr) );
cur_attr.c_lflag&= ~ICANON;//cur_attr.c_lflag |= ECHO;
cur_attr.c_lflag &= ~ECHO;
cur_attr.c_cc[VMIN]= 1;
cur_attr.c_cc[VTIME]= 0;if (tcsetattr(STDIN_FILENO, TCSANOW, &cur_attr) != 0)return -1;return 0;
}static __inline int kbhit(void)
{
fd_set rfds;structtimeval tv;intretval;/*Watch stdin (fd 0) to see when it has input.*/F