lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YftJff6gxQ96TnI1@pendragon.ideasonboard.com>
Date:   Thu, 3 Feb 2022 05:18:21 +0200
From:   Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:     Ricardo Ribalda <ribalda@...omium.org>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/2] media: uvcvideo: Only create input devs if hw
 supports it

Hi Ricardo,

Thank you for the patch.

On Mon, Jan 24, 2022 at 08:00:12PM +0100, Ricardo Ribalda wrote:
> Examine the stream headers to figure out if the device has a GPIO and
> can be used as an input.
> 
> Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
> ---
>  drivers/media/usb/uvc/uvc_status.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
> index 753c8226db70..3ef0b281ffc5 100644
> --- a/drivers/media/usb/uvc/uvc_status.c
> +++ b/drivers/media/usb/uvc/uvc_status.c
> @@ -18,11 +18,34 @@
>   * Input device
>   */
>  #ifdef CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV
> +
> +static bool uvc_input_has_button(struct uvc_device *dev)
> +{
> +	struct uvc_streaming *stream;
> +
> +	/*
> +	 * The device has GPIO button event if both bTriggerSupport and

The UVC specification doesn't talk about GPIOs but about buttons. With
s/GPIO button event/button events/ here and s/GPIO/button/ in the commit
message,

Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>

> +	 * bTriggerUsage are one. Otherwise the camera button does not
> +	 * exist or is handled automatically by the camera without host
> +	 * driver or client application intervention.
> +	 */
> +	list_for_each_entry(stream, &dev->streams, list) {
> +		if (stream->header.bTriggerSupport == 1 &&
> +		    stream->header.bTriggerUsage == 1)
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
>  static int uvc_input_init(struct uvc_device *dev)
>  {
>  	struct input_dev *input;
>  	int ret;
>  
> +	if (!uvc_input_has_button(dev))
> +		return 0;
> +
>  	input = input_allocate_device();
>  	if (input == NULL)
>  		return -ENOMEM;

-- 
Regards,

Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