Rearchitecture PS2KB driver using event buffers

This commit is contained in:
2025-10-05 19:48:15 +02:00
parent 247ef1bbd1
commit e9838d530f
10 changed files with 262 additions and 189 deletions

View File

@ -7,6 +7,7 @@
#define LINEBUF_MAX 1024
PID_t PID;
Dev_t ps2kbdev;
struct {
char *modestr;
@ -106,8 +107,9 @@ void do_mode_interactive(void) {
uint8_t b = 0;
for (;;) {
int32_t nrd = ipcpipe(PID, IPCPIPE_IN, IPCPIPE_READ, &b, 1);
if (nrd > 0) {
int32_t key = devctl(&ps2kbdev, DEV_PS2KBDEV_READCH, (uint8_t *)PID, 0, 0);
if (key > 0) {
b = (uint8_t)key;
switch (b) {
case C('C'):
case 0xE9:
@ -155,6 +157,8 @@ void main(void) {
}
if (CONFIG.mode == MODE_INTERACTIVE) {
devctl(&ps2kbdev, DEVCTL_GET_HANDLE, (uint8_t *)"ps2kbdev", 0, 0);
devctl(&ps2kbdev, DEV_PS2KBDEV_ATTCHCONS, (uint8_t *)PID, 0, 0);
do_mode_interactive();
} else if (CONFIG.mode == MODE_RUNFILE) {
if (CONFIG.filepath == NULL) {