Commit 1b4e21c4 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

V4L/DVB: uvcvideo: Define control information bits using macros

Use the macros instead of hardcoding numerical constants for the
controls information bitfield.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 561474c2
...@@ -1324,9 +1324,8 @@ static void uvc_ctrl_add_ctrl(struct uvc_device *dev, ...@@ -1324,9 +1324,8 @@ static void uvc_ctrl_add_ctrl(struct uvc_device *dev,
/* Check if the device control information and length match /* Check if the device control information and length match
* the user supplied information. * the user supplied information.
*/ */
__u32 flags;
__le16 size; __le16 size;
__u8 inf; __u8 _info;
ret = uvc_query_ctrl(dev, UVC_GET_LEN, ctrl->entity->id, ret = uvc_query_ctrl(dev, UVC_GET_LEN, ctrl->entity->id,
dev->intfnum, info->selector, (__u8 *)&size, 2); dev->intfnum, info->selector, (__u8 *)&size, 2);
...@@ -1345,7 +1344,7 @@ static void uvc_ctrl_add_ctrl(struct uvc_device *dev, ...@@ -1345,7 +1344,7 @@ static void uvc_ctrl_add_ctrl(struct uvc_device *dev,
} }
ret = uvc_query_ctrl(dev, UVC_GET_INFO, ctrl->entity->id, ret = uvc_query_ctrl(dev, UVC_GET_INFO, ctrl->entity->id,
dev->intfnum, info->selector, &inf, 1); dev->intfnum, info->selector, &_info, 1);
if (ret < 0) { if (ret < 0) {
uvc_trace(UVC_TRACE_CONTROL, uvc_trace(UVC_TRACE_CONTROL,
"GET_INFO failed on control %pUl/%u (%d).\n", "GET_INFO failed on control %pUl/%u (%d).\n",
...@@ -1353,9 +1352,10 @@ static void uvc_ctrl_add_ctrl(struct uvc_device *dev, ...@@ -1353,9 +1352,10 @@ static void uvc_ctrl_add_ctrl(struct uvc_device *dev,
return; return;
} }
flags = info->flags; if (((info->flags & UVC_CONTROL_GET_CUR) &&
if (((flags & UVC_CONTROL_GET_CUR) && !(inf & (1 << 0))) || !(_info & UVC_CONTROL_CAP_GET)) ||
((flags & UVC_CONTROL_SET_CUR) && !(inf & (1 << 1)))) { ((info->flags & UVC_CONTROL_SET_CUR) &&
!(_info & UVC_CONTROL_CAP_SET))) {
uvc_trace(UVC_TRACE_CONTROL, "Control %pUl/%u flags " uvc_trace(UVC_TRACE_CONTROL, "Control %pUl/%u flags "
"don't match supported operations.\n", "don't match supported operations.\n",
info->entity, info->selector); info->entity, info->selector);
......
...@@ -160,5 +160,12 @@ ...@@ -160,5 +160,12 @@
#define UVC_STATUS_TYPE_CONTROL 1 #define UVC_STATUS_TYPE_CONTROL 1
#define UVC_STATUS_TYPE_STREAMING 2 #define UVC_STATUS_TYPE_STREAMING 2
/* 4.1.2. Control Capabilities */
#define UVC_CONTROL_CAP_GET (1 << 0)
#define UVC_CONTROL_CAP_SET (1 << 1)
#define UVC_CONTROL_CAP_DISABLED (1 << 2)
#define UVC_CONTROL_CAP_AUTOUPDATE (1 << 3)
#define UVC_CONTROL_CAP_ASYNCHRONOUS (1 << 4)
#endif /* __LINUX_USB_VIDEO_H */ #endif /* __LINUX_USB_VIDEO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment