From: Aaron Erhardt <aer@tuxedocomputers.com>
To: wse@tuxedocomputers.com, hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: Aaron Erhardt <aer@tuxedocomputers.com>,
linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org
Subject: [PATCH v3 3/6] platform/x86/tuxedo: Use intensity according to HID spec
Date: Wed, 26 Aug 2026 10:11:29 +0200 [thread overview]
Message-ID: <20260826081149.235487-4-aer@tuxedocomputers.com> (raw)
In-Reply-To: <20260826081149.235487-1-aer@tuxedocomputers.com>
So far, this driver assumed incorrectly that the HID spec requires an
8-bit intensity value to be honored. The spec actually allows multiple
intensities for RGB lamps, but suggest to rather set brightness
through the individual channels, which is also what the Microsoft
MacroPad reference implementation does.
Accordingly, this commit simplifies intensity handling by offering
only two intensity values for turning LEDs on and off. All other color
values are submitted through the color channels individually, thus
avoiding duplicated handling of brightness.
Additionally, the incorrect comments explaining the deviation from the
MacroPad reference implementation were removed.
Signed-off-by: Aaron Erhardt <aer@tuxedocomputers.com>
---
drivers/platform/x86/tuxedo/nb04/wmi_ab.c | 25 ++++++++++++-----------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/platform/x86/tuxedo/nb04/wmi_ab.c b/drivers/platform/x86/tuxedo/nb04/wmi_ab.c
index 11babc7c7767..8f1ffca0430d 100644
--- a/drivers/platform/x86/tuxedo/nb04/wmi_ab.c
+++ b/drivers/platform/x86/tuxedo/nb04/wmi_ab.c
@@ -553,7 +553,7 @@ static int handle_lamp_attributes_response_report(struct hid_device *hdev,
rep->red_level_count = 0xff;
rep->green_level_count = 0xff;
rep->blue_level_count = 0xff;
- rep->intensity_level_count = 0xff;
+ rep->intensity_level_count = 0x1;
rep->is_programmable = 1;
if (driver_data->kbl_map[lamp_id].code <= 0xe8) {
@@ -640,22 +640,23 @@ static int handle_lamp_multi_update_report(struct hid_device *hdev,
j + 1;
rgb_configs_j->key_id = key_id;
/*
- * While this driver respects update_channel.intensity
- * according to "HID Usage Tables v1.5" also on RGB
- * leds, the Microsoft MacroPad reference implementation
+ * This driver uses update_channel.intensity according to
+ * "Color Attributes Examples" in "HID Usage Tables v1.7".
+ * Only two intensity values are allowed for turning LEDs
+ * on or off, while color and brightness can be controlled
+ * through the RGB values. This is also identical to the
+ * Microsoft MacroPad reference implementation
* (https://github.com/microsoft/RP2040MacropadHidSample
- * 1d6c3ad) does not and ignores it. If it turns out
- * that Windows writes intensity = 0 for RGB leds
- * instead of intensity = 255, this driver should also
- * ignore the update_channel.intensity.
+ * 1d6c3ad).
*/
- intensity_i = rep->update_channels[i].intensity;
+ intensity_i = min(1, rep->update_channels[i].intensity);
red_i = rep->update_channels[i].red;
green_i = rep->update_channels[i].green;
blue_i = rep->update_channels[i].blue;
- rgb_configs_j->red = red_i * intensity_i / 0xff;
- rgb_configs_j->green = green_i * intensity_i / 0xff;
- rgb_configs_j->blue = blue_i * intensity_i / 0xff;
+
+ rgb_configs_j->red = red_i * intensity_i;
+ rgb_configs_j->green = green_i * intensity_i;
+ rgb_configs_j->blue = blue_i * intensity_i;
break;
}
--
2.43.0
next prev parent reply other threads:[~2026-08-26 8:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 8:11 [PATCH v3 0/6] platform/x86/tuxedo: Fixes for TUXEDO NB04 driver Aaron Erhardt
2026-08-26 8:11 ` [PATCH v3 1/6] platform/x86/tuxedo: Don't use device driver data Aaron Erhardt
2026-08-26 8:27 ` Werner Sembach
2026-08-26 8:11 ` [PATCH v3 2/6] platform/x86/tuxedo: Set HID report ID on success Aaron Erhardt
2026-08-26 8:27 ` Werner Sembach
2026-08-26 8:11 ` Aaron Erhardt [this message]
2026-08-26 8:27 ` [PATCH v3 3/6] platform/x86/tuxedo: Use intensity according to HID spec Werner Sembach
2026-08-26 8:11 ` [PATCH v3 4/6] platform/x86/tuxedo: Fix keyboard LED map ordering Aaron Erhardt
2026-08-26 8:28 ` Werner Sembach
2026-08-26 8:11 ` [PATCH v3 5/6] platform/x86/tuxedo: Update and extend documentation Aaron Erhardt
2026-08-26 8:28 ` Werner Sembach
2026-08-26 8:11 ` [PATCH v3 6/6] MAINTAINERS: Add Aaron Erhardt as maintainer of TUXEDO DRIVERS Aaron Erhardt
2026-08-26 8:28 ` Werner Sembach
2026-09-03 11:27 ` [PATCH v3 0/6] platform/x86/tuxedo: Fixes for TUXEDO NB04 driver Aaron Erhardt
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=20260826081149.235487-4-aer@tuxedocomputers.com \
--to=aer@tuxedocomputers.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=wse@tuxedocomputers.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
all inboxes | Powered by JetHome®