* [PATCH 1/2] platform/x86: hp-wmi: Add camera toggle switch to HP WMI
@ 2023-04-25 20:46 Jonathan Singer
2023-04-25 20:56 ` Limonciello, Mario
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Singer @ 2023-04-25 20:46 UTC (permalink / raw)
To: platform-driver-x86
Cc: Jonathan Singer, Hans de Goede, Mark Gross, Jorge Lopez,
Kai-Heng Feng, Rishit Bansal, Mario Limonciello,
Barnabás Pőcze, linux-kernel
Previously, when the camera toggle switch was hit, the hp-wmi driver
would report an invalid event code. By adding a case for that in the
event handling switch statement we can eliminate that error code and
enable a framework for potential further kernel handling of that key.
This change was tested on my HP Envy x360 15-ey0023dx laptop, but it
would likely work for any HP laptop with a camera toggle button.
Signed-off-by: Jonathan Singer <jes965@nyu.edu>
---
drivers/platform/x86/hp/hp-wmi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
index 873f59c3e280..b27362209b04 100644
--- a/drivers/platform/x86/hp/hp-wmi.c
+++ b/drivers/platform/x86/hp/hp-wmi.c
@@ -90,6 +90,7 @@ enum hp_wmi_event_ids {
HPWMI_PEAKSHIFT_PERIOD = 0x0F,
HPWMI_BATTERY_CHARGE_PERIOD = 0x10,
HPWMI_SANITIZATION_MODE = 0x17,
+ HPWMI_CAMERA_TOGGLE = 0x1A,
HPWMI_OMEN_KEY = 0x1D,
HPWMI_SMART_EXPERIENCE_APP = 0x21,
};
@@ -866,6 +867,8 @@ static void hp_wmi_notify(u32 value, void *context)
break;
case HPWMI_SANITIZATION_MODE:
break;
+ case HPWMI_CAMERA_TOGGLE:
+ break;
case HPWMI_SMART_EXPERIENCE_APP:
break;
default:
--
2.40.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH 1/2] platform/x86: hp-wmi: Add camera toggle switch to HP WMI
2023-04-25 20:46 [PATCH 1/2] platform/x86: hp-wmi: Add camera toggle switch to HP WMI Jonathan Singer
@ 2023-04-25 20:56 ` Limonciello, Mario
2023-04-25 21:09 ` Function of the camera key on windows Jonathan Singer
0 siblings, 1 reply; 5+ messages in thread
From: Limonciello, Mario @ 2023-04-25 20:56 UTC (permalink / raw)
To: Jonathan Singer, platform-driver-x86@vger.kernel.org
Cc: Hans de Goede, Mark Gross, Jorge Lopez, Kai-Heng Feng,
Rishit Bansal, Barnabás Pőcze,
linux-kernel@vger.kernel.org
[Public]
> -----Original Message-----
> From: Jonathan Singer <jes965@nyu.edu>
> Sent: Tuesday, April 25, 2023 15:47
> To: platform-driver-x86@vger.kernel.org
> Cc: Jonathan Singer <jes965@nyu.edu>; Hans de Goede
> <hdegoede@redhat.com>; Mark Gross <markgross@kernel.org>; Jorge
> Lopez <jorge.lopez2@hp.com>; Kai-Heng Feng
> <kai.heng.feng@canonical.com>; Rishit Bansal <rishitbansal0@gmail.com>;
> Limonciello, Mario <Mario.Limonciello@amd.com>; Barnabás Pőcze
> <pobrn@protonmail.com>; linux-kernel@vger.kernel.org
> Subject: [PATCH 1/2] platform/x86: hp-wmi: Add camera toggle switch to HP
> WMI
>
> Previously, when the camera toggle switch was hit, the hp-wmi driver
> would report an invalid event code. By adding a case for that in the
> event handling switch statement we can eliminate that error code and
> enable a framework for potential further kernel handling of that key.
> This change was tested on my HP Envy x360 15-ey0023dx laptop, but it
> would likely work for any HP laptop with a camera toggle button.
>
Any idea what does the key actually do on Windows? Is it just for software
to show a message? Or some software respond to it?
The reason I'm asking is I wonder if you want this to be emitting KEY_CAMERA
instead perhaps.
Then desktop environments that support it can respond to KEY_CAMERA.
> Signed-off-by: Jonathan Singer <jes965@nyu.edu>
> ---
> drivers/platform/x86/hp/hp-wmi.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/platform/x86/hp/hp-wmi.c
> b/drivers/platform/x86/hp/hp-wmi.c
> index 873f59c3e280..b27362209b04 100644
> --- a/drivers/platform/x86/hp/hp-wmi.c
> +++ b/drivers/platform/x86/hp/hp-wmi.c
> @@ -90,6 +90,7 @@ enum hp_wmi_event_ids {
> HPWMI_PEAKSHIFT_PERIOD = 0x0F,
> HPWMI_BATTERY_CHARGE_PERIOD = 0x10,
> HPWMI_SANITIZATION_MODE = 0x17,
> + HPWMI_CAMERA_TOGGLE = 0x1A,
> HPWMI_OMEN_KEY = 0x1D,
> HPWMI_SMART_EXPERIENCE_APP = 0x21,
> };
> @@ -866,6 +867,8 @@ static void hp_wmi_notify(u32 value, void *context)
> break;
> case HPWMI_SANITIZATION_MODE:
> break;
> + case HPWMI_CAMERA_TOGGLE:
> + break;
> case HPWMI_SMART_EXPERIENCE_APP:
> break;
> default:
> --
> 2.40.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Function of the camera key on windows
2023-04-25 20:56 ` Limonciello, Mario
@ 2023-04-25 21:09 ` Jonathan Singer
2023-04-25 22:16 ` Limonciello, Mario
2023-04-26 8:59 ` Hans de Goede
0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Singer @ 2023-04-25 21:09 UTC (permalink / raw)
To: platform-driver-x86; +Cc: linux-kernel, Jonathan Singer
The key itself triggers a hardware response both on windows and linux.
It disconnects power from the camera USB module and raises a cover in front
of the camera aperature. The keycode is as far as I know only to notify the
operating system in case it wanted to show a message.
Is that the kind of use case that would benefit from emitting a KEY_CAMERA?
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Function of the camera key on windows
2023-04-25 21:09 ` Function of the camera key on windows Jonathan Singer
@ 2023-04-25 22:16 ` Limonciello, Mario
2023-04-26 8:59 ` Hans de Goede
1 sibling, 0 replies; 5+ messages in thread
From: Limonciello, Mario @ 2023-04-25 22:16 UTC (permalink / raw)
To: Jonathan Singer, platform-driver-x86@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
[Public]
> The key itself triggers a hardware response both on windows and linux.
> It disconnects power from the camera USB module and raises a cover in front
> of the camera aperature. The keycode is as far as I know only to notify the
> operating system in case it wanted to show a message.
>
> Is that the kind of use case that would benefit from emitting a KEY_CAMERA?
In my opinion it is something that for example GNOME could pick up and display
an image with a camera with a line through it. If it comes again it could toggle.
This is pretty similar to how mic mute works for example. The way you describe it
I think of it as "Camera mute".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Function of the camera key on windows
2023-04-25 21:09 ` Function of the camera key on windows Jonathan Singer
2023-04-25 22:16 ` Limonciello, Mario
@ 2023-04-26 8:59 ` Hans de Goede
1 sibling, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2023-04-26 8:59 UTC (permalink / raw)
To: Jonathan Singer, platform-driver-x86; +Cc: linux-kernel
Hi,
On 4/25/23 23:09, Jonathan Singer wrote:
> The key itself triggers a hardware response both on windows and linux.
> It disconnects power from the camera USB module and raises a cover in front
> of the camera aperature. The keycode is as far as I know only to notify the
> operating system in case it wanted to show a message.
>
> Is that the kind of use case that would benefit from emitting a KEY_CAMERA?
Actually we have SW_CAMERA_LENS_COVER for this and this is what
new Dell laptops with a similar feature use.
The problem with using a SW for this though is that we should then either:
a) Figure out a way to identify models which will report this; or
b) register a separate input_dev just for reporting the SW
on the first event.
This is necessary because unlike keys where only press + release
events really matter and if those never happens no harm is done,
switches can be acted upon by userspace in both there open and closed
state, so the mere presence of an input_device with a SW_CAMERA_LENS_COVER
may be acted upon by userspace. E.g. if we by default report
SW_CAMERA_LENS_COVER=1 (so lenscover closed) then apps who want to access
the camera may ask the user something like: "Your camera is currently
unavailable, please press the keyboard combination to enable your camera"
which makes no sense to ask on devices without such feature.
Note that simply registering a separate input_dev for just reporting
SW_CAMERA_LENS_COVER on the first event is a good workaround for
this though. We already do the same in other drivers for SW_TABLET_MODE
for similar reasons.
A second problem is that we would need to be able to tell if we
get the 0x1A event because of the camera being enabled or disabled,
but perhaps this info is already present in the event_data ?
Regards,
Hans
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-04-26 9:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-25 20:46 [PATCH 1/2] platform/x86: hp-wmi: Add camera toggle switch to HP WMI Jonathan Singer
2023-04-25 20:56 ` Limonciello, Mario
2023-04-25 21:09 ` Function of the camera key on windows Jonathan Singer
2023-04-25 22:16 ` Limonciello, Mario
2023-04-26 8:59 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox