<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/input/misc/uinput.c, branch v3.0.33</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/input/misc/uinput.c?h=v3.0.33</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/input/misc/uinput.c?h=v3.0.33'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2011-03-31T07:02:39Z</updated>
<entry>
<title>Input: uinput - allow for 0/0 min/max on absolute axes.</title>
<updated>2011-03-31T07:02:39Z</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2011-03-31T05:25:34Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a718d79cc0e0c2f0aa82ba2c54383a18f15b7738'/>
<id>urn:sha1:a718d79cc0e0c2f0aa82ba2c54383a18f15b7738</id>
<content type='text'>
Some devices provide absolute axes with min/max of 0/0 (e.g. wacom's
ABS_MISC axis). Current uinput restrictions do not allow duplication of
these devices and require hacks in userspace to work around this.

If the kernel accepts physical devices with a min/max of 0/0, uinput
shouldn't disallow the same range.

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Signed-off-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
</content>
</entry>
<entry>
<title>Input: uinput - reversed test in uinput_setup_device()</title>
<updated>2011-02-21T09:02:34Z</updated>
<author>
<name>Dan Carpenter</name>
<email>error27@gmail.com</email>
</author>
<published>2011-02-18T16:30:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=163d27706bb91a648cc292151fc072e1e8cd4b4d'/>
<id>urn:sha1:163d27706bb91a648cc292151fc072e1e8cd4b4d</id>
<content type='text'>
The test here is reversed. It should be if (IS_ERR()) instead of
if (!IS_ERR()).

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
</content>
</entry>
<entry>
<title>Input: uinput - use memdup_user() and friends</title>
<updated>2011-02-21T09:02:28Z</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2011-02-11T09:10:45Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4dfcc271d587465f0d181c7636453ba4d0ec8acc'/>
<id>urn:sha1:4dfcc271d587465f0d181c7636453ba4d0ec8acc</id>
<content type='text'>
Instead of open-coding copying of data structures from userspace use
memdup_user() and strndup_user(). Note that this introduces change in
behavior because driver used to truncate 'phys' longer than 1024 bytes,
but now it will refuse to set 'phys' that long. Arguably trying to set
such 'phys' is suspect anyways.

Signed-off-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
</content>
</entry>
<entry>
<title>Input: uinput - fix setting up device name</title>
<updated>2011-02-21T09:02:28Z</updated>
<author>
<name>David Herrmann</name>
<email>dh.herrmann@googlemail.com</email>
</author>
<published>2011-02-11T09:10:44Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5d9d6e91b835796c21fbd7ce479880e5181be112'/>
<id>urn:sha1:5d9d6e91b835796c21fbd7ce479880e5181be112</id>
<content type='text'>
The check for non-empty device name was botched since we tried to account
for extra space for the terminating zero at the same time. Convert to
kstrndup() to avoid this problem.

Signed-off-by: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Acked-by: Aristeu Rozanski &lt;aris@ruivo.org&gt;
Signed-off-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
</content>
</entry>
<entry>
<title>Input: introduce device properties</title>
<updated>2010-12-20T08:37:33Z</updated>
<author>
<name>Henrik Rydberg</name>
<email>rydberg@euromail.se</email>
</author>
<published>2010-12-18T19:51:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=85b7720039fc000b561c20fe2aaa3b54cddae4a7'/>
<id>urn:sha1:85b7720039fc000b561c20fe2aaa3b54cddae4a7</id>
<content type='text'>
Today, userspace sets up an input device based on the data it emits.
This is not always enough; a tablet and a touchscreen may emit exactly
the same data, for instance, but the former should be set up with a
pointer whereas the latter does not need to. Recently, a new type of
touchpad has emerged where the buttons are under the pad, which
changes logic without changing the emitted data. This patch introduces
a new ioctl, EVIOCGPROP, which enables user access to a set of device
properties useful during setup. The properties are given as a bitmap
in the same fashion as the event types, and are also made available
via sysfs, uevent and /proc/bus/input/devices.

Acked-by: Ping Cheng &lt;pingc@wacom.com&gt;
Acked-by: Chase Douglas &lt;chase.douglas@canonical.com&gt;
Acked-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
Signed-off-by: Henrik Rydberg &lt;rydberg@euromail.se&gt;
</content>
</entry>
<entry>
<title>input: mt: Collect slots initialization code</title>
<updated>2010-12-16T09:41:12Z</updated>
<author>
<name>Henrik Rydberg</name>
<email>rydberg@euromail.se</email>
</author>
<published>2010-11-27T09:50:54Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8cde81001626c4c60b26ef2eb5fc522885ed9fd0'/>
<id>urn:sha1:8cde81001626c4c60b26ef2eb5fc522885ed9fd0</id>
<content type='text'>
The MT slots devices all follow the same initialization pattern
of creating slots and hinting about buffer size. Let drivers call
an initialization function instead, and make sure it can be called
repeatedly without side effects.

Signed-off-by: Henrik Rydberg &lt;rydberg@euromail.se&gt;
</content>
</entry>
<entry>
<title>input: mt: Break out slots handling</title>
<updated>2010-12-16T09:39:57Z</updated>
<author>
<name>Henrik Rydberg</name>
<email>rydberg@euromail.se</email>
</author>
<published>2010-11-27T08:16:48Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=47c78e891323513e9909729b44033e2c6649e2b7'/>
<id>urn:sha1:47c78e891323513e9909729b44033e2c6649e2b7</id>
<content type='text'>
In preparation for common code to handle a larger set of MT slots
devices, move the slots handling over to a separate file.

Signed-off-by: Henrik Rydberg &lt;rydberg@euromail.se&gt;
</content>
</entry>
<entry>
<title>Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl</title>
<updated>2010-10-22T17:52:56Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2010-10-22T17:52:56Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=092e0e7e520a1fca03e13c9f2d157432a8657ff2'/>
<id>urn:sha1:092e0e7e520a1fca03e13c9f2d157432a8657ff2</id>
<content type='text'>
* 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
  vfs: make no_llseek the default
  vfs: don't use BKL in default_llseek
  llseek: automatically add .llseek fop
  libfs: use generic_file_llseek for simple_attr
  mac80211: disallow seeks in minstrel debug code
  lirc: make chardev nonseekable
  viotape: use noop_llseek
  raw: use explicit llseek file operations
  ibmasmfs: use generic_file_llseek
  spufs: use llseek in all file operations
  arm/omap: use generic_file_llseek in iommu_debug
  lkdtm: use generic_file_llseek in debugfs
  net/wireless: use generic_file_llseek in debugfs
  drm: use noop_llseek
</content>
</entry>
<entry>
<title>llseek: automatically add .llseek fop</title>
<updated>2010-10-15T13:53:27Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2010-08-15T16:52:59Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6038f373a3dc1f1c26496e60b6c40b164716f07e'/>
<id>urn:sha1:6038f373a3dc1f1c26496e60b6c40b164716f07e</id>
<content type='text'>
All file_operations should get a .llseek operation so we can make
nonseekable_open the default for future file operations without a
.llseek pointer.

The three cases that we can automatically detect are no_llseek, seq_lseek
and default_llseek. For cases where we can we can automatically prove that
the file offset is always ignored, we use noop_llseek, which maintains
the current behavior of not returning an error from a seek.

New drivers should normally not use noop_llseek but instead use no_llseek
and call nonseekable_open at open time.  Existing drivers can be converted
to do the same when the maintainer knows for certain that no user code
relies on calling seek on the device file.

The generated code is often incorrectly indented and right now contains
comments that clarify for each added line why a specific variant was
chosen. In the version that gets submitted upstream, the comments will
be gone and I will manually fix the indentation, because there does not
seem to be a way to do that using coccinelle.

Some amount of new code is currently sitting in linux-next that should get
the same modifications, which I will do at the end of the merge window.

Many thanks to Julia Lawall for helping me learn to write a semantic
patch that does all this.

===== begin semantic patch =====
// This adds an llseek= method to all file operations,
// as a preparation for making no_llseek the default.
//
// The rules are
// - use no_llseek explicitly if we do nonseekable_open
// - use seq_lseek for sequential files
// - use default_llseek if we know we access f_pos
// - use noop_llseek if we know we don't access f_pos,
//   but we still want to allow users to call lseek
//
@ open1 exists @
identifier nested_open;
@@
nested_open(...)
{
&lt;+...
nonseekable_open(...)
...+&gt;
}

@ open exists@
identifier open_f;
identifier i, f;
identifier open1.nested_open;
@@
int open_f(struct inode *i, struct file *f)
{
&lt;+...
(
nonseekable_open(...)
|
nested_open(...)
)
...+&gt;
}

@ read disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
&lt;+...
(
   *off = E
|
   *off += E
|
   func(..., off, ...)
|
   E = *off
)
...+&gt;
}

@ read_no_fpos disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
... when != off
}

@ write @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
&lt;+...
(
  *off = E
|
  *off += E
|
  func(..., off, ...)
|
  E = *off
)
...+&gt;
}

@ write_no_fpos @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
... when != off
}

@ fops0 @
identifier fops;
@@
struct file_operations fops = {
 ...
};

@ has_llseek depends on fops0 @
identifier fops0.fops;
identifier llseek_f;
@@
struct file_operations fops = {
...
 .llseek = llseek_f,
...
};

@ has_read depends on fops0 @
identifier fops0.fops;
identifier read_f;
@@
struct file_operations fops = {
...
 .read = read_f,
...
};

@ has_write depends on fops0 @
identifier fops0.fops;
identifier write_f;
@@
struct file_operations fops = {
...
 .write = write_f,
...
};

@ has_open depends on fops0 @
identifier fops0.fops;
identifier open_f;
@@
struct file_operations fops = {
...
 .open = open_f,
...
};

// use no_llseek if we call nonseekable_open
////////////////////////////////////////////
@ nonseekable1 depends on !has_llseek &amp;&amp; has_open @
identifier fops0.fops;
identifier nso ~= "nonseekable_open";
@@
struct file_operations fops = {
...  .open = nso, ...
+.llseek = no_llseek, /* nonseekable */
};

@ nonseekable2 depends on !has_llseek @
identifier fops0.fops;
identifier open.open_f;
@@
struct file_operations fops = {
...  .open = open_f, ...
+.llseek = no_llseek, /* open uses nonseekable */
};

// use seq_lseek for sequential files
/////////////////////////////////////
@ seq depends on !has_llseek @
identifier fops0.fops;
identifier sr ~= "seq_read";
@@
struct file_operations fops = {
...  .read = sr, ...
+.llseek = seq_lseek, /* we have seq_read */
};

// use default_llseek if there is a readdir
///////////////////////////////////////////
@ fops1 depends on !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier readdir_e;
@@
// any other fop is used that changes pos
struct file_operations fops = {
... .readdir = readdir_e, ...
+.llseek = default_llseek, /* readdir is present */
};

// use default_llseek if at least one of read/write touches f_pos
/////////////////////////////////////////////////////////////////
@ fops2 depends on !fops1 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier read.read_f;
@@
// read fops use offset
struct file_operations fops = {
... .read = read_f, ...
+.llseek = default_llseek, /* read accesses f_pos */
};

@ fops3 depends on !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier write.write_f;
@@
// write fops use offset
struct file_operations fops = {
... .write = write_f, ...
+	.llseek = default_llseek, /* write accesses f_pos */
};

// Use noop_llseek if neither read nor write accesses f_pos
///////////////////////////////////////////////////////////

@ fops4 depends on !fops1 &amp;&amp; !fops2 &amp;&amp; !fops3 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
identifier write_no_fpos.write_f;
@@
// write fops use offset
struct file_operations fops = {
...
 .write = write_f,
 .read = read_f,
...
+.llseek = noop_llseek, /* read and write both use no f_pos */
};

@ depends on has_write &amp;&amp; !has_read &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier write_no_fpos.write_f;
@@
struct file_operations fops = {
... .write = write_f, ...
+.llseek = noop_llseek, /* write uses no f_pos */
};

@ depends on has_read &amp;&amp; !has_write &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
@@
struct file_operations fops = {
... .read = read_f, ...
+.llseek = noop_llseek, /* read uses no f_pos */
};

@ depends on !has_read &amp;&amp; !has_write &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
@@
struct file_operations fops = {
...
+.llseek = noop_llseek, /* no read or write fn */
};
===== End semantic patch =====

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Julia Lawall &lt;julia@diku.dk&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
</content>
</entry>
<entry>
<title>Input: uinput - setup MT usage during device creation</title>
<updated>2010-09-19T23:29:57Z</updated>
<author>
<name>Henrik Rydberg</name>
<email>rydberg@euromail.se</email>
</author>
<published>2010-09-19T23:25:36Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=38e7afe96c7c0ad900824911c61fdb04078033dc'/>
<id>urn:sha1:38e7afe96c7c0ad900824911c61fdb04078033dc</id>
<content type='text'>
The input devices created by uinput do not currently handle multitouch
properly. All events will appear as if they came from slot zero, and
the input event buffers are not adjusted. This patch creates the MT
slots during setup, and sets the number of events per packet based
on the MT usage.

Signed-off-by: Henrik Rydberg &lt;rydberg@euromail.se&gt;
Signed-off-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
</content>
</entry>
</feed>
