obj: add read() and write() object callbacks
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user