int
uinput_device_create(struct uinput_device* d)
{
- int type;
+ int type, code;
struct uinput_user_dev dev;
int rc;
int fd;
dev.id = d->d.ids;
for (type = 0; type < EV_MAX; type++) {
- int code;
int max;
int uinput_bit;
const unsigned long *mask;
dev.absmax[code] = d->d.abs_info[code].maximum;
dev.absfuzz[code] = d->d.abs_info[code].fuzz;
dev.absflat[code] = d->d.abs_info[code].flat;
- /* FIXME: uinput has no resolution */
+ /* uinput has no resolution in the device struct, we use
+ * EVIOCSABS below */
}
}
if (d->dev_fd == -1)
goto error;
+ /* write abs resolution now */
+ if (bit_is_set(d->d.bits, EV_ABS)) {
+ for (code = 0; code < ABS_MAX; code++ ) {
+ struct input_absinfo *abs;
+
+ /* can't change slots */
+ if (code == ABS_MT_SLOT)
+ continue;
+
+ if (!bit_is_set(d->d.abs_bits, code))
+ continue;
+
+ abs = &d->d.abs_info[code];
+ rc = ioctl(d->dev_fd, EVIOCSABS(code), abs);
+ if (rc < 0) {
+ printf("error %s for code %d\n", strerror(-rc), code);
+ goto error;
+ }
+ }
+ }
+
return 0;
error: