Re: [PATCH] media: uvcvideo: Fix bandwidth error for Alcor camera

From: Ricardo Ribalda
Date: Thu Nov 10 2022 - 05:42:10 EST


Hi Ai

Thanks for your patch

On Thu, 10 Nov 2022 at 09:15, Ai Chao <aichao@xxxxxxxxxx> wrote:
>
> For Alcor Corp. Slave camera(1b17:6684), it support to
> output compressed video data, and it return a wrong
> dwMaxPayloadTransferSize fields. This is a fireware issue,

s/fireware/firmware/

> but the manufacturer cannot provide a const return fields
> by the fireware. so we check the dwMaxPayloadTransferSize fields,
> if it large than 0x1000, reset dwMaxPayloadTransferSize to 1024.


Can you also provide the output of lsusb -d 1b17:6684 -v

>
> Signed-off-by: Ai Chao <aichao@xxxxxxxxxx>
> ---
> drivers/media/usb/uvc/uvc_video.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index d2eb9066e4dc..49226c3f423c 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -234,6 +234,14 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,
>
> ctrl->dwMaxPayloadTransferSize = bandwidth;
> }
> +
> + /*Alcor Corp. Slave camera return wrong dwMaxPayloadTransferSize*/
> + if ((format->flags & UVC_FMT_FLAG_COMPRESSED) &&
> + (ctrl->dwMaxPayloadTransferSize > 0x1000) &&
> + (le16_to_cpu(stream->dev->udev->descriptor.idVendor) == 0x1b17) &&
> + (le16_to_cpu(stream->dev->udev->descriptor.idProduct) == 0x6684)) {
> + ctrl->dwMaxPayloadTransferSize = 1024;
> + }


What happens to transfersize between 1024 and 0x1000 (4096), are they ok?

Instead of le16_to_cpu(stream->dev->udev->descriptor.idVendor) ==
0x1b17) you can use usb_match_one_id

Thanks!

> }
>
> static size_t uvc_video_ctrl_size(struct uvc_streaming *stream)
> --
> 2.25.1
>


--
Ricardo Ribalda