1 #include <lunaix/fctrl.h>
2 #include <lunaix/foptions.h>
3 #include <lunaix/input.h>
4 #include <lunaix/lunistd.h>
12 int fd = open("/dev/input/i8042-kbd", 0);
15 write(STDOUT, "fail to open", 13);
19 struct input_evt_pkt event;
21 while (read(fd, &event, sizeof(event)) > 0) {
22 if (event.pkt_type == PKT_PRESS) {
23 write(STDOUT, "PRESSED: ", 10);
25 write(STDOUT, "RELEASE: ", 10);
27 char c = event.sys_code & 0xff;
29 write(STDOUT, "\n", 2);