All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Benato <denis.benato@linux.dev>
To: James Ye <jye836@gmail.com>,
	jikos@kernel.org, bentiss@kernel.org, lee@kernel.org,
	pavel@kernel.org
Cc: linux-input@vger.kernel.org, linux-leds@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6] HID: asus: add support for T3304 detachable keyboard
Date: Mon, 4 May 2026 00:23:17 +0200	[thread overview]
Message-ID: <2974e45f-24ff-4999-be0e-02cf2e00ed59@linux.dev> (raw)
In-Reply-To: <20260503072643.2774762-4-jye836@gmail.com>


On 5/3/26 09:26, James Ye wrote:
> ASUSTek Computer, Inc. T3304 Soft Keyboard [0b05:1aad] is the detachable
> keyboard of the ASUS Vivobook 13 Slate OLED (T3304). It presents as a
> USB device with two interfaces: a keyboard and a pointing device
> (touchpad).
>
> Basic keyboard and full touchpad functionality work out-of-the-box with
> hid-generic and hid-multitouch, but function key combos e.g. volume,
> brightness control, home/end/pgup/pgdown require initialization.
>
> Bind the keyboard interface to hid-asus for initialization. The
> OEM-specific report descriptors required for this are present only on
> the touchpad interface, not the keyboard, so a quirk is used to add the
> required feature descriptor.
Reviewed-By: Denis Benato <denis.benato@linux.dev>
> Signed-off-by: James Ye <jye836@gmail.com>
> ---
>  drivers/hid/hid-asus.c | 58 +++++++++++++++++++++++++++++++++++++++---
>  drivers/hid/hid-ids.h  |  1 +
>  2 files changed, 56 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index ef9d5eba4dc9..e4c97fddfaf1 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -99,6 +99,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
>  #define QUIRK_ROG_CLAYMORE_II_KEYBOARD	BIT(12)
>  #define QUIRK_ROG_ALLY_XPAD		BIT(13)
>  #define QUIRK_HID_FN_LOCK		BIT(14)
> +#define QUIRK_T3304_KEYBOARD		BIT(15)
>
>  #define I2C_KEYBOARD_QUIRKS			(QUIRK_FIX_NOTEBOOK_REPORT | \
>  						 QUIRK_NO_INIT_REPORTS | \
> @@ -494,6 +495,14 @@ static int asus_kbd_init(struct hid_device *hdev, u8 report_id)
>  		return ret;
>  	}
>
> +	struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
> +
> +	/* T3304 keyboard always replies with 16 0xff bytes. Don't check for
> +	 * acknowledgment.
> +	 */
> +	if (drvdata->quirks & QUIRK_T3304_KEYBOARD)
> +		return 0;
> +
>  	u8 *readbuf __free(kfree) = kzalloc(FEATURE_KBD_REPORT_SIZE, GFP_KERNEL);
>  	if (!readbuf)
>  		return -ENOMEM;
> @@ -1312,10 +1321,12 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  		hid_warn(hdev, "Failed to initialize backlight.\n");
>
>  	/*
> -	 * For ROG keyboards, skip rename for consistency and ->input check as
> -	 * some devices do not have inputs.
> +	 * For ROG and T3304 keyboards, skip rename for consistency.
> +	 * For ROG keyboards, skip ->input check as some devices do not have
> +	 * inputs.
>  	 */
> -	if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD)
> +	if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD ||
> +	    drvdata->quirks & QUIRK_T3304_KEYBOARD)
>  		return 0;
>
>  	/*
> @@ -1369,6 +1380,22 @@ static const __u8 asus_g752_fixed_rdesc[] = {
>          0x2A, 0xFF, 0x00,		/*   Usage Maximum (0xFF)       */
>  };
>
> +static const __u8 asus_t3304_fixed_rdesc[] = {
> +	0x06, 0x31, 0xff,              // Usage Page (Vendor Usage Page 0xff31)
> +	0x09, 0x76,                    // Usage (Vendor Usage 0x76)
> +	0xa1, 0x01,                    // Collection (Application)
> +	0x05, 0xff,                    //  Usage Page (Vendor Usage Page 0xff)
> +	0x85, 0x5a,                    //  Report ID (90)
> +	0x19, 0x00,                    //  Usage Minimum (0)
> +	0x2a, 0xff, 0x00,              //  Usage Maximum (255)
> +	0x15, 0x00,                    //  Logical Minimum (0)
> +	0x26, 0xff, 0x00,              //  Logical Maximum (255)
> +	0x75, 0x08,                    //  Report Size (8)
> +	0x95, 0x0f,                    //  Report Count (15)
> +	0xb1, 0x02,                    //  Feature (Data,Var,Abs)
> +	0xc0,                          // End Collection
> +};
> +
>  static const __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
>  		unsigned int *rsize)
>  {
> @@ -1473,6 +1500,28 @@ static const __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
>  		}
>  	}
>
> +	/* T3304 keyboard's vendor descriptors are on the touchpad interface,
> +	 * not the keyboard. But we need hid-multitouch to handle the touchpad,
> +	 * Add a descriptor with only the config report so that this driver can
> +	 * perform initialization.
> +	 */
> +	if (drvdata->quirks & QUIRK_T3304_KEYBOARD) {
> +		__u8 *new_rdesc;
> +		size_t new_size = *rsize + sizeof(asus_t3304_fixed_rdesc);
> +
> +		new_rdesc = devm_kzalloc(&hdev->dev, new_size, GFP_KERNEL);
> +		if (new_rdesc == NULL)
> +			return rdesc;
> +
> +		hid_info(hdev, "Fixing up Asus T3304 keyboard report descriptor\n");
> +		memcpy(new_rdesc, rdesc, *rsize);
> +		memcpy(new_rdesc + *rsize, asus_t3304_fixed_rdesc,
> +		       sizeof(asus_t3304_fixed_rdesc));
> +
> +		*rsize = new_size;
> +		rdesc = new_rdesc;
> +	}
> +
>  	return rdesc;
>  }
>
> @@ -1536,6 +1585,9 @@ static const struct hid_device_id asus_devices[] = {
>  	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
>  	{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
>  		USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD) },
> +	{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
> +		USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T3304_KEYBOARD),
> +	  QUIRK_T3304_KEYBOARD },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(hid, asus_devices);
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index 0cf63742315b..ecf30e36a99d 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -219,6 +219,7 @@
>  #define USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD	0x8502
>  #define USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD	0x183d
>  #define USB_DEVICE_ID_ASUSTEK_T304_KEYBOARD	0x184a
> +#define USB_DEVICE_ID_ASUSTEK_T3304_KEYBOARD	0x1aad
>  #define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD	0x8585
>  #define USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD	0x0101
>  #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854
> --
> 2.54.0

  reply	other threads:[~2026-05-03 22:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-03  7:26 [PATCH 0/6] HID: asus: add support for T3304 keyboard James Ye
2026-05-03  7:26 ` [PATCH 1/6] HID: input: delete hid_battery on disconnect James Ye
2026-05-03  7:26 ` [PATCH 2/6] HID: asus: check feature reports when determining is_vendor James Ye
2026-05-03  7:26 ` [PATCH 3/6] HID: asus: add support for T3304 detachable keyboard James Ye
2026-05-03 22:23   ` Denis Benato [this message]
2026-05-03  7:26 ` [PATCH 4/6] HID: multitouch: add support for ASUS T3304 media keys James Ye
2026-05-03  7:26 ` [PATCH 5/6] HID: asus: add microphone mute LED support for T3304 James Ye
2026-05-03 22:45   ` Denis Benato
2026-05-04  1:27     ` James Ye
2026-05-03  7:26 ` [PATCH 6/6] leds: led-class: mark classdev as unregistering early James Ye
2026-05-04 21:49   ` kernel test robot
2026-05-05  2:24   ` kernel test robot
2026-05-05 14:16     ` James Ye

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=2974e45f-24ff-4999-be0e-02cf2e00ed59@linux.dev \
    --to=denis.benato@linux.dev \
    --cc=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=jye836@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.