diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2010-09-17 05:37:26 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-21 01:18:17 -0200 |
commit | 707dcd903f1805313ec4e79e386aeca8651ebf66 (patch) | |
tree | 38da87016aba11e4e9768a1c7185f922c50f4e38 /drivers | |
parent | f9d81df9b8d77f238b3053eb645572ab6651cc8d (diff) |
[media] uvcvideo: Print query name in uvc_query_ctrl()
Instead of printing the query hex value in error messages, print its
name to make the messages more readable.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/uvc/uvc_video.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index e27cf0d3b6d9..ef55877cc2f3 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c @@ -45,6 +45,30 @@ static int __uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit, unit << 8 | intfnum, data, size, timeout); } +static const char *uvc_query_name(__u8 query) +{ + switch (query) { + case UVC_SET_CUR: + return "SET_CUR"; + case UVC_GET_CUR: + return "GET_CUR"; + case UVC_GET_MIN: + return "GET_MIN"; + case UVC_GET_MAX: + return "GET_MAX"; + case UVC_GET_RES: + return "GET_RES"; + case UVC_GET_LEN: + return "GET_LEN"; + case UVC_GET_INFO: + return "GET_INFO"; + case UVC_GET_DEF: + return "GET_DEF"; + default: + return "<invalid>"; + } +} + int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit, __u8 intfnum, __u8 cs, void *data, __u16 size) { @@ -53,9 +77,9 @@ int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit, ret = __uvc_query_ctrl(dev, query, unit, intfnum, cs, data, size, UVC_CTRL_CONTROL_TIMEOUT); if (ret != size) { - uvc_printk(KERN_ERR, "Failed to query (%u) UVC control %u " - "(unit %u) : %d (exp. %u).\n", query, cs, unit, ret, - size); + uvc_printk(KERN_ERR, "Failed to query (%s) UVC control %u on " + "unit %u: %d (exp. %u).\n", uvc_query_name(query), cs, + unit, ret, size); return -EIO; } |