public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: chenchangcheng <ccc194101@163.com>
Cc: 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: Fri, 8 Nov 2024 04:07:51 +0200	[thread overview]
Message-ID: <20241108020751.GE32614@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20241108015658.471109-1-ccc194101@163.com>

Hello,

On Fri, Nov 08, 2024 at 09:56:58AM +0800, chenchangcheng wrote:
> 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.

As Mauro previously mentioned, this seems to be an application issue,
not a kernel issue. You should fix the application.

> Create input device for all uvc devices with status endpoints.
> and only when bTriggerSupport and bTriggerUsage are one are
> allowed to report camera button.
> 
> Fixes: 3bc22dc66a4f ("media: uvcvideo: Only create input devs if hw supports it")
> 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);
> 
> base-commit: ff7afaeca1a15fbeaa2c4795ee806c0667bd77b2

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-11-08  2:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  1:56 [PATCH] media: uvcvideo:Create input device for all uvc devices with status endpoints chenchangcheng
2024-11-08  2:07 ` Laurent Pinchart [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-11-04  2:39 chenchangcheng
2024-11-04  8:43 ` kernel test robot
2024-11-04 10:05 ` Mauro Carvalho Chehab
2024-11-04 10:05 ` kernel test robot
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=20241108020751.GE32614@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=ccc194101@163.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