dev: implement writing/reading input events to/from input devices

This commit is contained in:
2023-05-10 20:33:40 +01:00
parent ad8865fe66
commit 05395542a8
4 changed files with 242 additions and 0 deletions

View File

@@ -79,6 +79,26 @@ struct device *device_alloc(void)
return DEVICE_CAST(dev_object);
}
kern_status_t device_read(struct device *dev, void *buf, size_t size, size_t *bytes_read)
{
switch (dev->dev_type) {
case DEV_TYPE_INPUT:
return input_device_read(dev, buf, size, bytes_read);
default:
return KERN_UNSUPPORTED;
}
}
kern_status_t device_write(struct device *dev, const void *buf, size_t size, size_t *bytes_written)
{
return KERN_UNSUPPORTED;
}
struct device *cast_to_device(struct object *obj)
{
return DEVICE_CAST(obj);
}
static kern_status_t device_object_destroy(struct object *obj)
{
return KERN_OK;