[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiDSCtRswXbGn6WBftgCaxavX5Z9OddTc5PTAmr2FVuoGPmeQ@mail.gmail.com>
Date: Mon, 4 Nov 2024 08:34:26 +0100
From: Ricardo Ribalda <ribalda@...omium.org>
To: chenchangcheng <ccc194101@....com>
Cc: laurent.pinchart@...asonboard.com, mchehab@...nel.org,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: uvcvideo:Create input device for all uvc devices
with status endpoints.
Hi
On Mon, 4 Nov 2024 at 03:10, chenchangcheng <ccc194101@....com> 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.
Out of curiosity, what app are you having issues with?
> 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@....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)) {
If there is no button, do you ever reach this point of the code?
> + 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);
> --
> 2.25.1
>
>
--
Ricardo Ribalda
Powered by blists - more mailing lists