From: Rafael Passos <rafael@rcpassos.me>
To: bentiss@kernel.org, david@readahead.eu, jikos@kernel.org
Cc: Shuah Khan <skhan@linuxfoundation.org>,
Brigham Campbell <me@brighamcampbell.com>,
Jori Koolstra <jkoolstra@xs4all.nl>,
Rafael Passos <rafael@rcpassos.me>,
linux-input@vger.kernel.org
Subject: [PATCH 0/3] HID: wiimote: new LED behavior on connect, and scoped guards
Date: Fri, 10 Jul 2026 12:32:08 -0300 [thread overview]
Message-ID: <20260710153456.2093889-1-rafael@rcpassos.me> (raw)
Hi,
This patchset contains one feature change, and two cleanup patches.
The feature is turning different LEDs for each of the first 4 wiimotes connected.
From id 5 forward, the LED will cycle back to 1, and so on.
This uses the ida struct, so its quite simple and lightweight.
The hid_info log message prints out the controller id.
I was considering adding this number to the controller name too,
but was unsure if this could impact applications using it.
While implementing this feature, I decided to cleanup the code using
scoped_guard for the many spinlocks in the driver. There are two places
where the original lock/unlock version fits best, and I left them
untouched.
Lastly, I used the __free scope cleanup in the LED probe function.
The wiimote_hid_probe call can also be changed in this way, but I
left it because it uses the wiimote_destroy in one of the err cases (w/ kfree inside).
But I can apply the change there too, to make this more complete.
It was really fun working with this driver.
I tested it with 4 Wii Motion Plus remotes (gen2).
Video recording of my tests (48s video).
https://rcpassos.me/video/wiimote-led-linux-driver
Thanks,
Rafael Passos
Rafael Passos (3):
HID: wiimote: turn on the LEDs indicating the controller id
HID: wiimote: replace spinlock pairs with scoped_guard
HID: wiimote: use scoped cleanup in led creation
drivers/hid/hid-wiimote-core.c | 252 ++++++++++++++++--------------
drivers/hid/hid-wiimote-debug.c | 41 ++---
drivers/hid/hid-wiimote-modules.c | 22 ++-
drivers/hid/hid-wiimote.h | 8 +
4 files changed, 165 insertions(+), 158 deletions(-)
--
2.53.0
next reply other threads:[~2026-07-10 15:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 15:32 Rafael Passos [this message]
2026-07-10 15:32 ` [PATCH 1/3] HID: wiimote: turn on the LEDs indicating the controller id Rafael Passos
2026-07-10 15:46 ` sashiko-bot
2026-07-10 15:32 ` [PATCH 2/3] HID: wiimote: replace spinlock pairs with scoped_guard Rafael Passos
2026-07-10 15:47 ` sashiko-bot
2026-07-10 15:32 ` [PATCH 3/3] HID: wiimote: use scoped cleanup in led creation Rafael Passos
2026-07-10 15:44 ` sashiko-bot
2026-07-10 19:35 ` [PATCH 0/3] HID: wiimote: new LED behavior on connect, and scoped guards Rafael Passos
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=20260710153456.2093889-1-rafael@rcpassos.me \
--to=rafael@rcpassos.me \
--cc=bentiss@kernel.org \
--cc=david@readahead.eu \
--cc=jikos@kernel.org \
--cc=jkoolstra@xs4all.nl \
--cc=linux-input@vger.kernel.org \
--cc=me@brighamcampbell.com \
--cc=skhan@linuxfoundation.org \
/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