usb: gadget: uvc: fix bFrameIndex of streaming interface descriptor

The bFrameIndex of video streaming interface descriptor
is initialized to 1 in uvcg_frame_make(), but never be
setted for different frame resolutions, this cause host
to fail to select the correct frame resolution. This patch
increases the bFrameIndex in order.

Change-Id: Ic0609976e09d9e3d6f82595c00e2ac7b356e4f5f
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2018-08-02 11:29:40 +08:00
committed by Tao Huang
parent 9bf1f56462
commit 154e7b74ec

View File

@@ -1822,6 +1822,7 @@ static int __uvcg_iter_strm_cls(struct uvcg_streaming_header *h,
if (ret)
return ret;
}
j = 0;
}
return ret;
@@ -1956,12 +1957,15 @@ static int __uvcg_fill_strm(void *priv1, void *priv2, void *priv3, int n,
sizeof(*frm->dw_frame_interval);
memcpy(*dest, frm->dw_frame_interval, sz);
*dest += sz;
if (frm->fmt_type == UVCG_UNCOMPRESSED)
if (frm->fmt_type == UVCG_UNCOMPRESSED) {
h->bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(
frm->frame.b_frame_interval_type);
else if (frm->fmt_type == UVCG_MJPEG)
frm->frame.b_frame_index = n + 1;
} else if (frm->fmt_type == UVCG_MJPEG) {
h->bLength = UVC_DT_FRAME_MJPEG_SIZE(
frm->frame.b_frame_interval_type);
frm->frame.b_frame_index = n + 1;
}
}
break;
}