dev: implement writing/reading input events to/from input devices
This commit is contained in:
20
dev/core.c
20
dev/core.c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user