#include <acess/devices/pty.h>
// === CODE ===
+speed_t cfgetospeed(const struct termios *termios_p)
+{
+ return termios_p->c_oflag & CBAUD;
+}
+
int tcgetattr(int fd, struct termios *termios_p)
{
if( fd == -1 ) {
errno = EINVAL;
return -1;
}
+ _SysDebug("*termios_p = {%x,%x,%x,%x}",
+ termios_p->c_iflag, termios_p->c_oflag, termios_p->c_cflag, termios_p->c_lflag);
// Double-check `fd` describes a terminal
if( _SysIOCtl(fd, DRV_IOCTL_TYPE, NULL) != DRV_TYPE_TERMINAL ) {
return -1;
}
- struct ptymode mode = {0};
+ struct ptymode mode = {0,0};
if(termios_p->c_lflag & ICANON)
mode.InputMode |= PTYIMODE_CANON;
if(termios_p->c_lflag & ECHO)
mode.InputMode |= PTYIMODE_ECHO;
- _SysDebug("*termios_p = {%x,%x,%x,%x}",
- termios_p->c_iflag, termios_p->c_oflag, termios_p->c_cflag, termios_p->c_lflag);
+ _SysIOCtl(fd, PTY_IOCTL_SETMODE, &mode);
return 0;
}