Lines Matching defs:dev

24 #define DEV_INPUT_DIR "/dev/input/"
37 struct uinput_device *dev;
39 dev = calloc(1, sizeof(*dev));
40 if (!dev)
43 dev->d = libevdev_new();
44 dev->dev_fd = -1;
45 dev->uinput_fd = -1;
48 libevdev_set_name(dev->d, name);
50 return dev;
57 struct uinput_device *dev;
59 dev = uinput_device_new(name);
60 if (!dev)
63 uinput_device_set_ids(dev, id);
65 rc = uinput_device_set_event_bits_v(dev, args);
68 rc = uinput_device_create(dev);
71 uinput_device_free(dev);
72 dev = NULL;
74 *d = dev;
93 uinput_device_free(struct uinput_device *dev)
95 if (!dev)
98 if (dev->uinput_fd != -1) {
99 (void)ioctl(dev->uinput_fd, UI_DEV_DESTROY, NULL);
100 close(dev->uinput_fd);
102 if (dev->dev_fd != -1)
103 close(dev->dev_fd);
104 libevdev_free(dev->d);
105 libevdev_uinput_destroy(dev->uidev);
106 free(dev);
110 uinput_device_get_fd(const struct uinput_device *dev)
112 return dev->dev_fd;
116 uinput_device_get_devnode(const struct uinput_device *dev)
118 return libevdev_uinput_get_devnode(dev->uidev);
128 fd = open("/dev/uinput", O_RDWR);
179 int uinput_device_set_name(struct uinput_device *dev, const char *name)
181 libevdev_set_name(dev->d, name);
185 int uinput_device_set_ids(struct uinput_device *dev, const struct input_id *ids)
187 libevdev_set_id_product(dev->d, ids->product);
188 libevdev_set_id_vendor(dev->d, ids->vendor);
189 libevdev_set_id_bustype(dev->d, ids->bustype);
190 libevdev_set_id_version(dev->d, ids->version);
195 uinput_device_set_bit(struct uinput_device* dev, unsigned int bit)
197 return libevdev_enable_event_type(dev->d, bit);
201 uinput_device_set_prop(struct uinput_device *dev, unsigned int prop)
203 return libevdev_enable_property(dev->d, prop);
207 uinput_device_set_event_bit(struct uinput_device* dev, unsigned int type, unsigned int code)
209 return libevdev_enable_event_code(dev->d, type, code, NULL);
213 uinput_device_set_event_bits_v(struct uinput_device *dev, va_list args)
225 rc = libevdev_enable_event_code(dev->d, type, code, NULL);
232 uinput_device_set_event_bits(struct uinput_device *dev, ...)
236 va_start(args, dev);
237 rc = uinput_device_set_event_bits_v(dev, args);
244 uinput_device_set_abs_bit(struct uinput_device* dev, unsigned int code, const struct input_absinfo *absinfo)
246 return libevdev_enable_event_code(dev->d, EV_ABS, code, absinfo);
250 uinput_device_event(const struct uinput_device *dev, unsigned int type, unsigned int code, int value)
252 return libevdev_uinput_write_event(dev->uidev, type, code, value);
255 int uinput_device_event_multiple_v(const struct uinput_device* dev, va_list args)
268 rc = uinput_device_event(dev, type, code, value);
274 int uinput_device_event_multiple(const struct uinput_device* dev, ...)
278 va_start(args, dev);
279 rc = uinput_device_event_multiple_v(dev, args);