<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/hid/hid-magicmouse.c, branch v5.15.7</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.7</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.7'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2021-12-01T08:04:48+00:00</updated>
<entry>
<title>HID: magicmouse: prevent division by 0 on scroll</title>
<updated>2021-12-01T08:04:48+00:00</updated>
<author>
<name>Claudia Pellegrino</name>
<email>linux@cpellegrino.de</email>
</author>
<published>2021-11-14T02:53:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=25bbaa3ae179a3001228b8dcab88135ae97b7911'/>
<id>urn:sha1:25bbaa3ae179a3001228b8dcab88135ae97b7911</id>
<content type='text'>
[ Upstream commit a1091118e0d6d84c2fdb94e6c397ac790bfb9dd6 ]

In hid_magicmouse, if the user has set scroll_speed to a value between
55 and 63 and scrolls seven times in quick succession, the
step_hr variable in the magicmouse_emit_touch function becomes 0.

That causes a division by zero further down in the function when
it does `step_x_hr /= step_hr`.

To reproduce, create `/etc/modprobe.d/hid_magicmouse.conf` with the
following content:

```
options hid_magicmouse scroll_acceleration=1 scroll_speed=55
```

Then reboot, connect a Magic Mouse and scroll seven times quickly.
The system will freeze for a minute, and after that `dmesg` will
confirm that a division by zero occurred.

Enforce a minimum of 1 for the variable so the high resolution
step count can never reach 0 even at maximum scroll acceleration.

Fixes: d4b9f10a0eb6 ("HID: magicmouse: enable high-resolution scroll")

Signed-off-by: Claudia Pellegrino &lt;linux@cpellegrino.de&gt;
Tested-by: José Expósito &lt;jose.exposito89@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>HID: magicmouse: high-resolution scroll threshold</title>
<updated>2021-07-15T19:16:39+00:00</updated>
<author>
<name>José Expósito</name>
<email>jose.exposito89@gmail.com</email>
</author>
<published>2021-07-07T15:58:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9d60648c607a2bfeef5e563e49de5d2e1b7a639a'/>
<id>urn:sha1:9d60648c607a2bfeef5e563e49de5d2e1b7a639a</id>
<content type='text'>
In order to avoid triggering involuntary high-resolution scroll events
due to tiny touch movement deltas, add a movement threshold.

The value chosen for the threshold, about 1.5 ~ 2 mm, is similar to the
threshold used on touchpads by libinput (see libinput
evdev-mt-touchpad-gestures.c) to try to keep the scroll experience
consistent.

Signed-off-by: José Expósito &lt;jose.exposito89@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>HID: magicmouse: enable high-resolution scroll</title>
<updated>2021-07-15T19:16:39+00:00</updated>
<author>
<name>José Expósito</name>
<email>jose.exposito89@gmail.com</email>
</author>
<published>2021-07-07T15:58:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d4b9f10a0eb64c623217eb5938d913974afbe9d2'/>
<id>urn:sha1:d4b9f10a0eb64c623217eb5938d913974afbe9d2</id>
<content type='text'>
The Magic Mouse, generations 1 and 2, doesn't have a physical scroll
wheel, instead, the REL_WHEEL and REL_HWHEEL events are emulated
when sliding a finger on the surface of the mouse.
However, the smooth movement of the finger is transformed into a step
based scroll on the screen, leading to a suboptimal user experience.

Emulate high-resolution scroll by sending REL_WHEEL_HI_RES and
REL_HWHEEL_HI_RES events so the scroll on the screen is closer to the
finger movement.

