]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86: dell-wmi-base: Handle electronic privacy screen on/off events
authorHans de Goede <hansg@kernel.org>
Mon, 20 Oct 2025 15:23:31 +0000 (17:23 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 28 Oct 2025 15:12:00 +0000 (17:12 +0200)
Add handling for events for the electronic privacy screen found on some
models (e.g. Dell Latitude 7300) being toggled on/off.

Emit KEY_EPRIVACY_SCREEN_OFF / KEY_EPRIVACY_SCREEN_ON events for this so
that userspace can show the usual on-screen-display (OSD) notification for
eprivacy screen on/off to the user.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Link: https://patch.msgid.link/20251020152331.52870-3-hansg@kernel.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/dell/dell-wmi-base.c

index 841a5414d28a68633a11d7b3ec443ae28c69c460..28076929d6af5b426f1e0a85006a20966ab33935 100644 (file)
@@ -365,6 +365,13 @@ static const struct key_entry dell_wmi_keymap_type_0012[] = {
        /* Backlight brightness change event */
        { KE_IGNORE, 0x0003, { KEY_RESERVED } },
 
+       /*
+        * Electronic privacy screen toggled, extended data gives state,
+        * separate entries for on/off see handling in dell_wmi_process_key().
+        */
+       { KE_KEY, 0x000c, { KEY_EPRIVACY_SCREEN_OFF } },
+       { KE_KEY, 0x000c, { KEY_EPRIVACY_SCREEN_ON } },
+
        /* Ultra-performance mode switch request */
        { KE_IGNORE, 0x000d, { KEY_RESERVED } },
 
@@ -435,6 +442,11 @@ static int dell_wmi_process_key(struct wmi_device *wdev, int type, int code, u16
                                      "Dell tablet mode switch",
                                      SW_TABLET_MODE, !buffer[0]);
                return 1;
+       } else if (type == 0x0012 && code == 0x000c && remaining > 0) {
+               /* Eprivacy toggle, switch to "on" key entry for on events */
+               if (buffer[0] == 2)
+                       key++;
+               used = 1;
        } else if (type == 0x0012 && code == 0x000d && remaining > 0) {
                value = (buffer[2] == 2);
                used = 1;