[PATCH 0/4] HID: add Apple Magic Mouse 2 support

From: John Chen
Date: Sat Mar 27 2021 - 09:37:58 EST


The HID descriptor of Magic Mouse 2 contains BTN_LEFT, BTN_RIGHT, REL_X,
REL_Y, whether it's charging, whether it's fully charged, and battery
capacity.

$ xxd -p report_descriptor
05010902a101851205091901290215002501950275018102950175068103
05010901a1001601f826ff073601fb46ff046513550d0930093175109502
8106750895028101c00602ff09558555150026ff0075089540b1a2c00600
ff0914a10185900584750195031500250109610585094409468102950581
0175089501150026ff0009658102c000

As hidinput can handle the BTNs and RELs, the Magic Mouse 2 already
functions as a basic mouse. Nevertheless, It should be reasonable to
extend hid-magicmouse to support Magic Mouse 2 as well. Furthermore,
hidinput is patched to handle the battery capacity.

This work is based on Recardo's, which is in turned based on Rohitpid's.
Their GitHub repositories are linked below:
https://github.com/RicardoEPRodrigues/magicmouse-hid
https://github.com/rohitpid/Linux-Magic-Trackpad-2-Driver

John Chen (4):
HID: magicmouse: add Apple Magic Mouse 2 support
HID: magicmouse: fix 3 button emulation of Mouse 2
HID: magicmouse: fix reconnection of Magic Mouse 2
HID: input: map battery capacity (00850065)

drivers/hid/hid-debug.c | 1 +
drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-input.c | 11 +++
drivers/hid/hid-magicmouse.c | 156 ++++++++++++++++++++++++++++-------
include/linux/hid.h | 3 +
5 files changed, 140 insertions(+), 32 deletions(-)

--
2.31.0