uinput is used in the xorg-integration-tests suite and in the wayland test suite. These automated tests suites create many virtual input devices and then hook something to read these newly created devices. Currently, uinput does not provide the created input device, which means that we rely on an heuristic to guess which input node was created. The problem is that is heuristic is subjected to races between different uinput devices or even with physical devices. Having a way to retrieve the sysfs path allows us to find without any doubts the event node.
Showing the changes to include/uapi/linux (1 of 3 files). Show all
Unified · Split
| @@ -20,6 +20,8 @@ · 19 unmodified lines | ||
| 20 | 20 | * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org> |
| 21 | 21 | * |
| 22 | 22 | * Changes/Revisions: |
| 23 | + * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>) | |
| 24 | + * - add UI_GET_SYSNAME ioctl | |
| 23 | 25 | * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>) |
| 24 | 26 | * - update ff support for the changes in kernel interface |
| 25 | 27 | * - add UINPUT_VERSION |
| @@ -35,7 +37,7 @@ · 9 unmodified lines | ||
| 35 | 37 | #include <linux/types.h> |
| 36 | 38 | #include <linux/input.h> |
| 37 | 39 | |
| 38 | −#define UINPUT_VERSION 3 | |
| 40 | +#define UINPUT_VERSION 4 | |
| 39 | 41 | |
| 40 | 42 | |
| 41 | 43 | struct uinput_ff_upload { |
| @@ -73,6 +75,15 @@ struct uinput_ff_erase { · 31 unmodified lines | ||
| 73 | 75 | #define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase) |
| 74 | 76 | #define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase) |
| 75 | 77 | |
| 78 | +/** | |
| 79 | + * UI_GET_SYSNAME - get the sysfs name of the created uinput device | |
| 80 | + * | |
| 81 | + * @return the sysfs name of the created virtual input device. | |
| 82 | + * The complete sysfs path is then /sys/devices/virtual/input/--NAME-- | |
| 83 | + * Usually, it is in the form "inputN" | |
| 84 | + */ | |
| 85 | +#define UI_GET_SYSNAME(len) _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 300, len) | |
| 86 | + | |
| 76 | 87 | /* |
| 77 | 88 | * To write a force-feedback-capable driver, the upload_effect |
| 78 | 89 | * and erase_effect callbacks in input_dev must be implemented. |