Signed-off-by: José Expósito &lt;jose.exposito89@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>HID: magicmouse: fix NULL-deref on disconnect</title>
<updated>2021-05-27T13:40:35+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2021-05-17T10:04:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4b4f6cecca446abcb686c6e6c451d4f1ec1a7497'/>
<id>urn:sha1:4b4f6cecca446abcb686c6e6c451d4f1ec1a7497</id>
<content type='text'>
Commit 9d7b18668956 ("HID: magicmouse: add support for Apple Magic
Trackpad 2") added a sanity check for an Apple trackpad but returned
success instead of -ENODEV when the check failed. This means that the
remove callback will dereference the never-initialised driver data
pointer when the driver is later unbound (e.g. on USB disconnect).

Reported-by: syzbot+ee6f6e2e68886ca256a8@syzkaller.appspotmail.com
Fixes: 9d7b18668956 ("HID: magicmouse: add support for Apple Magic Trackpad 2")
Cc: stable@vger.kernel.org      # 4.20
Cc: Claudio Mettler &lt;claudio@ponyfleisch.ch&gt;
Cc: Marek Wyborski &lt;marek.wyborski@emwesoft.com&gt;
Cc: Sean O'Brien &lt;seobrien@chromium.org&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>HID: magicmouse: fix crash when disconnecting Magic Trackpad 2</title>
<updated>2021-05-27T13:40:34+00:00</updated>
<author>
<name>José Expósito</name>
<email>jose.exposito89@gmail.com</email>
</author>
<published>2021-05-10T06:22:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4fb125192563670e820991de48f8db495ecc7ff7'/>
<id>urn:sha1:4fb125192563670e820991de48f8db495ecc7ff7</id>
<content type='text'>
When the Apple Magic Trackpad 2 is connected over USB it registers four
hid_device report descriptors, however, the driver only handles the one
with type HID_TYPE_USBMOUSE and ignores the other three, thus, no driver
data is attached to them.

When the device is disconnected, the remove callback is called for the
four hid_device report descriptors, crashing when the driver data is
NULL.

Check that the driver data is not NULL before using it in the remove
callback.

Signed-off-by: José Expósito &lt;jose.exposito89@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>HID: magicmouse: fix reconnection of Magic Mouse 2</title>
<updated>2021-04-07T11:15:15+00:00</updated>
<author>
<name>John Chen</name>
<email>johnchen902@gmail.com</email>
</author>
<published>2021-03-30T11:33:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c0dc5582812dfaf122a6eb188b0cd8e5ae4b0387'/>
<id>urn:sha1:c0dc5582812dfaf122a6eb188b0cd8e5ae4b0387</id>
<content type='text'>
It is observed that the Magic Mouse 2 would not enter multi-touch mode
unless the mouse is connected before loading the module. It seems to be
a quirk specific to Magic Mouse 2

Retrying after 500ms fixes the problem for me. The delay can't be
reduced much further --- 300ms didn't work for me. Retrying immediately
after receiving an event didn't work either.

Signed-off-by: John Chen &lt;johnchen902@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>HID: magicmouse: fix 3 button emulation of Mouse 2</title>
<updated>2021-04-07T11:15:05+00:00</updated>
<author>
<name>John Chen</name>
<email>johnchen902@gmail.com</email>
</author>
<published>2021-03-30T11:33:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3dcc5f7b45e037b0c6e84e4f757d16c55535db28'/>
<id>urn:sha1:3dcc5f7b45e037b0c6e84e4f757d16c55535db28</id>
<content type='text'>
It is observed that, with 3 button emulation, when middle button is
clicked, either the left button or right button is clicked as well. It
is caused by hidinput "correctly" acting on the event, oblivious to the
3 button emulation.

As raw_event has taken care of everything, no further processing is
needed. However, the only way to stop at raw_event is to return an error
(negative) value. Therefore, the processing is stopped at event instead.

[jkosina@suse.cz: fix comment style]
Signed-off-by: John Chen &lt;johnchen902@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>HID: magicmouse: add Apple Magic Mouse 2 support</title>
<updated>2021-04-07T11:14:21+00:00</updated>
<author>
<name>John Chen</name>
<email>johnchen902@gmail.com</email>
</author>
<published>2021-03-30T11:33:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2b0c086cd6f40648df73c30ea785e5c7777948da'/>
<id>urn:sha1:2b0c086cd6f40648df73c30ea785e5c7777948da</id>
<content type='text'>
Bluetooth device
	Vendor 004c (Apple)
	Device 0269 (Magic Mouse 2)

Add support for Apple Magic Mouse 2, putting the device in multi-touch
mode.

Co-authored-by: Rohit Pidaparthi &lt;rohitpid@gmail.com&gt;
Co-authored-by: RicardoEPRodrigues &lt;ricardo.e.p.rodrigues@gmail.com&gt;
Signed-off-by: John Chen &lt;johnchen902@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>HID: magicmouse: do not set up autorepeat</title>
<updated>2020-06-16T15:34:14+00:00</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2020-05-24T23:51:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6363d2065cd399cf9d6dc9d08c437f8658831100'/>
<id>urn:sha1:6363d2065cd399cf9d6dc9d08c437f8658831100</id>
<content type='text'>
Neither the trackpad, nor the mouse want input core to generate autorepeat
events for their buttons, so let's reset the bit (as hid-input sets it for
these devices based on the usage vendor code).

Cc: stable@vger.kernel.org
Reported-by: Yariv &lt;oigevald+kernel@gmail.com&gt;
Tested-by: Yariv &lt;oigevald+kernel@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152</title>
<updated>2019-05-30T18:26:32+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2019-05-27T06:55:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2874c5fd284268364ece81a7bd936f3c8168e567'/>
<id>urn:sha1:2874c5fd284268364ece81a7bd936f3c8168e567</id>
<content type='text'>
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation either version 2 of the license or at
  your option any later version

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 3029 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
