diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-04-30 08:46:11 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:30:43 -0400 |
commit | fc2d573fb4e65393688d32bc128c70ddd8ecccc6 (patch) | |
tree | 3f824598c496536f9f0b7b008bb94eb5e723191b | |
parent | e01a234407af60c4b9854d069a7217d75fcdfa29 (diff) |
[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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/uvc/uvc_ctrl.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c index d6fe13de7ae..0dc2a9f7ca5 100644 --- a/drivers/media/video/uvc/uvc_ctrl.c +++ b/drivers/media/video/uvc/uvc_ctrl.c | |||
@@ -1015,6 +1015,24 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain, | |||
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | menu_info = &mapping->menu_info[query_menu->index]; | 1017 | menu_info = &mapping->menu_info[query_menu->index]; |
1018 | |||
1019 | if (ctrl->info.flags & UVC_CTRL_FLAG_GET_RES) { | ||
1020 | s32 bitmap; | ||
1021 | |||
1022 | if (!ctrl->cached) { | ||
1023 | ret = uvc_ctrl_populate_cache(chain, ctrl); | ||
1024 | if (ret < 0) | ||
1025 | goto done; | ||
1026 | } | ||
1027 | |||
1028 | bitmap = mapping->get(mapping, UVC_GET_RES, | ||
1029 | uvc_ctrl_data(ctrl, UVC_CTRL_DATA_RES)); | ||
1030 | if (!(bitmap & menu_info->value)) { | ||
1031 | ret = -EINVAL; | ||
1032 | goto done; | ||
1033 | } | ||
1034 | } | ||
1035 | |||
1018 | strlcpy(query_menu->name, menu_info->name, sizeof query_menu->name); | 1036 | strlcpy(query_menu->name, menu_info->name, sizeof query_menu->name); |
1019 | 1037 | ||
1020 | done: | 1038 | done: |