提交 fc2d573f 编写于 作者: L Laurent Pinchart 提交者: Mauro Carvalho Chehab

[media] uvcvideo: Don't report unsupported menu entries

Supported menu entries are reported by the device in response to the
GET_RES query. Use the information to return -EINVAL to userspace for
unsupported values when enumerating menu entries.
Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 e01a2344
......@@ -1015,6 +1015,24 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain,
}
menu_info = &mapping->menu_info[query_menu->index];
if (ctrl->info.flags & UVC_CTRL_FLAG_GET_RES) {
s32 bitmap;
if (!ctrl->cached) {
ret = uvc_ctrl_populate_cache(chain, ctrl);
if (ret < 0)
goto done;
}
bitmap = mapping->get(mapping, UVC_GET_RES,
uvc_ctrl_data(ctrl, UVC_CTRL_DATA_RES));
if (!(bitmap & menu_info->value)) {
ret = -EINVAL;
goto done;
}
}
strlcpy(query_menu->name, menu_info->name, sizeof query_menu->name);
done:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册