Linux Input/HID development
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: DevExalt <exalt.dev.team@gmail.com>,
	jikos@kernel.org, bentiss@kernel.org
Cc: lains@riseup.net, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org,
		sari.kreitem@exalt.corp-partner.google.com, hbarnor@google.com
Subject: Re: [PATCH v5] HID: logitech-hidpp: Add support for HID++ Multi-Platform feature (0x4531)
Date: Mon, 27 Jul 2026 16:04:04 +0200	[thread overview]
Message-ID: <1da97f11f46ee3de1d0bcc5545e50423429b5b20.camel@hadess.net> (raw)
In-Reply-To: <20260701073727.53636-1-exalt.dev.team@gmail.com>

On Wed, 2026-07-01 at 10:37 +0300, DevExalt wrote:
> From: "Baraa Atta (Dev Exalt)" <exalt.dev.team@gmail.com>
> 
<snip>
> +
> +#define HIDPP_MULTIPLATFORM_FEAT_ID			0x4531
> +#define HIDPP_MULTIPLATFORM_GET_FEATURE_INFO		0x00
> +#define HIDPP_MULTIPLATFORM_GET_PLATFORM_DESCRIPTOR	0x10
> +#define HIDPP_MULTIPLATFORM_SET_CURRENT_PLATFORM	0x30
> +
> +#define
> HIDPP_MULTIPLATFORM_PLATFORM_MASK_TIZEN		BIT(0)
> +#define HIDPP_MULTIPLATFORM_PLATFORM_MASK_WINDOWS	BIT(8)
> +#define HIDPP_MULTIPLATFORM_PLATFORM_MASK_WINEMB	BIT(9)
> +#define
> HIDPP_MULTIPLATFORM_PLATFORM_MASK_LINUX		BIT(10)
> +#define HIDPP_MULTIPLATFORM_PLATFORM_MASK_CHROME	BIT(11)
> +#define HIDPP_MULTIPLATFORM_PLATFORM_MASK_ANDROID	BIT(12)
> +#define
> HIDPP_MULTIPLATFORM_PLATFORM_MASK_MACOS		BIT(13)
> +#define HIDPP_MULTIPLATFORM_PLATFORM_MASK_IOS		BIT(14)
> +#define
> HIDPP_MULTIPLATFORM_PLATFORM_MASK_WEBOS		BIT(15)
> +
> +struct hidpp_platform_desc {
> +	u8 plat_idx;
> +	u8 desc_idx;
> +	u16 plat_mask;
> +};
> +
> +/*
> + * Platform names exposed through the "platform" sysfs attribute.
> The order of
> + * this array must stay in sync with multiplatform_masks[] below, as
> the index
> + * returned by sysfs_match_string() is used to look up the matching
> mask.
> + */
> +static const char * const multiplatform_names[] = {
> +	"windows", "winemb", "linux", "chrome",
> +	"android", "macos", "ios", "webos", "tizen", NULL
> +};
> +
> +static const u16 multiplatform_masks[] = {
> +	HIDPP_MULTIPLATFORM_PLATFORM_MASK_WINDOWS,
> +	HIDPP_MULTIPLATFORM_PLATFORM_MASK_WINEMB,
> +	HIDPP_MULTIPLATFORM_PLATFORM_MASK_LINUX,
> +	HIDPP_MULTIPLATFORM_PLATFORM_MASK_CHROME,
> +	HIDPP_MULTIPLATFORM_PLATFORM_MASK_ANDROID,
> +	HIDPP_MULTIPLATFORM_PLATFORM_MASK_MACOS,
> +	HIDPP_MULTIPLATFORM_PLATFORM_MASK_IOS,
> +	HIDPP_MULTIPLATFORM_PLATFORM_MASK_WEBOS,
> +	HIDPP_MULTIPLATFORM_PLATFORM_MASK_TIZEN,

Wouldn't something like:
static enum multiplatform_masks = {
	HIDPP_MULTIPLATFORM_PLATFORM_MASK_WINDOWS = 8,
	HIDPP_MULTIPLATFORM_PLATFORM_MASK_WINEMB = 9,
...
};

followed by:
static const char * const multiplatform_names[] = {
  [HIDPP_MULTIPLATFORM_PLATFORM_MASK_WINDOWS] = "windows",
...
};

work? It makes the array a little bit bigger, but not hugely.

That way it completely negates the need to keep 2 arrays, and both of
them in sync.

> diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
> index 57d8efdd9b89..577af0075e27 100644
> --- a/drivers/hid/hid-quirks.c
> +++ b/drivers/hid/hid-quirks.c
> @@ -537,6 +537,8 @@ static const struct hid_device_id
> hid_have_special_driver[] = {
>  #endif
>  #if IS_ENABLED(CONFIG_HID_LOGITECH_HIDPP)
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
> USB_DEVICE_ID_LOGITECH_G920_WHEEL) },
> +	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH,
> USB_DEVICE_ID_LOGITECH_CASA_KEYS_KEYBOARD) },
> +	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH,
> USB_DEVICE_ID_LOGITECH_MX_KEYS_S_KEYBOARD) },
>  #endif
>  #if IS_ENABLED(CONFIG_HID_MAGICMOUSE)
>  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
> USB_DEVICE_ID_APPLE_MAGICMOUSE) },

That hunk shouldn't be necessary (since
e04a0442d33b8cf183bba38646447b891bb02123) unless the device was
absolutely unusable without the HID++ driver.

Rest looks fine, I'll try to test it on my Slim Solar+.

Cheers

  parent reply	other threads:[~2026-07-27 14:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25  8:08 [PATCH v2] HID: logitech-hidpp: Add support for HID++ Multi-Platform feature (0x4531) DevExalt
2026-06-25  8:18 ` sashiko-bot
2026-06-30  9:48 ` [PATCH v3] " DevExalt
2026-06-30 10:13   ` sashiko-bot
2026-07-01  6:30 ` [PATCH v4] " DevExalt
2026-07-01  6:43   ` sashiko-bot
2026-07-01  7:37 ` [PATCH v5] " DevExalt
2026-07-15 14:01   ` dev exalt
2026-07-27 14:04   ` Bastien Nocera [this message]
2026-07-29 15:02   ` Bastien Nocera
2026-08-02 11:50 ` [PATCH v6] " DevExalt
2026-08-02 11:58   ` sashiko-bot
2026-08-02 12:01 ` [PATCH v7] " DevExalt

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=1da97f11f46ee3de1d0bcc5545e50423429b5b20.camel@hadess.net \
    --to=hadess@hadess.net \
    --cc=bentiss@kernel.org \
    --cc=exalt.dev.team@gmail.com \
    --cc=hbarnor@google.com \
    --cc=jikos@kernel.org \
    --cc=lains@riseup.net \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sari.kreitem@exalt.corp-partner.google.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