X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/a36758a5018f6a3792c164cd2a313d4f61b7111e..7b8a1bcad75628f9add4590db2bb9b8e418ee8eb:/lunaix-os/kernel/device/input.c diff --git a/lunaix-os/kernel/device/input.c b/lunaix-os/kernel/device/input.c index a96cb00..6ced39d 100644 --- a/lunaix-os/kernel/device/input.c +++ b/lunaix-os/kernel/device/input.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -8,7 +9,7 @@ static DEFINE_LLIST(listener_chain); -static struct device* input_devcat = NULL; +static struct device_cat* input_devcat = NULL; void input_init() @@ -69,7 +70,7 @@ __input_dev_read_pg(struct device* dev, void* buf, size_t offset) } struct input_device* -input_add_device(char* name_fmt, ...) +input_add_device(struct devclass* class, char* name_fmt, ...) { assert(input_devcat); @@ -79,12 +80,14 @@ input_add_device(char* name_fmt, ...) va_list args; va_start(args, name_fmt); - struct device* dev = - device_add(input_devcat, idev, name_fmt, DEV_IFSEQ, args); + struct device* dev = device_allocseq(dev_meta(input_devcat), idev); + + device_setname_vargs(dev_meta(dev), name_fmt, args); + register_device(dev, class, NULL); idev->dev_if = dev; - dev->read = __input_dev_read; - dev->read_page = __input_dev_read_pg; + dev->ops.read = __input_dev_read; + dev->ops.read_page = __input_dev_read_pg; va_end(args);