This is a note to let you know that I've just added the patch titled platform/x86: dell-privacy: Only register SW_CAMERA_LENS_COVER if present to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: platform-x86-dell-privacy-only-register-sw_camera_lens_cover-if-present.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 6dc485f9940df8105ea729cbeb7a7d18d409dde5 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@xxxxxxxxxx> Date: Wed, 21 Dec 2022 23:07:24 +0100 Subject: platform/x86: dell-privacy: Only register SW_CAMERA_LENS_COVER if present From: Hans de Goede <hdegoede@xxxxxxxxxx> commit 6dc485f9940df8105ea729cbeb7a7d18d409dde5 upstream. Unlike keys where userspace only reacts to keypresses, userspace may act on switches in both (0 and 1) of their positions. For example if a SW_TABLET_MODE switch is registered then GNOME will not automatically show the onscreen keyboard when a text field gets focus on touchscreen devices when SW_TABLET_MODE reports 0 and when SW_TABLET_MODE reports 1 libinput will block (filter out) builtin keyboard and touchpad events. So to avoid unwanted side-effects EV_SW type inputs should only be registered if they are actually present, only register SW_CAMERA_LENS_COVER if it is actually there. Fixes: 8af9fa37b8a3 ("platform/x86: dell-privacy: Add support for Dell hardware privacy") Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> Link: https://lore.kernel.org/r/20221221220724.119594-2-hdegoede@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/platform/x86/dell/dell-wmi-privacy.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) --- a/drivers/platform/x86/dell/dell-wmi-privacy.c +++ b/drivers/platform/x86/dell/dell-wmi-privacy.c @@ -292,7 +292,7 @@ static int dell_privacy_wmi_probe(struct { struct privacy_wmi_data *priv; struct key_entry *keymap; - int ret, i; + int ret, i, j; ret = wmi_has_guid(DELL_PRIVACY_GUID); if (!ret) @@ -318,9 +318,20 @@ static int dell_privacy_wmi_probe(struct /* remap the keymap code with Dell privacy key type 0x12 as prefix * KEY_MICMUTE scancode will be reported as 0x120001 */ - for (i = 0; i < ARRAY_SIZE(dell_wmi_keymap_type_0012); i++) { - keymap[i] = dell_wmi_keymap_type_0012[i]; - keymap[i].code |= (0x0012 << 16); + for (i = 0, j = 0; i < ARRAY_SIZE(dell_wmi_keymap_type_0012); i++) { + /* + * Unlike keys where only presses matter, userspace may act + * on switches in both of their positions. Only register + * SW_CAMERA_LENS_COVER if it is actually there. + */ + if (dell_wmi_keymap_type_0012[i].type == KE_VSW && + dell_wmi_keymap_type_0012[i].sw.code == SW_CAMERA_LENS_COVER && + !(priv->features_present & BIT(DELL_PRIVACY_TYPE_CAMERA))) + continue; + + keymap[j] = dell_wmi_keymap_type_0012[i]; + keymap[j].code |= (0x0012 << 16); + j++; } ret = sparse_keymap_setup(priv->input_dev, keymap, NULL); kfree(keymap); Patches currently in stable-queue which might be from hdegoede@xxxxxxxxxx are queue-6.1/acpi-fix-selecting-wrong-acpi-fwnode-for-the-igpu-on-some-dell-laptops.patch queue-6.1/platform-x86-int3472-discrete-ensure-the-clk-power-enable-pins-are-in-output-mode.patch queue-6.1/platform-x86-sony-laptop-don-t-turn-off-0x153-keyboard-backlight-during-probe.patch queue-6.1/platform-x86-dell-privacy-fix-sw_camera_lens_cover-reporting.patch queue-6.1/acpi-video-allow-selecting-nvidia-wmi-ec-or-apple-gmux-backlight-from-the-cmdline.patch queue-6.1/platform-x86-ideapad-laptop-add-legion-5-15arh05-dmi-id-to-set_fn_lock_led_list.patch queue-6.1/platform-surface-aggregator-ignore-command-messages-not-intended-for-us.patch queue-6.1/platform-x86-thinkpad_acpi-fix-profile-mode-display-in-amt-mode.patch queue-6.1/platform-x86-asus-wmi-don-t-load-fan-curves-without-fan.patch queue-6.1/platform-x86-dell-privacy-only-register-sw_camera_lens_cover-if-present.patch