Am 11.11.24 um 15:33 schrieb Hans de Goede:
Hi Ai, I have been looking into all the different way the kernel is currently communicating to userspace that a camera is disabled by some form of on/off switch / privacy control, see: https://lore.kernel.org/linuxa-media/a644fed4-aff5-4514-8e35-d6cab642d3dd@xxxxxxxxxx/ As I mention there my proposal is to standardize on SW_CAMERA_LENS_COVER. This assumes that the button which generates the WMI events actually enables / disables the camera the hardware level.
Hi, i think SW_CAMERA_LENS_COVER is misleading here, since AFAIK the camera completely disappears from the USB bus. With a proper lens cover however, the camera would still be accessible for querying things like supported resolutions, etc. Also i believe that the intent of the buttons handled by this driver is to disable access to all cameras connected to the system, so KEY_CAMERA_ACCESS_ENABLE / KEY_CAMERA_ACCESS_DISABLE is necessary here if external USB cameras are connected. Thanks, Armin Wolf
The problem with the current KEY_CAMERA_ACCESS_ENABLE / KEY_CAMERA_ACCESS_DISABLE events is that looking at the HUTRR72 specification from which these come it talks about: "Enables programmatic access to camera device" which suggests that it is a request to the OS / desktop- environment to block camera access at the software level, rather then reporting back that a hw-level block is in place. One problem with moving to a EV_SW like SW_CAMERA_LENS_COVER is that that needs to report the correct value right away. Is there a way to get the initial state of the camera through the WMI interface so that we can report the correct as soon as we register the input evdev device with SW_CAMERA_LENS_COVER capability ? Otherwise we could use the same solution which the hp-wmi driver uses which is to delay registering the input device until the first event (since then we do know the state), see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/hp/hp-wmi.c#n792 and the caller of camera_shutter_input_setup(). Regards, Hans