summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/export-to-postgresql.py
diff options
context:
space:
mode:
authorRong Zhang <i@rong.moe>2026-09-24 00:31:27 +0800
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2026-10-13 12:05:28 +0300
commit97fa641b21c0bf05e2c714c971a19f9d24b42d6f (patch)
tree918c9bb69547747f5c72cbee196b7611a0a7b861 /tools/perf/scripts/python/export-to-postgresql.py
parent1b55ec81926eb7f6e4fad692fa4040a569e9daf7 (diff)
platform/x86: ideapad-laptop: Report camera switch as SW_CAMERA_LENS_COVER
On certain 2025 Lenovo laptops, such as the Yoga Pro 7 14ASP10 and Legion Pro 7 16AFR10H, a switch on the side disables the camera. This is handled by the firmware, which also sends event 0x0d (camera disabled) or 0x0c (camera enabled) through the WMI event GUID handled with ideapad_wmi_context_fn_keys. These events are currently reported as KEY_UNKNOWN. Other Lenovo laptops expose a similar camera switch through a separate WMI GUID, which lenovo-wmi-camera reports as SW_CAMERA_LENS_COVER since commit d98bf6a6ed61 ("platform/x86: lenovo-wmi-camera: Use SW_CAMERA_LENS_COVER instead of KEY_CAMERA_ACESS"). That driver does not bind on these laptops, so map the WMI events to SW_CAMERA_LENS_COVER as well via sparse keymap KE_SW. Unfortunately, there is no programmatic way to determine the current state on the mentioned devices until the next relevant WMI key event. Therefore, no switch event is emitted on probe or resume, intentionally leaving the default (0, i.e., no covered) or the last state unchanged, and let the first relevant WMI key event to correct it. This should fulfill the requirement of using the switch events to show an OSD. AFAIK, no userspace software queries its state via EVIOCGBIT(EV_SW). The above behavior is basically the same as lenovo-wmi-camera, except that SW_CAMERA_LENS_COVER is always exposed even on devices with no camera switch. It's because, again, there is no programmatic way to determine the switch's existence on the mentioned devices. Doing so should be harmless as long as no switch event is emitted and eliminates the need to dynamically register an additional input device at run time like lenovo-wmi-camera does. Even if a userspace program does query the switch's state via EVIOCGBIT(EV_SW), the returned state will always be 0 (not covered), which is the correct state on unsupported devices. Co-developed-by: Marco Giunta <marco_giunta@outlook.it> Signed-off-by: Marco Giunta <marco_giunta@outlook.it> Tested-by: Marco Giunta <marco_giunta@outlook.it> Signed-off-by: Rong Zhang <i@rong.moe> Reviewed-by: Huang Wei <huangwei@kylinos.cn> Link: https://patch.msgid.link/20260924-ideapad-laptop-camera-sw-v3-1-922ea6a9fff4@rong.moe Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions