mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-21 10:50:06 +01:00
Make uinput-code backwards-compatible to missing UI_SET_PROPBIT ioctl
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
This commit is contained in:
parent
f9bdb66ab4
commit
ae738d29ea
1 changed files with 18 additions and 1 deletions
|
|
@ -40,6 +40,14 @@
|
||||||
|
|
||||||
#define SYS_INPUT_DIR "/sys/devices/virtual/input/"
|
#define SYS_INPUT_DIR "/sys/devices/virtual/input/"
|
||||||
|
|
||||||
|
#ifndef UINPUT_IOCTL_BASE
|
||||||
|
#define UINPUT_IOCTL_BASE 'U'
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UI_SET_PROPBIT
|
||||||
|
#define UI_SET_PROPBIT _IOW(UINPUT_IOCTL_BASE, 110, int)
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct libevdev_uinput *
|
static struct libevdev_uinput *
|
||||||
alloc_uinput_device(const char *name)
|
alloc_uinput_device(const char *name)
|
||||||
{
|
{
|
||||||
|
|
@ -132,9 +140,18 @@ set_props(const struct libevdev *dev, int fd, struct uinput_user_dev *uidev)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
rc = ioctl(fd, UI_SET_PROPBIT, prop);
|
rc = ioctl(fd, UI_SET_PROPBIT, prop);
|
||||||
if (rc == -1)
|
if (rc == -1) {
|
||||||
|
/* If UI_SET_PROPBIT is not supported, treat -EINVAL
|
||||||
|
* as success. The kernel only sends -EINVAL for an
|
||||||
|
* invalid ioctl, invalid INPUT_PROP_MAX or if the
|
||||||
|
* ioctl is called on an already created device. The
|
||||||
|
* last two can't happen here.
|
||||||
|
*/
|
||||||
|
if (errno == -EINVAL)
|
||||||
|
rc = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue