<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/input/joydev.c, branch v4.11-rc6</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>Input: joydev - do not report stale values on first open</title>
<updated>2017-02-09T21:29:04+00:00</updated>
<author>
<name>Raphael Assenat</name>
<email>raph@raphnet.net</email>
</author>
<published>2016-12-29T18:23:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=45536d373a21d441bd488f618b6e3e9bfae839f3'/>
<id>45536d373a21d441bd488f618b6e3e9bfae839f3</id>
<content type='text'>
Postpone axis initialization to the first open instead of doing it
in joydev_connect. This is to make sure the generated startup events
are representative of the current joystick state rather than what
it was when joydev_connect() was called, potentially much earlier.
Once the first user is connected to joydev node we'll be updating
joydev-&gt;abs[] values and subsequent clients will be getting correct
initial states as well.

This solves issues with joystick driven menus that start scrolling
up each time they are started, until the user moves the joystick to
generate events. In emulator menu setups where the menu program is
restarted every time the game exits, the repeated need to move the
joystick to stop the unintended scrolling gets old rather quickly...

Signed-off-by: Raphael Assenat &lt;raph@raphnet.net&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Postpone axis initialization to the first open instead of doing it
in joydev_connect. This is to make sure the generated startup events
are representative of the current joystick state rather than what
it was when joydev_connect() was called, potentially much earlier.
Once the first user is connected to joydev node we'll be updating
joydev-&gt;abs[] values and subsequent clients will be getting correct
initial states as well.

This solves issues with joystick driven menus that start scrolling
up each time they are started, until the user moves the joystick to
generate events. In emulator menu setups where the menu program is
restarted every time the game exits, the repeated need to move the
joystick to stop the unintended scrolling gets old rather quickly...

Signed-off-by: Raphael Assenat &lt;raph@raphnet.net&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Input: joydev - use clamp() macro</title>
<updated>2017-02-01T18:39:40+00:00</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2017-01-28T19:01:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5ec69524d43095752510fdcdadc4a6baf50d7c18'/>
<id>5ec69524d43095752510fdcdadc4a6baf50d7c18</id>
<content type='text'>
We have a nice macro ensuring that the value is within certain range, let's
use it instead of open-coding.

Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have a nice macro ensuring that the value is within certain range, let's
use it instead of open-coding.

Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Input: joydev - remove unused linux/miscdevice.h include</title>
<updated>2016-12-18T23:55:47+00:00</updated>
<author>
<name>Corentin Labbe</name>
<email>clabbe.montjoie@gmail.com</email>
</author>
<published>2016-12-16T22:43:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=65dadffddbe44a60f8be9e95f264949ba1e547e9'/>
<id>65dadffddbe44a60f8be9e95f264949ba1e547e9</id>
<content type='text'>
This patch remove the inclusion of linux/miscdevice.h for joydev
since it does not use miscdevice.

Signed-off-by: Corentin Labbe &lt;clabbe.montjoie@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch remove the inclusion of linux/miscdevice.h for joydev
since it does not use miscdevice.

Signed-off-by: Corentin Labbe &lt;clabbe.montjoie@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Input: joydev - recognize devices with Z axis as joysticks</title>
<updated>2016-09-27T03:03:06+00:00</updated>
<author>
<name>Ville Ranki</name>
<email>ville.ranki@iki.fi</email>
</author>
<published>2016-09-15T22:31:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9fb6de1b0bf4ec11573b76059da3c3b39ac7f2ff'/>
<id>9fb6de1b0bf4ec11573b76059da3c3b39ac7f2ff</id>
<content type='text'>
Current implementation of joydev's input_device_id table recognizes only
devices with ABS_X, ABS_WHEEL or ABS_THROTTLE axes as joysticks.

There are joystick devices that do not have those axes, for example TRC
Rudder device. The device in question has ABS_Z, ABS_RX and ABS_RY axes
causing it not being detected as joystick.

This patch adds ABS_Z to the input_device_id list allowing devices with
ABS_Z axis to be detected correctly.

Signed-off-by: Ville Ranki &lt;ville.ranki@iki.fi&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Current implementation of joydev's input_device_id table recognizes only
devices with ABS_X, ABS_WHEEL or ABS_THROTTLE axes as joysticks.

There are joystick devices that do not have those axes, for example TRC
Rudder device. The device in question has ABS_Z, ABS_RX and ABS_RY axes
causing it not being detected as joystick.

This patch adds ABS_Z to the input_device_id list allowing devices with
ABS_Z axis to be detected correctly.

Signed-off-by: Ville Ranki &lt;ville.ranki@iki.fi&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Input: joydev - fix possible ERR_PTR() dereferencing</title>
<updated>2015-10-06T23:38:40+00:00</updated>
<author>
<name>Javier Martinez Canillas</name>
<email>javier@osg.samsung.com</email>
</author>
<published>2015-10-06T22:23:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5b21e3c740b770fb2548a5a8ea66e544d114d0a8'/>
<id>5b21e3c740b770fb2548a5a8ea66e544d114d0a8</id>
<content type='text'>
Commit 5702222c9a7a ("Input: joydev - use memdup_user() to duplicate
memory from user-space") changed the kmalloc() and copy_from_user()
with a single call to memdup_user() but wrongly used the same error
path than the old code in which the buffer allocated by kmalloc() was
freed if copy_from_user() failed.

This is of course wrong since if memdup_user() fails, no memory was
allocated and the error in the error-valued pointer should be returned.

Fixes: 5702222c9a7a ("Input: joydev - use memdup_user() to duplicate
memory from user-space")
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Javier Martinez Canillas &lt;javier@osg.samsung.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit 5702222c9a7a ("Input: joydev - use memdup_user() to duplicate
memory from user-space") changed the kmalloc() and copy_from_user()
with a single call to memdup_user() but wrongly used the same error
path than the old code in which the buffer allocated by kmalloc() was
freed if copy_from_user() failed.

This is of course wrong since if memdup_user() fails, no memory was
allocated and the error in the error-valued pointer should be returned.

Fixes: 5702222c9a7a ("Input: joydev - use memdup_user() to duplicate
memory from user-space")
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Javier Martinez Canillas &lt;javier@osg.samsung.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Input: joydev - use memdup_user() to duplicate memory from user-space</title>
<updated>2015-10-02T18:44:16+00:00</updated>
<author>
<name>Javier Martinez Canillas</name>
<email>javier@osg.samsung.com</email>
</author>
<published>2015-10-02T18:12:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5702222c9a7af4a207066d54aa95cfe31f34f2f8'/>
<id>5702222c9a7af4a207066d54aa95cfe31f34f2f8</id>
<content type='text'>
The memdup_user() helper function can be used to duplicate a memory region
from user-space to kernel-space. There is no need to open code the same
logic using kmalloc() and copy_from_user() instead. This was found with
make coccicheck that reported the following warning:

drivers/input/joydev.c:447:10-17: WARNING opportunity for memdup_user
drivers/input/joydev.c:483:10-17: WARNING opportunity for memdup_user

Signed-off-by: Javier Martinez Canillas &lt;javier@osg.samsung.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The memdup_user() helper function can be used to duplicate a memory region
from user-space to kernel-space. There is no need to open code the same
logic using kmalloc() and copy_from_user() instead. This was found with
make coccicheck that reported the following warning:

drivers/input/joydev.c:447:10-17: WARNING opportunity for memdup_user
drivers/input/joydev.c:483:10-17: WARNING opportunity for memdup_user

Signed-off-by: Javier Martinez Canillas &lt;javier@osg.samsung.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'v4.2-rc3' into next</title>
<updated>2015-07-20T17:08:17+00:00</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2015-07-20T17:08:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c57d5621d2f2dc238f4b9c4d00b2a54187a75445'/>
<id>c57d5621d2f2dc238f4b9c4d00b2a54187a75445</id>
<content type='text'>
Sync up with Linux 4.2-rc3 to bring in infrastructure (OF) pieces.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sync up with Linux 4.2-rc3 to bring in infrastructure (OF) pieces.
</pre>
</div>
</content>
</entry>
<entry>
<title>Input: joydev - use for_each_set_bit where appropriate</title>
<updated>2015-07-09T04:50:58+00:00</updated>
<author>
<name>Anshul Garg</name>
<email>aksgarg1989@gmail.com</email>
</author>
<published>2015-07-08T23:41:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f23487cdbe3bd002e99f41250143014e522c34de'/>
<id>f23487cdbe3bd002e99f41250143014e522c34de</id>
<content type='text'>
Use for_each_set_bit to check for set bits in bitmap as it is more
efficient than checking individual bits.

Signed-off-by: Anshul Garg &lt;aksgarg1989@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use for_each_set_bit to check for set bits in bitmap as it is more
efficient than checking individual bits.

Signed-off-by: Anshul Garg &lt;aksgarg1989@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Input: joydev - don't classify the vmmouse as a joystick</title>
<updated>2015-05-21T22:58:27+00:00</updated>
<author>
<name>Thomas Hellstrom</name>
<email>thellstrom@vmware.com</email>
</author>
<published>2015-05-20T21:50:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=15397f153cfd69c2164c1fa593e26707ed1a3e72'/>
<id>15397f153cfd69c2164c1fa593e26707ed1a3e72</id>
<content type='text'>
Joydev is currently thinking some absolute mice are joystick, and that
messes up games in VMware guests, as the cursor typically gets stuck in
the top left corner.

Try to detect the event signature of a VMmouse input device and back off
for such devices. We're still incorrectly detecting, for example, the
VMware absolute USB mouse as a joystick, but adding an event signature
matching also that device would be considerably more risky, so defer that
to a later merge window.

Signed-off-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Joydev is currently thinking some absolute mice are joystick, and that
messes up games in VMware guests, as the cursor typically gets stuck in
the top left corner.

Try to detect the event signature of a VMmouse input device and back off
for such devices. We're still incorrectly detecting, for example, the
VMware absolute USB mouse as a joystick, but adding an event signature
matching also that device would be considerably more risky, so defer that
to a later merge window.

Signed-off-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Input: fix use-after-free introduced with dynamic minor changes</title>
<updated>2012-10-22T05:50:37+00:00</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2012-10-22T00:57:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4a215aade0baa0487d4644d7aef6f166c84c516e'/>
<id>4a215aade0baa0487d4644d7aef6f166c84c516e</id>
<content type='text'>
Commit 7f8d4cad1e4e ("Input: extend the number of event (and other)
devices") made evdev, joydev and mousedev to embed struct cdev into
their respective structures representing input devices.

Unfortunately character device structure may outlive the parent
structure unless we do not set it up as parent of character device so
that it will stay pinned until character device is freed.

Also, now that parent structure is pinned while character device exists
we do not need to pin and unpin it every time user opens or closes it.

Reported-by: Dave Jones &lt;davej@redhat.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Acked-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit 7f8d4cad1e4e ("Input: extend the number of event (and other)
devices") made evdev, joydev and mousedev to embed struct cdev into
their respective structures representing input devices.

Unfortunately character device structure may outlive the parent
structure unless we do not set it up as parent of character device so
that it will stay pinned until character device is freed.

Also, now that parent structure is pinned while character device exists
we do not need to pin and unpin it every time user opens or closes it.

Reported-by: Dave Jones &lt;davej@redhat.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Acked-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
