/dev/console

This commit is contained in:
Matheus
2022-08-20 15:15:10 -03:00
parent f7e5b5ba67
commit 9c6ce452f8
8 changed files with 56 additions and 43 deletions
+37
View File
@@ -0,0 +1,37 @@
#include <kernel/consoledev.h>
#include <kernel/devman.h>
#include <kernel/liminetty.h>
#include <errno.h>
#include <arch/panic.h>
#define CONSOLE_MAJOR 1
static int isatty(int minor){
return 0;
}
static int read(int *error, int dev, void* buff, size_t count, size_t offset){
*error = ENOSYS;
return -1;
}
static int write(int *error, int dev, void* buff, size_t count, size_t offset){
*error = 0;
liminetty_writeuser(buff, count);
return count;
}
devcalls calls = {
read, write, isatty
};
void consoledev_init(){
if(devman_newdevice("console", TYPE_CHARDEV, CONSOLE_MAJOR, 0, &calls))
_panic("Failed to create console device", 0);
}