aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-06-22 10:55:09 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:11:44 -0400
commit21575c13125f2ef790e192e2c70e446c6cfe0d7d (patch)
tree7224a377c03a8c365bcc31f26e30363e9c5d3ce3
parent7dc1b8844eb3e0a91911f20736db87f4876e14b4 (diff)
V4L/DVB (8103): videodev: fix/improve ioctl debugging
Various ioctl debugging fixes and improvements: - use %x rather than %d for control IDs and bitmask fields - make two arrays const - show the whole control array for the ext_ctrl ioctls - print pix_fmt for V4L2_BUF_TYPE_VIDEO_OUTPUT - show full type name rather than an integer - fix CROPCAP debugging - fix G/S_TUNER debugging - show error code in case of an error - other small cleanups Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/videodev.c259
-rw-r--r--include/media/v4l2-dev.h4
2 files changed, 150 insertions, 113 deletions
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 0d56305c153e..91902d52d022 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -17,15 +17,19 @@
17 */ 17 */
18 18
19#define dbgarg(cmd, fmt, arg...) \ 19#define dbgarg(cmd, fmt, arg...) \
20 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { \ 20 do { \
21 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { \
21 printk(KERN_DEBUG "%s: ", vfd->name); \ 22 printk(KERN_DEBUG "%s: ", vfd->name); \
22 v4l_printk_ioctl(cmd); \ 23 v4l_printk_ioctl(cmd); \
23 printk(" " fmt, ## arg); \ 24 printk(" " fmt, ## arg); \
24 } 25 } \
26 } while (0)
25 27
26#define dbgarg2(fmt, arg...) \ 28#define dbgarg2(fmt, arg...) \
27 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) \ 29 do { \
28 printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg); 30 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) \
31 printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);\
32 } while (0)
29 33
30#include <linux/module.h> 34#include <linux/module.h>
31#include <linux/types.h> 35#include <linux/types.h>
@@ -138,7 +142,7 @@ EXPORT_SYMBOL(v4l2_video_std_construct);
138/* ----------------------------------------------------------------- */ 142/* ----------------------------------------------------------------- */
139/* some arrays for pretty-printing debug messages of enum types */ 143/* some arrays for pretty-printing debug messages of enum types */
140 144
141char *v4l2_field_names[] = { 145const char *v4l2_field_names[] = {
142 [V4L2_FIELD_ANY] = "any", 146 [V4L2_FIELD_ANY] = "any",
143 [V4L2_FIELD_NONE] = "none", 147 [V4L2_FIELD_NONE] = "none",
144 [V4L2_FIELD_TOP] = "top", 148 [V4L2_FIELD_TOP] = "top",
@@ -152,19 +156,19 @@ char *v4l2_field_names[] = {
152}; 156};
153EXPORT_SYMBOL(v4l2_field_names); 157EXPORT_SYMBOL(v4l2_field_names);
154 158
155char *v4l2_type_names[] = { 159const char *v4l2_type_names[] = {
156 [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "video-cap", 160 [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "vid-cap",
157 [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "video-over", 161 [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "vid-overlay",
158 [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "video-out", 162 [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "vid-out",
159 [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap", 163 [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap",
160 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", 164 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
161 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap", 165 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
162 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out", 166 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out",
163 [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over", 167 [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "vid-out-overlay",
164}; 168};
165EXPORT_SYMBOL(v4l2_type_names); 169EXPORT_SYMBOL(v4l2_type_names);
166 170
167static char *v4l2_memory_names[] = { 171static const char *v4l2_memory_names[] = {
168 [V4L2_MEMORY_MMAP] = "mmap", 172 [V4L2_MEMORY_MMAP] = "mmap",
169 [V4L2_MEMORY_USERPTR] = "userptr", 173 [V4L2_MEMORY_USERPTR] = "userptr",
170 [V4L2_MEMORY_OVERLAY] = "overlay", 174 [V4L2_MEMORY_OVERLAY] = "overlay",
@@ -660,7 +664,7 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd,
660 p->field, p->sequence, 664 p->field, p->sequence,
661 prt_names(p->memory, v4l2_memory_names), 665 prt_names(p->memory, v4l2_memory_names),
662 p->m.userptr, p->length); 666 p->m.userptr, p->length);
663 dbgarg2 ("timecode= %02d:%02d:%02d type=%d, " 667 dbgarg2("timecode=%02d:%02d:%02d type=%d, "
664 "flags=0x%08d, frames=%d, userbits=0x%08x\n", 668 "flags=0x%08d, frames=%d, userbits=0x%08x\n",
665 tc->hours,tc->minutes,tc->seconds, 669 tc->hours,tc->minutes,tc->seconds,
666 tc->type, tc->flags, tc->frames, *(__u32 *) tc->userbits); 670 tc->type, tc->flags, tc->frames, *(__u32 *) tc->userbits);
@@ -669,7 +673,7 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd,
669static inline void dbgrect(struct video_device *vfd, char *s, 673static inline void dbgrect(struct video_device *vfd, char *s,
670 struct v4l2_rect *r) 674 struct v4l2_rect *r)
671{ 675{
672 dbgarg2 ("%sRect start at %dx%d, size= %dx%d\n", s, r->left, r->top, 676 dbgarg2("%sRect start at %dx%d, size=%dx%d\n", s, r->left, r->top,
673 r->width, r->height); 677 r->width, r->height);
674}; 678};
675 679
@@ -687,6 +691,25 @@ static inline void v4l_print_pix_fmt (struct video_device *vfd,
687 fmt->bytesperline, fmt->sizeimage, fmt->colorspace); 691 fmt->bytesperline, fmt->sizeimage, fmt->colorspace);
688}; 692};
689 693
694static inline void v4l_print_ext_ctrls(unsigned int cmd,
695 struct video_device *vfd, struct v4l2_ext_controls *c, int show_vals)
696{
697 __u32 i;
698
699 if (!(vfd->debug & V4L2_DEBUG_IOCTL_ARG))
700 return;
701 dbgarg(cmd, "");
702 printk(KERN_CONT "class=0x%x", c->ctrl_class);
703 for (i = 0; i < c->count; i++) {
704 if (show_vals)
705 printk(KERN_CONT " id/val=0x%x/0x%x",
706 c->controls[i].id, c->controls[i].value);
707 else
708 printk(KERN_CONT " id=0x%x", c->controls[i].id);
709 }
710 printk(KERN_CONT "\n");
711};
712
690 713
691static int check_fmt (struct video_device *vfd, enum v4l2_buf_type type) 714static int check_fmt (struct video_device *vfd, enum v4l2_buf_type type)
692{ 715{
@@ -894,7 +917,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
894 if (vfd->vidioc_g_fmt_vid_cap) 917 if (vfd->vidioc_g_fmt_vid_cap)
895 ret = vfd->vidioc_g_fmt_vid_cap(file, fh, f); 918 ret = vfd->vidioc_g_fmt_vid_cap(file, fh, f);
896 if (!ret) 919 if (!ret)
897 v4l_print_pix_fmt(vfd,&f->fmt.pix); 920 v4l_print_pix_fmt(vfd, &f->fmt.pix);
898 break; 921 break;
899 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 922 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
900 if (vfd->vidioc_g_fmt_vid_overlay) 923 if (vfd->vidioc_g_fmt_vid_overlay)
@@ -904,6 +927,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
904 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 927 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
905 if (vfd->vidioc_g_fmt_vid_out) 928 if (vfd->vidioc_g_fmt_vid_out)
906 ret = vfd->vidioc_g_fmt_vid_out(file, fh, f); 929 ret = vfd->vidioc_g_fmt_vid_out(file, fh, f);
930 if (!ret)
931 v4l_print_pix_fmt(vfd, &f->fmt.pix);
907 break; 932 break;
908 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: 933 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
909 if (vfd->vidioc_g_fmt_vid_out_overlay) 934 if (vfd->vidioc_g_fmt_vid_out_overlay)
@@ -942,12 +967,11 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
942 struct v4l2_format *f = (struct v4l2_format *)arg; 967 struct v4l2_format *f = (struct v4l2_format *)arg;
943 968
944 /* FIXME: Should be one dump per type */ 969 /* FIXME: Should be one dump per type */
945 dbgarg (cmd, "type=%s\n", prt_names(f->type, 970 dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
946 v4l2_type_names));
947 971
948 switch (f->type) { 972 switch (f->type) {
949 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 973 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
950 v4l_print_pix_fmt(vfd,&f->fmt.pix); 974 v4l_print_pix_fmt(vfd, &f->fmt.pix);
951 if (vfd->vidioc_s_fmt_vid_cap) 975 if (vfd->vidioc_s_fmt_vid_cap)
952 ret = vfd->vidioc_s_fmt_vid_cap(file, fh, f); 976 ret = vfd->vidioc_s_fmt_vid_cap(file, fh, f);
953 break; 977 break;
@@ -957,6 +981,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
957 fh, f); 981 fh, f);
958 break; 982 break;
959 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 983 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
984 v4l_print_pix_fmt(vfd, &f->fmt.pix);
960 if (vfd->vidioc_s_fmt_vid_out) 985 if (vfd->vidioc_s_fmt_vid_out)
961 ret = vfd->vidioc_s_fmt_vid_out(file, fh, f); 986 ret = vfd->vidioc_s_fmt_vid_out(file, fh, f);
962 break; 987 break;
@@ -1003,7 +1028,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1003 if (vfd->vidioc_try_fmt_vid_cap) 1028 if (vfd->vidioc_try_fmt_vid_cap)
1004 ret = vfd->vidioc_try_fmt_vid_cap(file, fh, f); 1029 ret = vfd->vidioc_try_fmt_vid_cap(file, fh, f);
1005 if (!ret) 1030 if (!ret)
1006 v4l_print_pix_fmt(vfd,&f->fmt.pix); 1031 v4l_print_pix_fmt(vfd, &f->fmt.pix);
1007 break; 1032 break;
1008 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 1033 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
1009 if (vfd->vidioc_try_fmt_vid_overlay) 1034 if (vfd->vidioc_try_fmt_vid_overlay)
@@ -1013,6 +1038,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1013 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 1038 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
1014 if (vfd->vidioc_try_fmt_vid_out) 1039 if (vfd->vidioc_try_fmt_vid_out)
1015 ret = vfd->vidioc_try_fmt_vid_out(file, fh, f); 1040 ret = vfd->vidioc_try_fmt_vid_out(file, fh, f);
1041 if (!ret)
1042 v4l_print_pix_fmt(vfd, &f->fmt.pix);
1016 break; 1043 break;
1017 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: 1044 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
1018 if (vfd->vidioc_try_fmt_vid_out_overlay) 1045 if (vfd->vidioc_try_fmt_vid_out_overlay)
@@ -1123,29 +1150,29 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1123 } 1150 }
1124 case VIDIOC_G_FBUF: 1151 case VIDIOC_G_FBUF:
1125 { 1152 {
1126 struct v4l2_framebuffer *p=arg; 1153 struct v4l2_framebuffer *p = arg;
1154
1127 if (!vfd->vidioc_g_fbuf) 1155 if (!vfd->vidioc_g_fbuf)
1128 break; 1156 break;
1129 ret=vfd->vidioc_g_fbuf(file, fh, arg); 1157 ret = vfd->vidioc_g_fbuf(file, fh, arg);
1130 if (!ret) { 1158 if (!ret) {
1131 dbgarg (cmd, "capability=%d, flags=%d, base=0x%08lx\n", 1159 dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
1132 p->capability,p->flags, 1160 p->capability, p->flags,
1133 (unsigned long)p->base); 1161 (unsigned long)p->base);
1134 v4l_print_pix_fmt (vfd, &p->fmt); 1162 v4l_print_pix_fmt(vfd, &p->fmt);
1135 } 1163 }
1136 break; 1164 break;
1137 } 1165 }
1138 case VIDIOC_S_FBUF: 1166 case VIDIOC_S_FBUF:
1139 { 1167 {
1140 struct v4l2_framebuffer *p=arg; 1168 struct v4l2_framebuffer *p = arg;
1169
1141 if (!vfd->vidioc_s_fbuf) 1170 if (!vfd->vidioc_s_fbuf)
1142 break; 1171 break;
1143 1172 dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
1144 dbgarg (cmd, "capability=%d, flags=%d, base=0x%08lx\n", 1173 p->capability, p->flags, (unsigned long)p->base);
1145 p->capability,p->flags,(unsigned long)p->base); 1174 v4l_print_pix_fmt(vfd, &p->fmt);
1146 v4l_print_pix_fmt (vfd, &p->fmt); 1175 ret = vfd->vidioc_s_fbuf(file, fh, arg);
1147 ret=vfd->vidioc_s_fbuf(file, fh, arg);
1148
1149 break; 1176 break;
1150 } 1177 }
1151 case VIDIOC_STREAMON: 1178 case VIDIOC_STREAMON:
@@ -1197,7 +1224,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1197 v4l2_video_std_construct(p, curr_id, descr); 1224 v4l2_video_std_construct(p, curr_id, descr);
1198 p->index = index; 1225 p->index = index;
1199 1226
1200 dbgarg(cmd, "index=%d, id=%Ld, name=%s, fps=%d/%d, " 1227 dbgarg(cmd, "index=%d, id=0x%Lx, name=%s, fps=%d/%d, "
1201 "framelines=%d\n", p->index, 1228 "framelines=%d\n", p->index,
1202 (unsigned long long)p->id, p->name, 1229 (unsigned long long)p->id, p->name,
1203 p->frameperiod.numerator, 1230 p->frameperiod.numerator,
@@ -1219,14 +1246,14 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1219 *id = vfd->current_norm; 1246 *id = vfd->current_norm;
1220 1247
1221 if (!ret) 1248 if (!ret)
1222 dbgarg(cmd, "value=%08Lx\n", (long long unsigned)*id); 1249 dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id);
1223 break; 1250 break;
1224 } 1251 }
1225 case VIDIOC_S_STD: 1252 case VIDIOC_S_STD:
1226 { 1253 {
1227 v4l2_std_id *id = arg,norm; 1254 v4l2_std_id *id = arg,norm;
1228 1255
1229 dbgarg (cmd, "value=%08Lx\n", (long long unsigned) *id); 1256 dbgarg(cmd, "std=%08Lx\n", (long long unsigned)*id);
1230 1257
1231 norm = (*id) & vfd->tvnorms; 1258 norm = (*id) & vfd->tvnorms;
1232 if ( vfd->tvnorms && !norm) /* Check if std is supported */ 1259 if ( vfd->tvnorms && !norm) /* Check if std is supported */
@@ -1315,8 +1342,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1315 ret = vfd->vidioc_enum_output(file, fh, p); 1342 ret = vfd->vidioc_enum_output(file, fh, p);
1316 if (!ret) 1343 if (!ret)
1317 dbgarg(cmd, "index=%d, name=%s, type=%d, " 1344 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1318 "audioset=%d, " 1345 "audioset=0x%x, "
1319 "modulator=%d, std=%08Lx\n", 1346 "modulator=%d, std=0x%08Lx\n",
1320 p->index, p->name, p->type, p->audioset, 1347 p->index, p->name, p->type, p->audioset,
1321 p->modulator, (unsigned long long)p->std); 1348 p->modulator, (unsigned long long)p->std);
1322 break; 1349 break;
@@ -1346,19 +1373,19 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1346 /* --- controls ---------------------------------------------- */ 1373 /* --- controls ---------------------------------------------- */
1347 case VIDIOC_QUERYCTRL: 1374 case VIDIOC_QUERYCTRL:
1348 { 1375 {
1349 struct v4l2_queryctrl *p=arg; 1376 struct v4l2_queryctrl *p = arg;
1350 1377
1351 if (!vfd->vidioc_queryctrl) 1378 if (!vfd->vidioc_queryctrl)
1352 break; 1379 break;
1353 ret=vfd->vidioc_queryctrl(file, fh, p); 1380 ret = vfd->vidioc_queryctrl(file, fh, p);
1354
1355 if (!ret) 1381 if (!ret)
1356 dbgarg (cmd, "id=%d, type=%d, name=%s, " 1382 dbgarg(cmd, "id=0x%x, type=%d, name=%s, min/max=%d/%d, "
1357 "min/max=%d/%d," 1383 "step=%d, default=%d, flags=0x%08x\n",
1358 " step=%d, default=%d, flags=0x%08x\n", 1384 p->id, p->type, p->name,
1359 p->id,p->type,p->name,p->minimum, 1385 p->minimum, p->maximum,
1360 p->maximum,p->step,p->default_value, 1386 p->step, p->default_value, p->flags);
1361 p->flags); 1387 else
1388 dbgarg(cmd, "id=0x%x\n", p->id);
1362 break; 1389 break;
1363 } 1390 }
1364 case VIDIOC_G_CTRL: 1391 case VIDIOC_G_CTRL:
@@ -1367,11 +1394,12 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1367 1394
1368 if (!vfd->vidioc_g_ctrl) 1395 if (!vfd->vidioc_g_ctrl)
1369 break; 1396 break;
1370 dbgarg(cmd, "Enum for index=%d\n", p->id);
1371 1397
1372 ret=vfd->vidioc_g_ctrl(file, fh, p); 1398 ret = vfd->vidioc_g_ctrl(file, fh, p);
1373 if (!ret) 1399 if (!ret)
1374 dbgarg2 ( "id=%d, value=%d\n", p->id, p->value); 1400 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
1401 else
1402 dbgarg(cmd, "id=0x%x\n", p->id);
1375 break; 1403 break;
1376 } 1404 }
1377 case VIDIOC_S_CTRL: 1405 case VIDIOC_S_CTRL:
@@ -1380,20 +1408,19 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1380 1408
1381 if (!vfd->vidioc_s_ctrl) 1409 if (!vfd->vidioc_s_ctrl)
1382 break; 1410 break;
1383 dbgarg (cmd, "id=%d, value=%d\n", p->id, p->value); 1411 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
1384 1412
1385 ret=vfd->vidioc_s_ctrl(file, fh, p); 1413 ret = vfd->vidioc_s_ctrl(file, fh, p);
1386 break; 1414 break;
1387 } 1415 }
1388 case VIDIOC_G_EXT_CTRLS: 1416 case VIDIOC_G_EXT_CTRLS:
1389 { 1417 {
1390 struct v4l2_ext_controls *p = arg; 1418 struct v4l2_ext_controls *p = arg;
1391 1419
1392 if (vfd->vidioc_g_ext_ctrls) { 1420 if (!vfd->vidioc_g_ext_ctrls)
1393 dbgarg(cmd, "count=%d\n", p->count); 1421 break;
1394 1422 ret = vfd->vidioc_g_ext_ctrls(file, fh, p);
1395 ret=vfd->vidioc_g_ext_ctrls(file, fh, p); 1423 v4l_print_ext_ctrls(cmd, vfd, p, !ret);
1396 }
1397 break; 1424 break;
1398 } 1425 }
1399 case VIDIOC_S_EXT_CTRLS: 1426 case VIDIOC_S_EXT_CTRLS:
@@ -1401,9 +1428,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1401 struct v4l2_ext_controls *p = arg; 1428 struct v4l2_ext_controls *p = arg;
1402 1429
1403 if (vfd->vidioc_s_ext_ctrls) { 1430 if (vfd->vidioc_s_ext_ctrls) {
1404 dbgarg(cmd, "count=%d\n", p->count); 1431 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1405 1432
1406 ret=vfd->vidioc_s_ext_ctrls(file, fh, p); 1433 ret = vfd->vidioc_s_ext_ctrls(file, fh, p);
1407 } 1434 }
1408 break; 1435 break;
1409 } 1436 }
@@ -1412,66 +1439,72 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1412 struct v4l2_ext_controls *p = arg; 1439 struct v4l2_ext_controls *p = arg;
1413 1440
1414 if (vfd->vidioc_try_ext_ctrls) { 1441 if (vfd->vidioc_try_ext_ctrls) {
1415 dbgarg(cmd, "count=%d\n", p->count); 1442 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1416 1443
1417 ret=vfd->vidioc_try_ext_ctrls(file, fh, p); 1444 ret = vfd->vidioc_try_ext_ctrls(file, fh, p);
1418 } 1445 }
1419 break; 1446 break;
1420 } 1447 }
1421 case VIDIOC_QUERYMENU: 1448 case VIDIOC_QUERYMENU:
1422 { 1449 {
1423 struct v4l2_querymenu *p=arg; 1450 struct v4l2_querymenu *p = arg;
1451
1424 if (!vfd->vidioc_querymenu) 1452 if (!vfd->vidioc_querymenu)
1425 break; 1453 break;
1426 ret=vfd->vidioc_querymenu(file, fh, p); 1454 ret = vfd->vidioc_querymenu(file, fh, p);
1427 if (!ret) 1455 if (!ret)
1428 dbgarg (cmd, "id=%d, index=%d, name=%s\n", 1456 dbgarg(cmd, "id=0x%x, index=%d, name=%s\n",
1429 p->id,p->index,p->name); 1457 p->id, p->index, p->name);
1458 else
1459 dbgarg(cmd, "id=0x%x, index=%d\n",
1460 p->id, p->index);
1430 break; 1461 break;
1431 } 1462 }
1432 /* --- audio ---------------------------------------------- */ 1463 /* --- audio ---------------------------------------------- */
1433 case VIDIOC_ENUMAUDIO: 1464 case VIDIOC_ENUMAUDIO:
1434 { 1465 {
1435 struct v4l2_audio *p=arg; 1466 struct v4l2_audio *p = arg;
1436 1467
1437 if (!vfd->vidioc_enumaudio) 1468 if (!vfd->vidioc_enumaudio)
1438 break; 1469 break;
1439 dbgarg(cmd, "Enum for index=%d\n", p->index); 1470 ret = vfd->vidioc_enumaudio(file, fh, p);
1440 ret=vfd->vidioc_enumaudio(file, fh, p);
1441 if (!ret) 1471 if (!ret)
1442 dbgarg2("index=%d, name=%s, capability=%d, " 1472 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1443 "mode=%d\n",p->index,p->name, 1473 "mode=0x%x\n", p->index, p->name,
1444 p->capability, p->mode); 1474 p->capability, p->mode);
1475 else
1476 dbgarg(cmd, "index=%d\n", p->index);
1445 break; 1477 break;
1446 } 1478 }
1447 case VIDIOC_G_AUDIO: 1479 case VIDIOC_G_AUDIO:
1448 { 1480 {
1449 struct v4l2_audio *p=arg; 1481 struct v4l2_audio *p = arg;
1450 __u32 index=p->index; 1482 __u32 index = p->index;
1451 1483
1452 if (!vfd->vidioc_g_audio) 1484 if (!vfd->vidioc_g_audio)
1453 break; 1485 break;
1454 1486
1455 memset(p,0,sizeof(*p)); 1487 memset(p, 0, sizeof(*p));
1456 p->index=index; 1488 p->index = index;
1457 dbgarg(cmd, "Get for index=%d\n", p->index); 1489 ret = vfd->vidioc_g_audio(file, fh, p);
1458 ret=vfd->vidioc_g_audio(file, fh, p);
1459 if (!ret) 1490 if (!ret)
1460 dbgarg2("index=%d, name=%s, capability=%d, " 1491 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1461 "mode=%d\n",p->index, 1492 "mode=0x%x\n", p->index,
1462 p->name,p->capability, p->mode); 1493 p->name, p->capability, p->mode);
1494 else
1495 dbgarg(cmd, "index=%d\n", p->index);
1463 break; 1496 break;
1464 } 1497 }
1465 case VIDIOC_S_AUDIO: 1498 case VIDIOC_S_AUDIO:
1466 { 1499 {
1467 struct v4l2_audio *p=arg; 1500 struct v4l2_audio *p = arg;
1468 1501
1469 if (!vfd->vidioc_s_audio) 1502 if (!vfd->vidioc_s_audio)
1470 break; 1503 break;
1471 dbgarg(cmd, "index=%d, name=%s, capability=%d, " 1504 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1472 "mode=%d\n", p->index, p->name, 1505 "mode=0x%x\n", p->index, p->name,
1473 p->capability, p->mode); 1506 p->capability, p->mode);
1474 ret=vfd->vidioc_s_audio(file, fh, p); 1507 ret = vfd->vidioc_s_audio(file, fh, p);
1475 break; 1508 break;
1476 } 1509 }
1477 case VIDIOC_ENUMAUDOUT: 1510 case VIDIOC_ENUMAUDOUT:
@@ -1547,9 +1580,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1547 struct v4l2_crop *p=arg; 1580 struct v4l2_crop *p=arg;
1548 if (!vfd->vidioc_g_crop) 1581 if (!vfd->vidioc_g_crop)
1549 break; 1582 break;
1583 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1550 ret=vfd->vidioc_g_crop(file, fh, p); 1584 ret=vfd->vidioc_g_crop(file, fh, p);
1551 if (!ret) { 1585 if (!ret) {
1552 dbgarg(cmd, "type=%d\n", p->type);
1553 dbgrect(vfd, "", &p->c); 1586 dbgrect(vfd, "", &p->c);
1554 } 1587 }
1555 break; 1588 break;
@@ -1559,21 +1592,24 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1559 struct v4l2_crop *p=arg; 1592 struct v4l2_crop *p=arg;
1560 if (!vfd->vidioc_s_crop) 1593 if (!vfd->vidioc_s_crop)
1561 break; 1594 break;
1562 dbgarg(cmd, "type=%d\n", p->type); 1595 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1563 dbgrect(vfd, "", &p->c); 1596 dbgrect(vfd, "", &p->c);
1564 ret=vfd->vidioc_s_crop(file, fh, p); 1597 ret=vfd->vidioc_s_crop(file, fh, p);
1565 break; 1598 break;
1566 } 1599 }
1567 case VIDIOC_CROPCAP: 1600 case VIDIOC_CROPCAP:
1568 { 1601 {
1569 struct v4l2_cropcap *p=arg; 1602 struct v4l2_cropcap *p = arg;
1603
1570 /*FIXME: Should also show v4l2_fract pixelaspect */ 1604 /*FIXME: Should also show v4l2_fract pixelaspect */
1571 if (!vfd->vidioc_cropcap) 1605 if (!vfd->vidioc_cropcap)
1572 break; 1606 break;
1573 dbgarg(cmd, "type=%d\n", p->type); 1607 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1574 dbgrect(vfd, "bounds ", &p->bounds); 1608 ret = vfd->vidioc_cropcap(file, fh, p);
1575 dbgrect(vfd, "defrect ", &p->defrect); 1609 if (!ret) {
1576 ret=vfd->vidioc_cropcap(file, fh, p); 1610 dbgrect(vfd, "bounds ", &p->bounds);
1611 dbgrect(vfd, "defrect ", &p->defrect);
1612 }
1577 break; 1613 break;
1578 } 1614 }
1579 case VIDIOC_G_JPEGCOMP: 1615 case VIDIOC_G_JPEGCOMP:
@@ -1675,40 +1711,42 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1675 } 1711 }
1676 case VIDIOC_G_TUNER: 1712 case VIDIOC_G_TUNER:
1677 { 1713 {
1678 struct v4l2_tuner *p=arg; 1714 struct v4l2_tuner *p = arg;
1679 __u32 index=p->index; 1715 __u32 index = p->index;
1680 1716
1681 if (!vfd->vidioc_g_tuner) 1717 if (!vfd->vidioc_g_tuner)
1682 break; 1718 break;
1683 1719
1684 memset(p,0,sizeof(*p)); 1720 memset(p, 0, sizeof(*p));
1685 p->index=index; 1721 p->index = index;
1686 1722
1687 ret=vfd->vidioc_g_tuner(file, fh, p); 1723 ret = vfd->vidioc_g_tuner(file, fh, p);
1688 if (!ret) 1724 if (!ret)
1689 dbgarg (cmd, "index=%d, name=%s, type=%d, " 1725 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1690 "capability=%d, rangelow=%d, " 1726 "capability=0x%x, rangelow=%d, "
1691 "rangehigh=%d, signal=%d, afc=%d, " 1727 "rangehigh=%d, signal=%d, afc=%d, "
1692 "rxsubchans=%d, audmode=%d\n", 1728 "rxsubchans=0x%x, audmode=%d\n",
1693 p->index, p->name, p->type, 1729 p->index, p->name, p->type,
1694 p->capability, p->rangelow, 1730 p->capability, p->rangelow,
1695 p->rangehigh, p->rxsubchans, 1731 p->rangehigh, p->signal, p->afc,
1696 p->audmode, p->signal, p->afc); 1732 p->rxsubchans, p->audmode);
1697 break; 1733 break;
1698 } 1734 }
1699 case VIDIOC_S_TUNER: 1735 case VIDIOC_S_TUNER:
1700 { 1736 {
1701 struct v4l2_tuner *p=arg; 1737 struct v4l2_tuner *p = arg;
1738
1702 if (!vfd->vidioc_s_tuner) 1739 if (!vfd->vidioc_s_tuner)
1703 break; 1740 break;
1704 dbgarg (cmd, "index=%d, name=%s, type=%d, " 1741 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1705 "capability=%d, rangelow=%d, rangehigh=%d, " 1742 "capability=0x%x, rangelow=%d, "
1706 "signal=%d, afc=%d, rxsubchans=%d, " 1743 "rangehigh=%d, signal=%d, afc=%d, "
1707 "audmode=%d\n",p->index, p->name, p->type, 1744 "rxsubchans=0x%x, audmode=%d\n",
1708 p->capability, p->rangelow,p->rangehigh, 1745 p->index, p->name, p->type,
1709 p->rxsubchans, p->audmode, p->signal, 1746 p->capability, p->rangelow,
1710 p->afc); 1747 p->rangehigh, p->signal, p->afc,
1711 ret=vfd->vidioc_s_tuner(file, fh, p); 1748 p->rxsubchans, p->audmode);
1749 ret = vfd->vidioc_s_tuner(file, fh, p);
1712 break; 1750 break;
1713 } 1751 }
1714 case VIDIOC_G_FREQUENCY: 1752 case VIDIOC_G_FREQUENCY:
@@ -1745,10 +1783,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1745 break; 1783 break;
1746 memset(p, 0, sizeof(*p)); 1784 memset(p, 0, sizeof(*p));
1747 p->type = type; 1785 p->type = type;
1786 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1748 ret = vfd->vidioc_g_sliced_vbi_cap(file, fh, p); 1787 ret = vfd->vidioc_g_sliced_vbi_cap(file, fh, p);
1749 if (!ret) 1788 if (!ret)
1750 dbgarg(cmd, "type=%d, service_set=%d\n", 1789 dbgarg2("service_set=%d\n", p->service_set);
1751 p->type, p->service_set);
1752 break; 1790 break;
1753 } 1791 }
1754 case VIDIOC_LOG_STATUS: 1792 case VIDIOC_LOG_STATUS:
@@ -1809,10 +1847,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1809 } /* switch */ 1847 } /* switch */
1810 1848
1811 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { 1849 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {
1812 if (ret<0) { 1850 if (ret < 0) {
1813 printk("%s: err: on ", vfd->name);
1814 v4l_print_ioctl(vfd->name, cmd); 1851 v4l_print_ioctl(vfd->name, cmd);
1815 printk("\n"); 1852 printk(KERN_CONT " error %d\n", ret);
1816 } 1853 }
1817 } 1854 }
1818 1855
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 9e6e4f18e948..3c934142f7f9 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -59,8 +59,8 @@ enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
59int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local); 59int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
60 60
61/* names for fancy debug output */ 61/* names for fancy debug output */
62extern char *v4l2_field_names[]; 62extern const char *v4l2_field_names[];
63extern char *v4l2_type_names[]; 63extern const char *v4l2_type_names[];
64 64
65/* Compatibility layer interface -- v4l1-compat module */ 65/* Compatibility layer interface -- v4l1-compat module */
66typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, 66typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,