libuvc: add UVC 1.50 support

genodelabs/genode#4231
This commit is contained in:
Johannes Schlatow 2021-07-21 19:14:35 +02:00 committed by Christian Helmuth
parent b51b9e1ef3
commit 1bfc828826
3 changed files with 57 additions and 1 deletions

View File

@ -1 +1 @@
7a28e14a7037264f56d8a9a25e9c354054d6294d
71fd7ae692e1dadaaf191edc3de532efa6b2e1af

View File

@ -9,6 +9,9 @@ DIR(libuvc) := src/lib/libuvc
DIRS := include/libuvc
DIR_CONTENT(include/libuvc) := src/lib/libuvc/include/libuvc/libuvc.h
PATCHES := src/lib/libuvc/uvc150.patch
PATCH_OPT := -p1 -d src/lib/libuvc
default: include/libuvc/libuvc_config.h
include/libuvc/libuvc_config.h: _dirs

View File

@ -0,0 +1,53 @@
--- a/src/device.c
+++ b/src/device.c
@@ -1089,6 +1089,8 @@ uvc_error_t uvc_parse_vc_header(uvc_device_t *dev,
info->ctrl_if.dwClockFrequency = DW_TO_INT(block + 7);
case 0x0110:
break;
+ case 0x0150:
+ break;
default:
UVC_EXIT(UVC_ERROR_NOT_SUPPORTED);
return UVC_ERROR_NOT_SUPPORTED;
--- a/src/stream.c
+++ b/src/stream.c
@@ -191,16 +191,18 @@ uvc_error_t uvc_query_stream_ctrl(
uvc_stream_ctrl_t *ctrl,
uint8_t probe,
enum uvc_req_code req) {
- uint8_t buf[34];
+ uint8_t buf[48];
size_t len;
uvc_error_t err;
memset(buf, 0, sizeof(buf));
- if (devh->info->ctrl_if.bcdUVC >= 0x0110)
+ if (devh->info->ctrl_if.bcdUVC < 0x0110)
+ len = 26;
+ else if (devh->info->ctrl_if.bcdUVC < 0x0150)
len = 34;
else
- len = 26;
+ len = 48;
/* prepare for a SET transfer */
if (req == UVC_SET_CUR) {
@@ -216,7 +218,7 @@ uvc_error_t uvc_query_stream_ctrl(
INT_TO_DW(ctrl->dwMaxVideoFrameSize, buf + 18);
INT_TO_DW(ctrl->dwMaxPayloadTransferSize, buf + 22);
- if (len == 34) {
+ if (len >= 34) {
INT_TO_DW ( ctrl->dwClockFrequency, buf + 26 );
buf[30] = ctrl->bmFramingInfo;
buf[31] = ctrl->bPreferredVersion;
@@ -254,7 +256,7 @@ uvc_error_t uvc_query_stream_ctrl(
ctrl->dwMaxVideoFrameSize = DW_TO_INT(buf + 18);
ctrl->dwMaxPayloadTransferSize = DW_TO_INT(buf + 22);
- if (len == 34) {
+ if (len >= 34) {
ctrl->dwClockFrequency = DW_TO_INT ( buf + 26 );
ctrl->bmFramingInfo = buf[30];
ctrl->bPreferredVersion = buf[31];