Re: [PATCH v11 17/18] HID: asus: report the XG Mobile GPU vendor to asus-wmi
From: Ilpo Järvinen
Date: Mon Oct 26 2026 - 10:16:51 EST
On Sun, 25 Oct 2026, Denis Benato wrote:
> The version query answers with the 4-part PCI ID of the GPU installed
> in the station. Parse it, report its vendor part to asus-wmi as soon
> as the station is identified and clear it when the station goes away,
> so that enabling the eGPU through egpu_enable composes the right
> activation value for NVIDIA, AMD and Intel stations alike.
>
> Signed-off-by: Denis Benato <denis.benato@xxxxxxxxx>
> ---
> drivers/hid/hid-asus.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index e444cad85b32..244d103fbd4c 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -186,6 +186,7 @@ struct asus_xgm_info {
> char part_number[ASUS_XGM_INFO_LEN];
> char firmware_version[ASUS_XGM_INFO_LEN];
> char generation[ASUS_XGM_INFO_LEN];
> + u8 gpu_id[4];
> };
>
> struct asus_touchpad_info {
> @@ -6313,6 +6314,12 @@ static int asus_xgm_get_version(struct hid_device *hdev,
> asus_xgm_tlv_str(info->firmware_version, sizeof(info->firmware_version),
> buf, len, "VER");
>
> + /* the 4-part PCI ID of the GPU installed in the station: buf[3..10] */
> + if (len < 11)
> + return -ENODATA;
> +
> + memcpy(info->gpu_id, buf + 3, sizeof(info->gpu_id));
Is this 3 also related to tag length (the literals comment I had to the
other patch)?
--
i.
> +
> return 0;
> }
>
> @@ -6685,6 +6692,8 @@ static int asus_xgm_init(struct hid_device *hdev, struct asus_drvdata *drvdata)
> hid_info(hdev, "XG Mobile: firmware %s, generation %s\n",
> info->firmware_version, info->generation);
>
> + asus_wmi_egpu_set_vendor(info->gpu_id[0]);
> +
> /*
> * The attribute group is not devm-managed: a creation failure is
> * fatal and unwound through asus_xgm_init_err, while on the unbind
> @@ -6732,6 +6741,7 @@ static int asus_xgm_init(struct hid_device *hdev, struct asus_drvdata *drvdata)
>
> return 0;
> asus_xgm_init_err:
> + asus_wmi_egpu_set_vendor(0);
> sysfs_remove_group(&hdev->dev.kobj, &asus_xgm_attr_group);
> drvdata->xgm_info = NULL;
> drvdata->xgm_led = NULL;
> @@ -6951,8 +6961,10 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
> if (drvdata->listener.brightness_set)
> asus_hid_unregister_listener(&drvdata->listener);
>
> - if (drvdata->xgm_info)
> + if (drvdata->xgm_info) {
> + asus_wmi_egpu_set_vendor(0);
> sysfs_remove_group(&hdev->dev.kobj, &asus_xgm_attr_group);
> + }
>
> if (drvdata->xgm_led)
> devm_led_classdev_unregister(&hdev->dev, &drvdata->xgm_led->cdev);
> @@ -6972,8 +6984,10 @@ static void asus_remove(struct hid_device *hdev)
> if (drvdata->listener.brightness_set)
> asus_hid_unregister_listener(&drvdata->listener);
>
> - if (drvdata->xgm_info)
> + if (drvdata->xgm_info) {
> + asus_wmi_egpu_set_vendor(0);
> sysfs_remove_group(&hdev->dev.kobj, &asus_xgm_attr_group);
> + }
>
> if (drvdata->xgm_led)
> devm_led_classdev_unregister(&hdev->dev, &drvdata->xgm_led->cdev);
>