From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91B93307AE3; Sun, 3 May 2026 22:23:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777847004; cv=none; b=XHOw+ZRth8NnqrqFrhiHH/mGEZWf5qQtfhSHGFgMDionNvhTAYEW6M0/417eVlTRdyuDTSkflqwmBdpAdRxP0QNlgC7ZnUF/I33ETpSZJS+jPgslG84W7r54fxKqgFtBA31Zm6DzIC5hsDr1fTJQowzYOLhlQPtVYwwxXJj5T5s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777847004; c=relaxed/simple; bh=9fhISSEjEljI+YFj2CEgMlJYTahbYUFiMYNtnnbK9xM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=RaF4T3nxVvwsBAGy126YOl8RIc6QxqKXR3FLmjeVHY/+wLF4e+2m0xpeKxLWZ9fSPVsGV6eSEqrm7j7sJmKEBkH9fLctA0yuLIGYG82UcG7JwEYZEIDAJO8FdJNKUPTQH49QmANRv/NxjdwdycsHtVrpFaVKvIj1RaSpJ4uuHRk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=dcQlmnOq; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="dcQlmnOq" Message-ID: <2974e45f-24ff-4999-be0e-02cf2e00ed59@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1777846999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NJy9agwAL2TNxkPqvEGKUYqRpmr/ZbXYC7ogel4yNy4=; b=dcQlmnOqURdSyOFWBwF5URbFd+zJvlItR/pqLEIXBQboCqflAtH9yJsmWG08AYMgMlr1Zb knv+DRFz3+bgCKCEiEU4Ug95Bqmb2WAF1o18HlIU7x4onJJyMaoFD6d8osN7JqGlyAd0oZ Q4JEwSUkrAzCWQVT5lfvtC4K28BFtn0= Date: Mon, 4 May 2026 00:23:17 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 3/6] HID: asus: add support for T3304 detachable keyboard To: James Ye , 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 References: <20260503072643.2774762-1-jye836@gmail.com> <20260503072643.2774762-4-jye836@gmail.com> Content-Language: en-US, it-IT, en-US-large X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Denis Benato In-Reply-To: <20260503072643.2774762-4-jye836@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT 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 > Signed-off-by: James Ye > --- > 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