Make termios options process-wise instead of global. Write ps2 drivers, but keep translation between scancode set 2/3 to set 1 enabled.

This commit is contained in:
Enrico Fraccaroli
2022-01-07 18:09:02 +01:00
parent 2461d82431
commit ac9b627fad
22 changed files with 633 additions and 216 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ typedef struct termios {
cc_t c_cc[NCCS]; ///< control characters
speed_t c_ispeed; ///< input speed
speed_t c_ospeed; ///< output speed
} termios;
} termios_t;
/// @brief These flags generally control higher-level aspects of input processing than the input
/// modes flags described in Input Modes, such as echoing, signals, and the choice of canonical
+5
View File
@@ -15,6 +15,11 @@ int isdigit(int c);
/// @return 1 on success, 0 otherwise.
int isalpha(int c);
/// @brief Check if the given value is a control character.
/// @param c The input character.
/// @return 1 on success, 0 otherwise.
int iscntrl(int c);
/// @brief Check if the given value is either a letter or a digit.
/// @param c The input character.
/// @return 1 on success, 0 otherwise.
+1 -3
View File
@@ -22,6 +22,7 @@
#define SEEK_CUR 1 ///< The file offset is set to its current location plus offset bytes.
#define SEEK_END 2 ///< The file offset is set to the size of the file plus offset bytes.
#ifndef __KERNEL__
/// @brief Writes the given character to the standard output (stdout).
/// @param character The character to send to stdout.
void putchar(int character);
@@ -40,7 +41,6 @@ int getchar();
/// @return The string received from standard input.
char *gets(char *str);
#ifndef __KERNEL__
/// @brief Same as getchar but reads from the given file descriptor.
/// @param fd The file descriptor from which it reads.
/// @return The read character.
@@ -107,7 +107,6 @@ int vsprintf(char *str, const char *fmt, va_list args);
/// @return On success, the function returns the number of items of the
/// argument list successfully filled. EOF otherwise.
int scanf(const char *fmt, ...);
#endif
/// @brief Read formatted data from string.
/// @param str String processed as source to retrieve the data.
@@ -117,7 +116,6 @@ int scanf(const char *fmt, ...);
/// argument list successfully filled. EOF otherwise.
int sscanf(const char *str, const char *fmt, ...);
#ifndef __KERNEL__
/// @brief The same as sscanf but the source is a file.
/// @param fd The file descriptor associated with the file.
/// @param fmt Format string, following the same specifications as printf.
+2 -2
View File
@@ -11,11 +11,11 @@
/// @param fd
/// @param termios_p
/// @return
extern int tcgetattr(int fd, termios *termios_p);
extern int tcgetattr(int fd, termios_t *termios_p);
/// @brief Set the state of FD to *TERMIOS_P.
/// @param fd
/// @param optional_actions
/// @param termios_p
/// @return
extern int tcsetattr(int fd, int optional_actions, const termios *termios_p);
extern int tcsetattr(int fd, int optional_actions, const termios_t *termios_p);
+5
View File
@@ -18,6 +18,11 @@ int isalpha(int c)
return ((c >= 65 && c <= 90) || (c >= 97 && c <= 122));
}
int iscntrl(int c)
{
return ((c >= 0x00 && c <= 0x1F) || (c == 0x7F));
}
int isalnum(int c)
{
return (isalpha(c) || isdigit(c));
+2 -2
View File
@@ -8,7 +8,7 @@
#include "sys/errno.h"
#include "bits/ioctls.h"
int tcgetattr(int fd, termios *termios_p)
int tcgetattr(int fd, termios_t *termios_p)
{
int retval;
__asm__ volatile("int $0x80"
@@ -22,7 +22,7 @@ int tcgetattr(int fd, termios *termios_p)
return retval;
}
int tcsetattr(int fd, int optional_actions, const termios *termios_p)
int tcsetattr(int fd, int optional_actions, const termios_t *termios_p)
{
int retval;
__asm__ volatile("int $0x80"