linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Chen <johnchen902@gmail.com>
To: linux-input@vger.kernel.org
Cc: Rohit Pidaparthi <rohitpid@gmail.com>,
	RicardoEPRodrigues <ricardo.e.p.rodrigues@gmail.com>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	John Chen <johnchen902@gmail.com>
Subject: [PATCH v2 0/4] Hid: add Apple Magic Mouse 2 support
Date: Tue, 30 Mar 2021 19:33:15 +0800	[thread overview]
Message-ID: <20210330113319.14010-1-johnchen902@gmail.com> (raw)

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

Change v1->v2: An extra parameter is passed to hidinput_setup_battery
instead of directly modifying battery_{min,max}.

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      |  22 +++--
 drivers/hid/hid-magicmouse.c | 156 ++++++++++++++++++++++++++++-------
 include/linux/hid.h          |   3 +
 5 files changed, 145 insertions(+), 38 deletions(-)

-- 
2.31.0


             reply	other threads:[~2021-03-30 11:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 11:33 John Chen [this message]
2021-03-30 11:33 ` [PATCH v2 1/4] HID: magicmouse: add Apple Magic Mouse 2 support John Chen
2021-04-05 17:30   ` Felix Hädicke
2021-03-30 11:33 ` [PATCH v2 2/4] HID: magicmouse: fix 3 button emulation of Mouse 2 John Chen
2021-04-07 11:15   ` Jiri Kosina
2021-03-30 11:33 ` [PATCH v2 3/4] HID: magicmouse: fix reconnection of Magic " John Chen
2021-03-30 11:33 ` [PATCH v2 4/4] HID: input: map battery capacity (00850065) John Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210330113319.14010-1-johnchen902@gmail.com \
    --to=johnchen902@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=ricardo.e.p.rodrigues@gmail.com \
    --cc=rohitpid@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).