platform/x86: dell-privacy: Only register SW_CAMERA_LENS_COVER if present
authorHans de Goede <hdegoede@redhat.com>
Wed, 21 Dec 2022 22:07:24 +0000 (23:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:15 +0000 (11:58 +0100)
commit3a79bad876164ac34f566c66074503124adf9336
tree8908a28745c546f366f0ede4cd6d6b00d783f462
parent1f4a9408024e268fe0519bfa3d2ed8c86ab1d4a4
platform/x86: dell-privacy: Only register SW_CAMERA_LENS_COVER if present

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@redhat.com>
Link: https://lore.kernel.org/r/20221221220724.119594-2-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/platform/x86/dell/dell-wmi-privacy.c