From nobody Sat Feb 7 15:09:57 2026 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73A63364EAB for ; Wed, 7 Jan 2026 15:23:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767799388; cv=none; b=lcyYCZYStYYCP/J3m7JbWTXk8MsougB57mUFrjYgIRUjeTf4v2QT84o9A43h5ulodtzoayKygn9mYHeydmfLjfrRV5BpFpLZxgAuNNXj2Yqw4/xKbSxg5lV/G2PdJzO9Q++gprQibTrtxTym6c01RmdG+/dqUIQW8ONyhr8KSa0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767799388; c=relaxed/simple; bh=kEVatJuhwcribwS5phTkXXGYCZjzzAaM4rM6+EokEf0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DvOqCHowOYTLUYtgO/VqQI3KjbSBkWjC1aslZOiGjOO1zwmweDxlRslGEzoRRekxvF8wV6E5/nMMvuIewB28UwMHzq8bCeZ++ALYUXLwG2LMMnzjvxLQWyu+4pP3NFS/lX8MqE+ZBjfRmd0JPf8yZp59AhivmUPS+T/OsVCAz9o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=guj3/wwK; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="guj3/wwK" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4779cc419b2so19545835e9.3 for ; Wed, 07 Jan 2026 07:23:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767799383; x=1768404183; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D3hredH+/A3P6nqyWdZvG4QdgvBANjzpG0Fb/Zydwu8=; b=guj3/wwKGRQOLYI4bThUuApGAkCNjBHMty7RIOhi7crI/EDyjkb1RXhTLXXxBHO8qy YpyECEuY7fo5F1od2E5R3vyZfx6JrsT+4coka3dEK4gqmqu5ZRczGC5TVEd4mmqN4PVG EMdCr8++UCYcSX4ePmrm8biECd1jusR6l/gNHJQ4Nvr4m+KgEBJWNf5Ac4mSLyCbDvuE sLj6Bupp1zhjva6BhVptNC9k+WQF4vMEbyUkxzHmGxWAJzQ/+N2+khm1zh6Q3Kd4iuRG HI12Q+kJpjRJpyqXpT8TiZemJey4LX7nGzyI/NI1SBYmMGksZcMjUyHgvSQENbOxfI9n 6mQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767799383; x=1768404183; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=D3hredH+/A3P6nqyWdZvG4QdgvBANjzpG0Fb/Zydwu8=; b=cXDTwaJy3+OGQRwin4CqPb5kGjVm6rpBSf4PsS8PyOp17enhVTYs6WVvn4PRWahADI WenbIgiB0VRbXobd/SaEUXgAAub6kcPj0ecMt8UBDmFNIRI2crSJl3zIts0UjgUUVUot rBifX5kApPyNL+dPq7SyeOUP326sE3PtP5ukBs//s45Jri1Ug6odoSy89cVWtbNyqI65 XYadWDHLv9ilX3SxGsqpVbVVngl4TsCguD+B7cJvWduDGxjmi3bQbhO3vZ2mXGQx8CpC PVFlc2ixdZHS8hfekDk91uUX2TA1QlnSrtynKpJnkH+MsS3AauZ/4N+NNKjJMcSISapy DPEw== X-Forwarded-Encrypted: i=1; AJvYcCW4cXhtLh8J3fJeqW3JAC6BIFua/eO8o/8aPz50PlQn58RypYUH4VwSotkjECJ/NXaibd1oEMP0aEcR39E=@vger.kernel.org X-Gm-Message-State: AOJu0Yw7mu3LvZKQ26UMuIlgYvdG1/bhefQ6334vK4vl6C+efCgjZkOd MoqYr08ESWBmm9dpzxAoV7R3oKIXdQze61x0/kxsNfCCQkjp07ecqO7z X-Gm-Gg: AY/fxX7vmFdiM7mSCUxpoumOyJE3JoxKDdHOdP/BF/R/nJRXz7CbLUHOKICuDaEZUNm xUWD4MX7sCmnMmv3wn50FcyA9Icy14AjdtnYggYFDcnFVkcej7oVhrj3CILyZsvwR44wBXbWEyO CvPLuWD8WU7Eptj0+g8HkKRqCMiv8IQ00HNHcFjtI9XCKfY5iKqVmWuKZKYFHMYRLPCmuiJjgqD ffylZiX+jBHJEeEF1R3mjRXTGyMsMHZxIRmTsQ6LIowUJFOQYJCnfO65wtjrWzLjEmgBgZJ+tCr Z4ysJclEp3lmDz+5VbXnDYAQtDWYfyQTm07y9qWjGSUKZdq22MG6mX296FiwM3UTLwYBSAeadEq 4mzBRqvoqN7pk+lIpiQYg8eWANJgQi7mtki3YhtvHqNqOlIhzYpRG7dwrz1Dj6ivZ2iTpHmH5Ft P9Bxmw0ugXCc/+O1AvX3LUWzDrgjBXMgkB0Dejm2U= X-Google-Smtp-Source: AGHT+IEe8VovSuB+Rs2+NhvpCXGunJPI34W+th/f89j8LhAZOES8IZy1xFqOTOzblsupIhgJ249PEg== X-Received: by 2002:a05:600c:1d14:b0:477:97c7:9be7 with SMTP id 5b1f17b1804b1-47d84b0a7bdmr32486395e9.1.1767799382542; Wed, 07 Jan 2026 07:23:02 -0800 (PST) Received: from ionutnechita-arz2022.local ([2a02:2f0e:ca09:7000:33fc:5cce:3767:6b22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d7f410c6csm112064125e9.1.2026.01.07.07.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jan 2026 07:23:02 -0800 (PST) From: "Ionut Nechita (Sunlight Linux)" To: benato.denis96@gmail.com, jikos@kernel.org, bentiss@kernel.org Cc: ionut_n2001@yahoo.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, sunlightlinux@gmail.com, superm1@kernel.org Subject: [PATCH v3 4/4] HID: asus: Implement Fn+F5 fan control key handler Date: Wed, 7 Jan 2026 17:22:18 +0200 Message-ID: <20260107152213.143247-10-sunlightlinux@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260107152213.143247-2-sunlightlinux@gmail.com> References: <20260107152213.143247-2-sunlightlinux@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ionut Nechita On Asus ROG laptops, the Fn+F5 key (HID code 0xae) is used to cycle through fan modes. This key press needs to be forwarded to the asus-wmi driver to actually change the fan mode. Add ASUS_FAN_CTRL_KEY_CODE define and implement the handler in asus_raw_event() to send WMI events when this key is pressed. When asus-wmi successfully handles the event, it is blocked from reaching userspace. If asus-wmi is unavailable or fails, the event is passed to userspace via evdev, allowing userspace implementations of fan control. Tested on Asus ROG G14/G15 series laptops. Reviewed-by: Denis Benato Signed-off-by: Ionut Nechita --- drivers/hid/hid-asus.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 8828a3b3054fa..d6f0050fd441b 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -65,6 +65,9 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); #define ASUS_SPURIOUS_CODE_0X8A 0x8a #define ASUS_SPURIOUS_CODE_0X9E 0x9e =20 +/* Special key codes */ +#define ASUS_FAN_CTRL_KEY_CODE 0xae + #define SUPPORT_KBD_BACKLIGHT BIT(0) =20 #define MAX_TOUCH_MAJOR 8 @@ -386,12 +389,34 @@ static int asus_raw_event(struct hid_device *hdev, if (report->id =3D=3D FEATURE_KBD_LED_REPORT_ID1 || report->id =3D=3D FEA= TURE_KBD_LED_REPORT_ID2) return -1; if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) { - /* - * ASUS ROG laptops send these codes during normal operation - * with no discernable reason. Filter them out to avoid - * unmapped warning messages. - */ if (report->id =3D=3D FEATURE_KBD_REPORT_ID) { + /* + * Fn+F5 fan control key - try to send WMI event to toggle fan mode. + * If successful, block the event from reaching userspace. + * If asus-wmi is unavailable or the call fails, let the event + * pass to userspace so it can implement its own fan control. + */ + if (data[1] =3D=3D ASUS_FAN_CTRL_KEY_CODE) { + int ret =3D asus_wmi_send_event(drvdata, ASUS_FAN_CTRL_KEY_CODE); + + if (ret =3D=3D 0) { + /* Successfully handled by asus-wmi, block event */ + return -1; + } + + /* + * Warn if asus-wmi failed (but not if it's unavailable). + * Let the event reach userspace in all failure cases. + */ + if (ret !=3D -ENODEV) + hid_warn(hdev, "Failed to notify asus-wmi: %d\n", ret); + } + + /* + * ASUS ROG laptops send these codes during normal operation + * with no discernable reason. Filter them out to avoid + * unmapped warning messages. + */ if (data[1] =3D=3D ASUS_SPURIOUS_CODE_0XEA || data[1] =3D=3D ASUS_SPURIOUS_CODE_0XEC || data[1] =3D=3D ASUS_SPURIOUS_CODE_0X02 || --=20 2.52.0