diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2010-09-17 04:37:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-20 23:18:17 -0400 |
commit | 707dcd903f1805313ec4e79e386aeca8651ebf66 (patch) | |
tree | 38da87016aba11e4e9768a1c7185f922c50f4e38 | |
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>
-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, | |||
45 | unit << 8 | intfnum, data, size, timeout); | 45 | unit << 8 | intfnum, data, size, timeout); |
46 | } | 46 | } |
47 | 47 | ||
48 | static const char *uvc_query_name(__u8 query) | ||
49 | { | ||
50 | switch (query) { | ||
51 | case UVC_SET_CUR: | ||
52 | return "SET_CUR"; | ||
53 | case UVC_GET_CUR: | ||
54 | return "GET_CUR"; | ||
55 | case UVC_GET_MIN: | ||
56 | return "GET_MIN"; | ||
57 | case UVC_GET_MAX: | ||
58 | return "GET_MAX"; | ||
59 | case UVC_GET_RES: | ||
60 | return "GET_RES"; | ||
61 | case UVC_GET_LEN: | ||
62 | return "GET_LEN"; | ||
63 | case UVC_GET_INFO: | ||
64 | return "GET_INFO"; | ||
65 | case UVC_GET_DEF: | ||
66 | return "GET_DEF"; | ||
67 | default: | ||
68 | return "<invalid>"; | ||
69 | } | ||
70 | } | ||
71 | |||
48 | int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit, | 72 | int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit, |
49 | __u8 intfnum, __u8 cs, void *data, __u16 size) | 73 | __u8 intfnum, __u8 cs, void *data, __u16 size) |
50 | { | 74 | { |
@@ -53,9 +77,9 @@ int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit, | |||
53 | ret = __uvc_query_ctrl(dev, query, unit, intfnum, cs, data, size, | 77 | ret = __uvc_query_ctrl(dev, query, unit, intfnum, cs, data, size, |
54 | UVC_CTRL_CONTROL_TIMEOUT); | 78 | UVC_CTRL_CONTROL_TIMEOUT); |
55 | if (ret != size) { | 79 | if (ret != size) { |
56 | uvc_printk(KERN_ERR, "Failed to query (%u) UVC control %u " | 80 | uvc_printk(KERN_ERR, "Failed to query (%s) UVC control %u on " |
57 | "(unit %u) : %d (exp. %u).\n", query, cs, unit, ret, | 81 | "unit %u: %d (exp. %u).\n", uvc_query_name(query), cs, |
58 | size); | 82 | unit, ret, size); |
59 | return -EIO; | 83 | return -EIO; |
60 | } | 84 | } |
61 | 85 | ||