diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-01-10 14:48:02 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-01-10 14:48:02 -0500 |
commit | 68c404b18f6fba404b2753622d0459c68ee128ae (patch) | |
tree | c1ec0bb12f19d91071b461cc2831d9d3dd4c74f3 /drivers/media/video/uvc/uvc_ctrl.c | |
parent | d035c36c58dd9183ad6aa7875dea89893faedb55 (diff) | |
parent | 6650239a4b01077e80d5a4468562756d77afaa59 (diff) |
Merge branch 'bugfixes' into nfs-for-2.6.38
Conflicts:
fs/nfs/nfs2xdr.c
fs/nfs/nfs3xdr.c
fs/nfs/nfs4xdr.c
Diffstat (limited to 'drivers/media/video/uvc/uvc_ctrl.c')
-rw-r--r-- | drivers/media/video/uvc/uvc_ctrl.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c index f169f7736677..59f8a9ad3796 100644 --- a/drivers/media/video/uvc/uvc_ctrl.c +++ b/drivers/media/video/uvc/uvc_ctrl.c | |||
@@ -785,7 +785,7 @@ static void __uvc_find_control(struct uvc_entity *entity, __u32 v4l2_id, | |||
785 | } | 785 | } |
786 | } | 786 | } |
787 | 787 | ||
788 | struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, | 788 | static struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, |
789 | __u32 v4l2_id, struct uvc_control_mapping **mapping) | 789 | __u32 v4l2_id, struct uvc_control_mapping **mapping) |
790 | { | 790 | { |
791 | struct uvc_control *ctrl = NULL; | 791 | struct uvc_control *ctrl = NULL; |
@@ -944,6 +944,52 @@ done: | |||
944 | return ret; | 944 | return ret; |
945 | } | 945 | } |
946 | 946 | ||
947 | /* | ||
948 | * Mapping V4L2 controls to UVC controls can be straighforward if done well. | ||
949 | * Most of the UVC controls exist in V4L2, and can be mapped directly. Some | ||
950 | * must be grouped (for instance the Red Balance, Blue Balance and Do White | ||
951 | * Balance V4L2 controls use the White Balance Component UVC control) or | ||
952 | * otherwise translated. The approach we take here is to use a translation | ||
953 | * table for the controls that can be mapped directly, and handle the others | ||
954 | * manually. | ||
955 | */ | ||
956 | int uvc_query_v4l2_menu(struct uvc_video_chain *chain, | ||
957 | struct v4l2_querymenu *query_menu) | ||
958 | { | ||
959 | struct uvc_menu_info *menu_info; | ||
960 | struct uvc_control_mapping *mapping; | ||
961 | struct uvc_control *ctrl; | ||
962 | u32 index = query_menu->index; | ||
963 | u32 id = query_menu->id; | ||
964 | int ret; | ||
965 | |||
966 | memset(query_menu, 0, sizeof(*query_menu)); | ||
967 | query_menu->id = id; | ||
968 | query_menu->index = index; | ||
969 | |||
970 | ret = mutex_lock_interruptible(&chain->ctrl_mutex); | ||
971 | if (ret < 0) | ||
972 | return -ERESTARTSYS; | ||
973 | |||
974 | ctrl = uvc_find_control(chain, query_menu->id, &mapping); | ||
975 | if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) { | ||
976 | ret = -EINVAL; | ||
977 | goto done; | ||
978 | } | ||
979 | |||
980 | if (query_menu->index >= mapping->menu_count) { | ||
981 | ret = -EINVAL; | ||
982 | goto done; | ||
983 | } | ||
984 | |||
985 | menu_info = &mapping->menu_info[query_menu->index]; | ||
986 | strlcpy(query_menu->name, menu_info->name, sizeof query_menu->name); | ||
987 | |||
988 | done: | ||
989 | mutex_unlock(&chain->ctrl_mutex); | ||
990 | return ret; | ||
991 | } | ||
992 | |||
947 | 993 | ||
948 | /* -------------------------------------------------------------------------- | 994 | /* -------------------------------------------------------------------------- |
949 | * Control transactions | 995 | * Control transactions |