mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Werner Sembach <wse@tuxedocomputers.com>
To: Aaron Erhardt <aer@tuxedocomputers.com>,
	hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v3 2/6] platform/x86/tuxedo: Set HID report ID on success
Date: Wed, 26 Aug 2026 10:27:51 +0200	[thread overview]
Message-ID: <c79d33c4-5ff4-4f1c-aa8b-e4d0daeb6647@tuxedocomputers.com> (raw)
In-Reply-To: <20260826081149.235487-3-aer@tuxedocomputers.com>


Am 26.08.26 um 10:11 schrieb Aaron Erhardt:
> 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>
Reviewed-by: Werner Sembach <wse@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 = {

  reply	other threads:[~2026-08-26  8:27 UTC|newest]

Thread overview: 13+ 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 [this message]
2026-08-26  8:11 ` [PATCH v3 3/6] platform/x86/tuxedo: Use intensity according to HID spec Aaron Erhardt
2026-08-26  8:27   ` 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

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=c79d33c4-5ff4-4f1c-aa8b-e4d0daeb6647@tuxedocomputers.com \
    --to=wse@tuxedocomputers.com \
    --cc=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 \
    /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®