forked from Plippo/asus-wmi-screenpad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch6.3
67 lines (63 loc) · 1.89 KB
/
patch6.3
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
56
57
58
59
60
61
62
63
64
65
66
67
diff -Naur orig/asus-wmi.c new/asus-wmi.c
--- orig/asus-wmi.c 2023-06-28 08:25:06.000000000 -0300
+++ new/asus-wmi.c 2023-06-28 09:06:06.071913116 -0300
@@ -211,6 +211,7 @@
struct led_classdev lightbar_led;
int lightbar_led_wk;
struct led_classdev micmute_led;
+ struct led_classdev camera_led;
struct workqueue_struct *led_workqueue;
struct work_struct tpd_led_work;
struct work_struct wlan_led_work;
@@ -1153,6 +1154,16 @@
return err < 0 ? err : 0;
}
+static int camera_led_set(struct led_classdev *led_cdev,
+ enum led_brightness brightness)
+{
+ int state = brightness != LED_OFF;
+ int err;
+
+ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_CAMERA_LED, state, NULL);
+ return err < 0 ? err : 0;
+}
+
static void asus_wmi_led_exit(struct asus_wmi *asus)
{
led_classdev_unregister(&asus->kbd_led);
@@ -1160,6 +1171,7 @@
led_classdev_unregister(&asus->wlan_led);
led_classdev_unregister(&asus->lightbar_led);
led_classdev_unregister(&asus->micmute_led);
+ led_classdev_unregister(&asus->camera_led);
if (asus->led_workqueue)
destroy_workqueue(asus->led_workqueue);
@@ -1252,6 +1264,19 @@
goto error;
}
+ if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_CAMERA_LED)) {
+ asus->camera_led.name = "platform::camera";
+ asus->camera_led.max_brightness = 1;
+ asus->camera_led.brightness_set_blocking =
+ camera_led_set;
+ asus->camera_led.default_trigger = "torch";
+
+ rv = led_classdev_register(&asus->platform_device->dev,
+ &asus->camera_led);
+ if (rv)
+ goto error;
+ }
+
error:
if (rv)
asus_wmi_led_exit(asus);
diff -Naur orig/asus-wmi.h new/asus-wmi.h
--- orig/asus-wmi.h 2023-06-28 08:25:07.000000000 -0300
+++ new/asus-wmi.h 2023-06-28 09:06:59.748730229 -0300
@@ -20,6 +20,7 @@
#define ASUS_WMI_KEY_IGNORE (-1)
#define ASUS_WMI_BRN_DOWN 0x20
#define ASUS_WMI_BRN_UP 0x2f
+#define ASUS_WMI_DEVID_CAMERA_LED 0x00060079
struct module;
struct key_entry;