Use uint8_t for keyboard chars

This commit is contained in:
2025-09-19 21:00:33 +02:00
parent 504bdbd4ba
commit 1af0d1f5bc
3 changed files with 16 additions and 26 deletions

View File

@ -22,26 +22,18 @@ void ps2kbproc_init(Proc *proc) {
void ps2kbproc_fn(void) {
for (;;) {
int32_t kbchr = 0;
uint8_t *buf = (uint8_t *)&kbchr;
size_t total = 0;
uint8_t b = 0;
spinlock_acquire(&PS2KB_BUF.spinlock);
for (size_t i = 0; i < sizeof(kbchr); i++) {
if (rbuf_pop(&PS2KB_BUF.rbuf, &buf[i]) < 0) {
break;
}
total++;
}
spinlock_release(&PS2KB_BUF.spinlock);
if (total == sizeof(kbchr)) {
if (rbuf_pop(&PS2KB_BUF.rbuf, &b) == 0) {
spinlock_acquire(&PS2KBPROC->bcast_pipes.spinlock);
IpcPipe *head = PS2KBPROC->bcast_pipes.list;
while (head != NULL) {
ipc_pipewrite(head, (uint8_t *)&kbchr, sizeof(kbchr));
ipc_pipewrite(head, &b, 1);
head = head->next;
}
spinlock_release(&PS2KBPROC->bcast_pipes.spinlock);
}
spinlock_release(&PS2KB_BUF.spinlock);
}
}