diff options
author | Ian Moffett <ian@osmora.org> | 2024-05-18 22:54:14 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-05-18 23:11:48 -0400 |
commit | ed31f8283ca62f550da28456bc190250d6495815 (patch) | |
tree | e242beb746cb87eaffaf382a2b013f9a20b5568b /sys/include | |
parent | a39658738ca07b4fa277a5e2de2c54ac731ee612 (diff) |
kernel: tty: Handle input processing better
- Fix copying logic in tty_read()
- Handle ICANON correctly
- Add ECHO c_lflag bit
- Add TTY_SOURCE_DEV and TTY_SOURCE_RAW defines
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include')
-rw-r--r-- | sys/include/sys/termios.h | 1 | ||||
-rw-r--r-- | sys/include/sys/tty.h | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/sys/include/sys/termios.h b/sys/include/sys/termios.h index 963c885..1fda67e 100644 --- a/sys/include/sys/termios.h +++ b/sys/include/sys/termios.h @@ -50,6 +50,7 @@ * Local flags */ #define ICANON 0x00000001U +#define ECHO 0x00000002U typedef uint32_t tcflag_t; typedef uint32_t speed_t; diff --git a/sys/include/sys/tty.h b/sys/include/sys/tty.h index c53ea73..342a1a7 100644 --- a/sys/include/sys/tty.h +++ b/sys/include/sys/tty.h @@ -38,6 +38,9 @@ #define TTY_RING_SIZE 32 +#define TTY_SOURCE_RAW 0x0001U /* Raw text */ +#define TTY_SOURCE_DEV 0x0002U /* Input from device (e.g keyboard) */ + struct tty_ring { char data[TTY_RING_SIZE]; /* Ring data */ off_t enq_index; /* Enqueue index */ @@ -48,6 +51,7 @@ struct tty { dev_t id; struct vcons_screen *scr; /* Console screen */ struct tty_ring ring; /* Input ring */ + struct tty_ring outring; /* Output ring */ struct spinlock rlock; /* Ring lock */ struct termios termios; /* Termios structure */ struct device *dev; /* Device pointer */ @@ -56,7 +60,7 @@ struct tty { extern struct tty g_root_tty; dev_t tty_attach(struct tty *tty); -int tty_putc(struct tty *tty, int c); +int tty_putc(struct tty *tty, int c, int flags); int tty_putstr(struct tty *tty, const char *s, size_t count); ssize_t tty_flush(struct tty *tty); |