<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/input/misc/uinput.c, branch v3.16</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.16</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.16'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2014-02-12T23:00:34Z</updated>
<entry>
<title>Input: uinput - add UI_GET_SYSNAME ioctl to retrieve the sysfs path</title>
<updated>2014-02-12T23:00:34Z</updated>
<author>
<name>Benjamin Tissoires</name>
<email>benjamin.tissoires@redhat.com</email>
</author>
<published>2014-01-31T01:20:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e3480a61fca72d40d6dc4baaf37e94fcbfa95e19'/>
<id>urn:sha1:e3480a61fca72d40d6dc4baaf37e94fcbfa95e19</id>
<content type='text'>
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.

Signed-off-by: Benjamin Tissoires &lt;benjamin.tissoires@redhat.com&gt;
Reviewed-by: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: uinput - breaks by goto out in uinput_ioctl_handler</title>
<updated>2014-01-31T01:30:57Z</updated>
<author>
<name>Benjamin Tisssoires</name>
<email>benjamin.tissoires@redhat.com</email>
</author>
<published>2014-01-31T01:16:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9d51e801dba0c79ae979ef2f6928e402eb41009b'/>
<id>urn:sha1:9d51e801dba0c79ae979ef2f6928e402eb41009b</id>
<content type='text'>
The current implementation prevents us to add variable-length ioctl.
Use a bunch of gotos instead of break to allow us to do so.

No functional changes.

Signed-off-by: Benjamin Tisssoires &lt;benjamin.tissoires@redhat.com&gt;
Reviewed-by: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: uinput - support injecting multiple events in one write() call</title>
<updated>2013-09-19T15:57:56Z</updated>
<author>
<name>Ryan Mallon</name>
<email>rmallon@gmail.com</email>
</author>
<published>2013-09-18T19:40:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cbf0541374e2fcfdfdcaf8365c957a137eb9feea'/>
<id>urn:sha1:cbf0541374e2fcfdfdcaf8365c957a137eb9feea</id>
<content type='text'>
Rework the code in uinput_inject_event so that it matches the code in
evdev_write and allows injecting more than one event, or zero events.

Signed-off-by: Ryan Mallon &lt;rmallon@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-next' of git://github.com/rydberg/linux into next</title>
<updated>2012-10-01T21:40:51Z</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2012-10-01T21:40:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7774036808011ceecc88cef01dfafcce39ed9fc5'/>
<id>urn:sha1:7774036808011ceecc88cef01dfafcce39ed9fc5</id>
<content type='text'>
Merge Henrik's updates to multitouch code. Even though Jiri already
pulled them in I need to do it too since my changes to evdev using
dynamic major would clash with them.
</content>
</entry>
<entry>
<title>Input: MT - Add flags to input_mt_init_slots()</title>
<updated>2012-09-19T17:50:18Z</updated>
<author>
<name>Henrik Rydberg</name>
<email>rydberg@euromail.se</email>
</author>
<published>2012-08-11T20:07:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b4adbbefc2099476a4f1020041c99f52cf3cd67d'/>
<id>urn:sha1:b4adbbefc2099476a4f1020041c99f52cf3cd67d</id>
<content type='text'>
Preparing to move more repeated code into the mt core, add a flags
argument to the input_mt_slots_init() function.

Reviewed-and-tested-by: Benjamin Tissoires &lt;benjamin.tissoires@enac.fr&gt;
Tested-by: Ping Cheng &lt;pingc@wacom.com&gt;
Acked-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Signed-off-by: Henrik Rydberg &lt;rydberg@euromail.se&gt;
</content>
</entry>
<entry>
<title>Input: uinput - fix formatting</title>
<updated>2012-08-22T05:29:55Z</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2012-07-30T05:48:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=54ce165ebd9d9494b64149e0d1ab4ddbf5ea908b'/>
<id>urn:sha1:54ce165ebd9d9494b64149e0d1ab4ddbf5ea908b</id>
<content type='text'>
Reformat the code to keep it within 80 columns.

Signed-off-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
</content>
</entry>
<entry>
<title>Input: uinput - specify exact bit sizes on userspace APIs</title>
<updated>2012-08-22T05:29:54Z</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2012-07-30T05:48:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c5b3533a82ef4b6ceae81b7675f8d6dadcc6f3ab'/>
<id>urn:sha1:c5b3533a82ef4b6ceae81b7675f8d6dadcc6f3ab</id>
<content type='text'>
Switch to using __u32/__s32 instead of ordinary 'int' in structures
forming userspace API.

Also internally make request_id unsigned int.

Signed-off-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
</content>
</entry>
<entry>
<title>Input: uinput - mark failed submission requests as free</title>
<updated>2012-08-22T05:29:54Z</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2012-07-30T05:48:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=00ce756ce53acdb82d408346e6a7b734ca9e5bad'/>
<id>urn:sha1:00ce756ce53acdb82d408346e6a7b734ca9e5bad</id>
<content type='text'>
If uinput_request_submit() fails after new request ID was allocated
we need to mark that request ID as free, otherwise it will always
stay occupied and we may run out of available IDs.

Signed-off-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
</content>
</entry>
<entry>
<title>Input: uinput - fix race that can block nonblocking read</title>
<updated>2012-08-22T05:29:53Z</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2012-07-30T05:48:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=22ae19c6e3c22b390952e90f452f26adad9b8687'/>
<id>urn:sha1:22ae19c6e3c22b390952e90f452f26adad9b8687</id>
<content type='text'>
Consider two threads calling read() on the same uinput-fd, both
non-blocking. Assume there is data-available so both will simultaneously
pass:
	udev-&gt;head == udev-&gt;tail

Then the first thread goes to sleep and the second one pops the message
from the queue. Now assume udev-&gt;head == udev-&gt;tail. If the first thread
wakes up it will call wait_event_*() and sleep in the waitq. This
effectively turns the non-blocking FD into a blocking one.

We fix this by attempting to fetch events from the queue first and only
if we fail to retrieve any events we either return -EAGAIN (in case of
non-blocing read) or wait until there are more events.

This also fixes incorrect return code (we were returning 0 instead of
 -EAGAIN for non-blocking reads) when an event is "stolen" by another
thread. Blocking reads will now continue to wait instead of returning 0
in this scenario.

Count of 0 continues to be a special case, as per spec: we will check for
device existence and whether there are events in the queue, but no events
will be actually retrieved.

Reported-by: David Herrmann &lt;dh.herrmann@googlemail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
</content>
</entry>
<entry>
<title>Input: uinput - return -EINVAL when read buffer size is too small</title>
<updated>2012-08-22T05:29:53Z</updated>
<author>
<name>David Herrmann</name>
<email>dh.herrmann@googlemail.com</email>
</author>
<published>2012-07-30T05:48:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f40033acc2d14acecd1b27a79dc8a0ad437e619a'/>
<id>urn:sha1:f40033acc2d14acecd1b27a79dc8a0ad437e619a</id>
<content type='text'>
Let's check whether the user-supplied buffer is actually big enough and
return -EINVAL if it is not. This differs from current behavior, which
caused 0 to be returned and actually does not make any sense, as
broken application will simply repeat the read getting into endless
loop.

Note that we treat 0 as a special case, according to the standard:

"Before any action described below is taken, and if nbyte is zero,
the read() function may detect and return errors as described below.
In the absence of errors, or if error detection is not performed,
the read() function shall return zero and have no other results."

Signed-off-by: David Herrmann &lt;dh.herrmann@googlemail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
</content>
</entry>
</feed>
