Kernel/debug - Clean up Debug() method, bind to #define config
[tpg/acess2.git] / Usermode / Libraries / libposix.so_src / termios.c
index 32fa9e1..d3aaefa 100644 (file)
 #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 ) {
@@ -59,6 +64,8 @@ int tcsetattr(int fd, int optional_actions, const struct termios *termios_p)
                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 ) {
@@ -73,8 +80,7 @@ int tcsetattr(int fd, int optional_actions, const struct termios *termios_p)
        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;
 }

UCC git Repository :: git.ucc.asn.au