summarylogtreecommitdiffstats
path: root/0018-hid-asus-ally-mcu_version-attribute.patch
blob: 458bf891b479f9e07d61e12d14e520073a0adba3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From 48ac577e7cc38813747d8cc00d77508354cec9ed Mon Sep 17 00:00:00 2001
From: Luke Jones <luke@ljones.dev>
Date: Mon, 10 Feb 2025 17:15:01 +1300
Subject: [PATCH 18/29] hid-asus-ally: mcu_version attribute

Signed-off-by: Luke Jones <luke@ljones.dev>
---
 drivers/hid/hid-asus-ally.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c
index aad965e069ee..def8a43afa22 100644
--- a/drivers/hid/hid-asus-ally.c
+++ b/drivers/hid/hid-asus-ally.c
@@ -380,6 +380,7 @@ static struct ally_drvdata {
 	struct ally_gamepad_cfg *gamepad_cfg;
 	struct ally_rgb_dev *led_rgb_dev;
 	struct ally_rgb_data led_rgb_data;
+	uint mcu_version;
 } drvdata;
 
 /**
@@ -1184,6 +1185,13 @@ static ssize_t gamepad_mode_store(struct device *dev, struct device_attribute *a
 
 DEVICE_ATTR_RW(gamepad_mode);
 
+static ssize_t gamepad_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	return sysfs_emit(buf, "%d\n", drvdata.version);
+}
+
++DEVICE_ATTR_RO(mcu_version);
+
 /* ROOT LEVEL ATTRS *******************************************************************************/
 static struct attribute *gamepad_device_attrs[] = {
 	&dev_attr_btn_mapping_reset.attr,
@@ -1191,6 +1199,7 @@ static struct attribute *gamepad_device_attrs[] = {
 	&dev_attr_gamepad_apply_all.attr,
 	&dev_attr_gamepad_vibration_intensity.attr,
 	&dev_attr_gamepad_vibration_intensity_index.attr,
+	&dev_attr_mcu_version.attr,
 	NULL
 };
 
@@ -1937,6 +1946,7 @@ static void mcu_maybe_warn_version(struct hid_device *hdev, int idProduct)
 
 	min_version = ROG_ALLY_X_MIN_MCU;
 	version = mcu_request_version(hdev);
+	drvdata.version = version;
 	if (version) {
 		switch (idProduct) {
 		case USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY:
-- 
2.48.1