public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: chenchangcheng <ccc194101@163.com>
Cc: laurent.pinchart@ideasonboard.com, mchehab@kernel.org,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] media: uvcvideo:Create input device for all uvc devices with status endpoints.
Date: Mon, 4 Nov 2024 11:05:53 +0100	[thread overview]
Message-ID: <20241104110553.6687a58e@foz.lan> (raw)
In-Reply-To: <20241104023947.826707-1-ccc194101@163.com>

Em Mon,  4 Nov 2024 10:39:47 +0800
chenchangcheng <ccc194101@163.com> escreveu:

> Some applications need to check if there is an input device on the camera
> before proceeding to the next step. When there is no input device,
> the application will report an error.

Nack.

It is not mandatory for V4L2 devices to create input devices.

It sounds to me that this is an application bug, not a Kernel one.
What applications have such bug?

> Create input device for all uvc devices with status endpoints.
> and only when bTriggerSupport and bTriggerUsage are one are
> allowed to report camera button.

Please fix the application instead.

> 
> Fixes: 3bc22dc66a4f ("media: uvcvideo: Only create input devs if hw supports it")

Regards,
Mauro

> Signed-off-by: chenchangcheng <ccc194101@163.com>
> ---
>  drivers/media/usb/uvc/uvc_status.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
> index a78a88c710e2..177640c6a813 100644
> --- a/drivers/media/usb/uvc/uvc_status.c
> +++ b/drivers/media/usb/uvc/uvc_status.c
> @@ -44,9 +44,6 @@ 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;
> @@ -110,10 +107,12 @@ static void uvc_event_streaming(struct uvc_device *dev,
>  		if (len <= offsetof(struct uvc_status, streaming))
>  			return;
>  
> -		uvc_dbg(dev, STATUS, "Button (intf %u) %s len %d\n",
> -			status->bOriginator,
> -			status->streaming.button ? "pressed" : "released", len);
> -		uvc_input_report_key(dev, KEY_CAMERA, status->streaming.button);
> +		if (uvc_input_has_button(dev)) {
> +			uvc_dbg(dev, STATUS, "Button (intf %u) %s len %d\n",
> +				status->bOriginator,
> +				status->streaming.button ? "pressed" : "released", len);
> +			uvc_input_report_key(dev, KEY_CAMERA, status->streaming.button);
> +		}
>  	} else {
>  		uvc_dbg(dev, STATUS, "Stream %u error event %02x len %d\n",
>  			status->bOriginator, status->bEvent, len);



Thanks,
Mauro

  parent reply	other threads:[~2024-11-04 10:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04  2:39 [PATCH] media: uvcvideo:Create input device for all uvc devices with status endpoints chenchangcheng
2024-11-04  8:43 ` kernel test robot
2024-11-04 10:05 ` kernel test robot
2024-11-04 10:05 ` Mauro Carvalho Chehab [this message]
2024-11-05  1:35   ` ccc194101
  -- strict thread matches above, loose matches on Subject: below --
2024-11-08  1:56 chenchangcheng
2024-11-08  2:07 ` Laurent Pinchart
2024-11-04  2:09 chenchangcheng
2024-11-04  7:34 ` Ricardo Ribalda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241104110553.6687a58e@foz.lan \
    --to=mchehab+huawei@kernel.org \
    --cc=ccc194101@163.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox