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 2/6] platform/x86/tuxedo: Set HID report ID on success
Date: Tue, 28 Jul 2026 13:59:17 +0200 [thread overview]
Message-ID: <20260728115918.125349-3-aer@tuxedocomputers.com> (raw)
In-Reply-To: <20260728115918.125349-1-aer@tuxedocomputers.com>
While not strictly necessary due to the synchronous handling of HID
requests, it is better to set the ID of the HID report before
returning the buffer. This also better complies with the HID spec and
avoids problems with userspace tools expecting a report ID.
Signed-off-by: Aaron Erhardt <aer@tuxedocomputers.com>
---
drivers/platform/x86/tuxedo/nb04/wmi_ab.c | 26 +++++++++++++++++------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/drivers/platform/x86/tuxedo/nb04/wmi_ab.c b/drivers/platform/x86/tuxedo/nb04/wmi_ab.c
index 72205de72256..11babc7c7767 100644
--- a/drivers/platform/x86/tuxedo/nb04/wmi_ab.c
+++ b/drivers/platform/x86/tuxedo/nb04/wmi_ab.c
@@ -766,6 +766,8 @@ static int handle_lamp_array_control_report(struct hid_device *hdev __always_unu
static int tux_ll_raw_request(struct hid_device *hdev, u8 reportnum, u8 *buf,
size_t len, unsigned char rtype, int reqtype)
{
+ int ret = -EINVAL;
+
if (rtype != HID_FEATURE_REPORT)
return -EINVAL;
@@ -775,13 +777,15 @@ static int tux_ll_raw_request(struct hid_device *hdev, u8 reportnum, u8 *buf,
case LAMP_ARRAY_ATTRIBUTES_REPORT_ID:
if (len != sizeof(struct lamp_array_attributes_report_t))
return -EINVAL;
- return handle_lamp_array_attributes_report(hdev,
+ ret = handle_lamp_array_attributes_report(hdev,
(struct lamp_array_attributes_report_t *)buf);
+ break;
case LAMP_ATTRIBUTES_RESPONSE_REPORT_ID:
if (len != sizeof(struct lamp_attributes_response_report_t))
return -EINVAL;
- return handle_lamp_attributes_response_report(hdev,
+ ret = handle_lamp_attributes_response_report(hdev,
(struct lamp_attributes_response_report_t *)buf);
+ break;
}
break;
case HID_REQ_SET_REPORT:
@@ -789,28 +793,36 @@ static int tux_ll_raw_request(struct hid_device *hdev, u8 reportnum, u8 *buf,
case LAMP_ATTRIBUTES_REQUEST_REPORT_ID:
if (len != sizeof(struct lamp_attributes_request_report_t))
return -EINVAL;
- return handle_lamp_attributes_request_report(hdev,
+ ret = handle_lamp_attributes_request_report(hdev,
(struct lamp_attributes_request_report_t *)buf);
+ break;
case LAMP_MULTI_UPDATE_REPORT_ID:
if (len != sizeof(struct lamp_multi_update_report_t))
return -EINVAL;
- return handle_lamp_multi_update_report(hdev,
+ ret = handle_lamp_multi_update_report(hdev,
(struct lamp_multi_update_report_t *)buf);
+ break;
case LAMP_RANGE_UPDATE_REPORT_ID:
if (len != sizeof(struct lamp_range_update_report_t))
return -EINVAL;
- return handle_lamp_range_update_report(hdev,
+ ret = handle_lamp_range_update_report(hdev,
(struct lamp_range_update_report_t *)buf);
+ break;
case LAMP_ARRAY_CONTROL_REPORT_ID:
if (len != sizeof(struct lamp_array_control_report_t))
return -EINVAL;
- return handle_lamp_array_control_report(hdev,
+ ret = handle_lamp_array_control_report(hdev,
(struct lamp_array_control_report_t *)buf);
+ break;
}
break;
}
- return -EINVAL;
+ /* Set report number on success */
+ if (ret > 0)
+ buf[0] = reportnum;
+
+ return ret;
}
static const struct hid_ll_driver tux_ll_driver = {
--
2.43.0
next prev parent reply other threads:[~2026-07-28 11:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 11:59 [PATCH 0/6] platform/x86/tuxedo: Fixes for TUXEDO NB04 driver Aaron Erhardt
2026-07-28 11:59 ` [PATCH 1/6] platform/x86/tuxedo: Don't use device driver data Aaron Erhardt
2026-07-28 11:59 ` Aaron Erhardt [this message]
2026-07-28 11:59 ` [PATCH 3/6] platform/x86/tuxedo: Use intensity according to HID spec Aaron Erhardt
2026-08-24 15:13 ` Ilpo Järvinen
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=20260728115918.125349-3-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