[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [PATCH 4/4] mini-os: Enable console to be configured as raw tty using termios



On Mon, Jun 05, 2017 at 12:48:07AM +0100, Simon Waterman wrote:
> Add minimal implementation of termios functions so that a console
> can be configured in raw mode if an application requires it.
> 
> Signed-off-by: Simon Waterman <watermansrdev@xxxxxxxxx>

TBH I don't know much about termios, so I will leave this patch to Ian.

> ---
>  lib/sys.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 42 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/sys.c b/lib/sys.c
> index 1420722..5f874af 100644
> --- a/lib/sys.c
> +++ b/lib/sys.c
> @@ -32,6 +32,7 @@
>  #include <xenbus.h>
>  #include <xenstore.h>
>  #include <poll.h>
> +#include <termios.h>
>  
>  #include <sys/types.h>
>  #include <sys/unistd.h>
> @@ -1436,6 +1437,47 @@ int nice(int inc)
>      return 0;
>  }
>  
> +/* Limited termios terminal settings support */
> +const struct termios default_termios = {0,           /* iflag */
> +                                        ONLCR,       /* oflag */
> +                                        0,           /* lflag */
> +                                        CREAD | CS8, /* cflag */
> +                                        {}};         /* cc */
> +
> +int tcsetattr(int fildes, int action, const struct termios *tios)
> +{
> +    if (files[fildes].type != FTYPE_CONSOLE) {
> +        errno = ENOTTY;
> +        return -1;
> +    }
> +
> +    if (tios->c_oflag & ONLCR)
> +        files[fildes].cons.dev->is_raw = 0;
> +    else
> +        files[fildes].cons.dev->is_raw = 1;

Assuming you agree with my suggestion to make is_raw bool, these should
be changed to true / false.

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.