@@ -2128,6 +2128,17 @@ static int __uvc_ctrl_add_mapping(struct uvc_device *dev,
if (map->set == NULL)
map->set = uvc_set_le_value;
+ switch (V4L2_CTRL_ID2WHICH(map->id)) {
+ case V4L2_CTRL_ID2WHICH(V4L2_CID_CAMERA_CLASS):
+ dev->ctrl_class_unit->ctrl_class.bmControls[0] |=
+ BIT(UVC_CC_CAMERA_CLASS);
+ break;
+ case V4L2_CTRL_ID2WHICH(V4L2_CID_USER_CLASS):
+ dev->ctrl_class_unit->ctrl_class.bmControls[0] |=
+ BIT(UVC_CC_USER_CLASS);
+ break;
+ }
+
list_add_tail(&map->list, &ctrl->info.mappings);
uvc_dbg(dev, CONTROL, "Adding mapping '%s' to control %pUl/%u\n",
map->name, ctrl->info.entity, ctrl->info.selector);
@@ -1501,7 +1501,6 @@ static int uvc_ctrl_class_parse(struct uvc_device *dev)
unit->ctrl_class.bControlSize = 1;
unit->ctrl_class.bmControls = (u8 *)unit + sizeof(*unit);
- unit->ctrl_class.bmControls[0] = (1 << (UVC_CC_LAST_CLASS + 1)) - 1;
unit->get_info = uvc_ctrl_class_get_info;
strncpy(unit->name, "Control Class", sizeof(unit->name) - 1);
@@ -186,7 +186,6 @@
*/
#define UVC_CC_CAMERA_CLASS 0
#define UVC_CC_USER_CLASS 1
-#define UVC_CC_LAST_CLASS UVC_CC_USER_CLASS
/* ------------------------------------------------------------------------
* Driver specific constants.
Do not create Control Classes for empty classes. Fixes v4l2-compliance: Control ioctls (Input 0): fail: v4l2-test-controls.cpp(255): no controls in class 009d0000 test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: FAIL Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> --- drivers/media/usb/uvc/uvc_ctrl.c | 11 +++++++++++ drivers/media/usb/uvc/uvc_driver.c | 1 - drivers/media/usb/uvc/uvcvideo.h | 1 - 3 files changed, 11 insertions(+), 2 deletions(-)