obj: add read() and write() object callbacks

This commit is contained in:
2023-05-14 21:11:32 +01:00
parent 0238008986
commit d02d05d922
10 changed files with 91 additions and 28 deletions

View File

@@ -186,13 +186,14 @@ void kernel_init(uintptr_t arg)
create_kernel_thread(background_thread);
struct object *kbd_obj;
status = object_namespace_get_object(global_namespace(), "/dev/system/misc/input0", &kbd_obj);
struct object *kbd;
status = object_namespace_get_object(global_namespace(), "/dev/system/misc/input0", &kbd);
if (status != KERN_OK) {
printk("no keyboard available");
hang();
}
#if 0
struct device *kbd_dev = cast_to_device(kbd_obj);
if (!kbd_dev) {
printk("no keyboard available");
@@ -204,11 +205,12 @@ void kernel_init(uintptr_t arg)
printk("no keyboard available");
hang();
}
#endif
while (1) {
struct input_event ev;
size_t r;
status = device_read(kbd_dev, &ev, sizeof ev, &r);
status = object_read(kbd, &ev, sizeof ev, &r, 0);
if (status != KERN_OK || r != sizeof ev) {
printk("keyboard read error: %s", kern_status_string(status));