<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/hid/hid-magicmouse.c, branch linux-5.16.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-01-27T11:02:44Z</updated>
<entry>
<title>HID: magicmouse: Fix an error handling path in magicmouse_probe()</title>
<updated>2022-01-27T11:02:44Z</updated>
<author>
<name>Christophe JAILLET</name>
</author>
<published>2021-12-28T21:09:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b439dda3160bb00737e61beec1493cdbf3e63d2e'/>
<id>urn:sha1:b439dda3160bb00737e61beec1493cdbf3e63d2e</id>
<content type='text'>
commit 33812fc7c8d77a43b7e2bf36a0d5a57c277a4b0c upstream.

If the timer introduced by the commit below is started, then it must be
deleted in the error handling of the probe. Otherwise it would trigger
once the driver is no more.

Fixes: 0b91b4e4dae6 ("HID: magicmouse: Report battery level over USB")
Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Tested-by: José Expósito &lt;jose.exposito89@gmail.com&gt;
Reported-by: &lt;syzbot+a437546ec71b04dfb5ac@syzkaller.appspotmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>HID: magicmouse: Report battery level over USB</title>
<updated>2022-01-27T11:02:15Z</updated>
<author>
<name>José Expósito</name>
</author>
<published>2021-11-18T16:52:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c394bd1bc8537e61593b6b6799e01495c7cf9008'/>
<id>urn:sha1:c394bd1bc8537e61593b6b6799e01495c7cf9008</id>
<content type='text'>
[ Upstream commit 0b91b4e4dae63cd43871fc2012370b86ee588f91 ]

When connected over USB, the Apple Magic Mouse 2 and the Apple Magic
Trackpad 2 register multiple interfaces, one of them is used to report
the battery level.

However, unlike when connected over Bluetooth, the battery level is not
reported automatically and it is required to fetch it manually.

Fix the battery report descriptor and add a timer to fetch the battery
level.

Signed-off-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: prevent division by 0 on scroll</title>
<updated>2021-11-19T14:54:31Z</updated>
<author>
<name>Claudia Pellegrino</name>
</author>
<published>2021-11-14T02:53:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a1091118e0d6d84c2fdb94e6c397ac790bfb9dd6'/>
<id>urn:sha1:a1091118e0d6d84c2fdb94e6c397ac790bfb9dd6</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>HID: magicmouse: high-resolution scroll threshold</title>
<updated>2021-07-15T19:16:39Z</updated>
<author>
<name>José Expósito</name>
</author>
<published>2021-07-07T15:58:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.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:39Z</updated>
<author>
<name>José Expósito</name>
</author>
<published>2021-07-07T15:58:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.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:35Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2021-05-17T10:04:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.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:34Z</updated>
<author>
<name>José Expósito</name>
</author>
<published>2021-05-10T06:22:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.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:15Z</updated>
<author>
<name>John Chen</name>
</author>
<published>2021-03-30T11:33:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.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:05Z</updated>
<author>
<name>John Chen</name>
</author>
<published>2021-03-30T11:33:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.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:21Z</updated>
<author>
<name>John Chen</name>
</author>
<published>2021-03-30T11:33:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.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>
</feed>
