History

Input: uinput - rework ABS validation

Rework the uinput ABS validation to check passed absinfo data immediately, but do ABS initialization as last step in UI_DEV_CREATE. The behavior observed by user-space is not changed, as ABS initialization was never checked for errors. With this in place, the order of device initialization and abs configuration is no longer fixed. Userspace can initialize the device and afterwards set absinfo just fine.

David Herrmann committed 11 years ago

Commit fbae10d1 parent 052876f2 files · +58 −60Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/linux/uinput.h+13−16
@@ -72,13 +72,12 @@ struct uinput_setup { · 71 unmodified lines
72/**72/**
73 * UI_DEV_SETUP - Set device parameters for setup73 * UI_DEV_SETUP - Set device parameters for setup
74 *74 *
75 * This ioctl sets parameters for the input device to be created. It must be75 * This ioctl sets parameters for the input device to be created. It
76 * issued *before* calling UI_DEV_CREATE or it will fail. This ioctl supersedes76 * supersedes the old "struct uinput_user_dev" method, which wrote this data
77 * the old "struct uinput_user_dev" method, which wrote this data via write().77 * via write(). To actually set the absolute axes UI_ABS_SETUP should be
78 * To actually set the absolute axes, you also need to call the ioctl78 * used.
79 * UI_ABS_SETUP *before* calling this ioctl.
80 *79 *
81 * This ioctl takes a "struct uinput_setup" object as argument. The fields of80 * The ioctl takes a "struct uinput_setup" object as argument. The fields of
82 * this object are as follows:81 * this object are as follows:
83 * id: See the description of "struct input_id". This field is82 * id: See the description of "struct input_id". This field is
84 * copied unchanged into the new device.83 * copied unchanged into the new device.
@@ -87,9 +86,9 @@ struct uinput_setup { · 2 unmodified lines
87 * See below for a description of FF with uinput.86 * See below for a description of FF with uinput.
88 *87 *
89 * This ioctl can be called multiple times and will overwrite previous values.88 * This ioctl can be called multiple times and will overwrite previous values.
90 * If this ioctl fails with -EINVAL, you're recommended to use the old89 * If this ioctl fails with -EINVAL, it is recommended to use the old
91 * "uinput_user_dev" method via write() as fallback, in case you run on an old90 * "uinput_user_dev" method via write() as a fallback, in case you run on an
92 * kernel that does not support this ioctl.91 * old kernel that does not support this ioctl.
93 *92 *
94 * This ioctl may fail with -EINVAL if it is not supported or if you passed93 * This ioctl may fail with -EINVAL if it is not supported or if you passed
95 * incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the94 * incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the
@@ -109,12 +108,10 @@ struct uinput_abs_setup { · 13 unmodified lines
109 * UI_ABS_SETUP - Set absolute axis information for the device to setup108 * UI_ABS_SETUP - Set absolute axis information for the device to setup
110 *109 *
111 * This ioctl sets one absolute axis information for the input device to be110 * This ioctl sets one absolute axis information for the input device to be
112 * created. It must be issued *before* calling UI_DEV_SETUP and UI_DEV_CREATE111 * created. It supersedes the old "struct uinput_user_dev" method, which wrote
113 * for every absolute axis the device exports.
114 * This ioctl supersedes the old "struct uinput_user_dev" method, which wrote
115 * part of this data and the content of UI_DEV_SETUP via write().112 * part of this data and the content of UI_DEV_SETUP via write().
116 *113 *
117 * This ioctl takes a "struct uinput_abs_setup" object as argument. The fields114 * The ioctl takes a "struct uinput_abs_setup" object as argument. The fields
118 * of this object are as follows:115 * of this object are as follows:
119 * code: The corresponding input code associated with this axis116 * code: The corresponding input code associated with this axis
120 * (ABS_X, ABS_Y, etc...)117 * (ABS_X, ABS_Y, etc...)
@@ -124,9 +121,9 @@ struct uinput_abs_setup { · 3 unmodified lines
124 * UI_SET_ABSBIT, this ioctl will enable it.121 * UI_SET_ABSBIT, this ioctl will enable it.
125 *122 *
126 * This ioctl can be called multiple times and will overwrite previous values.123 * This ioctl can be called multiple times and will overwrite previous values.
127 * If this ioctl fails with -EINVAL, you're recommended to use the old124 * If this ioctl fails with -EINVAL, it is recommended to use the old
128 * "uinput_user_dev" method via write() as fallback, in case you run on an old125 * "uinput_user_dev" method via write() as a fallback, in case you run on an
129 * kernel that does not support this ioctl.126 * old kernel that does not support this ioctl.
130 *127 *
131 * This ioctl may fail with -EINVAL if it is not supported or if you passed128 * This ioctl may fail with -EINVAL if it is not supported or if you passed
132 * incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the129 * incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t