The patch number 8103 was added via Hans Verkuil <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Hans Verkuil  <[EMAIL PROTECTED]>
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 <[EMAIL PROTECTED]>


---

 linux/drivers/media/video/videodev.c |  299 +++++++++++++++------------
 linux/include/media/v4l2-dev.h       |    4 
 2 files changed, 170 insertions(+), 133 deletions(-)

diff -r 0678ea1fc699 -r da6ab7fadef9 linux/drivers/media/video/videodev.c
--- a/linux/drivers/media/video/videodev.c      Sun Jun 22 13:45:12 2008 +0200
+++ b/linux/drivers/media/video/videodev.c      Sun Jun 22 13:55:09 2008 +0200
@@ -17,15 +17,19 @@
  */
 
 #define dbgarg(cmd, fmt, arg...) \
-               if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {                \
+               do {                                                    \
+                   if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {            \
                        printk(KERN_DEBUG "%s: ",  vfd->name);          \
                        v4l_printk_ioctl(cmd);                          \
                        printk(" " fmt,  ## arg);                       \
-               }
+                   }                                                   \
+               } while (0)
 
 #define dbgarg2(fmt, arg...) \
-               if (vfd->debug & V4L2_DEBUG_IOCTL_ARG)                  \
-                       printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);
+               do {                                                    \
+                   if (vfd->debug & V4L2_DEBUG_IOCTL_ARG)              \
+                       printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);\
+               } while (0)
 
 #include <linux/module.h>
 #include <linux/types.h>
@@ -141,7 +145,7 @@ EXPORT_SYMBOL(v4l2_video_std_construct);
 /* ----------------------------------------------------------------- */
 /* some arrays for pretty-printing debug messages of enum types      */
 
-char *v4l2_field_names[] = {
+const char *v4l2_field_names[] = {
        [V4L2_FIELD_ANY]        = "any",
        [V4L2_FIELD_NONE]       = "none",
        [V4L2_FIELD_TOP]        = "top",
@@ -155,19 +159,19 @@ char *v4l2_field_names[] = {
 };
 EXPORT_SYMBOL(v4l2_field_names);
 
-char *v4l2_type_names[] = {
-       [V4L2_BUF_TYPE_VIDEO_CAPTURE]      = "video-cap",
-       [V4L2_BUF_TYPE_VIDEO_OVERLAY]      = "video-over",
-       [V4L2_BUF_TYPE_VIDEO_OUTPUT]       = "video-out",
+const char *v4l2_type_names[] = {
+       [V4L2_BUF_TYPE_VIDEO_CAPTURE]      = "vid-cap",
+       [V4L2_BUF_TYPE_VIDEO_OVERLAY]      = "vid-overlay",
+       [V4L2_BUF_TYPE_VIDEO_OUTPUT]       = "vid-out",
        [V4L2_BUF_TYPE_VBI_CAPTURE]        = "vbi-cap",
        [V4L2_BUF_TYPE_VBI_OUTPUT]         = "vbi-out",
        [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
        [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT]  = "sliced-vbi-out",
-       [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
+       [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "vid-out-overlay",
 };
 EXPORT_SYMBOL(v4l2_type_names);
 
-static char *v4l2_memory_names[] = {
+static const char *v4l2_memory_names[] = {
        [V4L2_MEMORY_MMAP]    = "mmap",
        [V4L2_MEMORY_USERPTR] = "userptr",
        [V4L2_MEMORY_OVERLAY] = "overlay",
@@ -698,7 +702,7 @@ static void dbgbuf(unsigned int cmd, str
                        p->field, p->sequence,
                        prt_names(p->memory, v4l2_memory_names),
                        p->m.userptr, p->length);
-       dbgarg2 ("timecode= %02d:%02d:%02d type=%d, "
+       dbgarg2("timecode=%02d:%02d:%02d type=%d, "
                "flags=0x%08d, frames=%d, userbits=0x%08x\n",
                        tc->hours,tc->minutes,tc->seconds,
                        tc->type, tc->flags, tc->frames, *(__u32 *) 
tc->userbits);
@@ -707,7 +711,7 @@ static inline void dbgrect(struct video_
 static inline void dbgrect(struct video_device *vfd, char *s,
                                                        struct v4l2_rect *r)
 {
-       dbgarg2 ("%sRect start at %dx%d, size= %dx%d\n", s, r->left, r->top,
+       dbgarg2("%sRect start at %dx%d, size=%dx%d\n", s, r->left, r->top,
                                                r->width, r->height);
 };
 
@@ -725,6 +729,25 @@ static inline void v4l_print_pix_fmt (st
                fmt->bytesperline, fmt->sizeimage, fmt->colorspace);
 };
 
+static inline void v4l_print_ext_ctrls(unsigned int cmd,
+       struct video_device *vfd, struct v4l2_ext_controls *c, int show_vals)
+{
+       __u32 i;
+
+       if (!(vfd->debug & V4L2_DEBUG_IOCTL_ARG))
+               return;
+       dbgarg(cmd, "");
+       printk(KERN_CONT "class=0x%x", c->ctrl_class);
+       for (i = 0; i < c->count; i++) {
+               if (show_vals)
+                       printk(KERN_CONT " id/val=0x%x/0x%x",
+                               c->controls[i].id, c->controls[i].value);
+               else
+                       printk(KERN_CONT " id=0x%x", c->controls[i].id);
+       }
+       printk(KERN_CONT "\n");
+};
+
 
 static int check_fmt (struct video_device *vfd, enum v4l2_buf_type type)
 {
@@ -932,7 +955,7 @@ static int __video_do_ioctl(struct inode
                        if (vfd->vidioc_g_fmt_vid_cap)
                                ret = vfd->vidioc_g_fmt_vid_cap(file, fh, f);
                        if (!ret)
-                               v4l_print_pix_fmt(vfd,&f->fmt.pix);
+                               v4l_print_pix_fmt(vfd, &f->fmt.pix);
                        break;
                case V4L2_BUF_TYPE_VIDEO_OVERLAY:
                        if (vfd->vidioc_g_fmt_vid_overlay)
@@ -942,6 +965,8 @@ static int __video_do_ioctl(struct inode
                case V4L2_BUF_TYPE_VIDEO_OUTPUT:
                        if (vfd->vidioc_g_fmt_vid_out)
                                ret = vfd->vidioc_g_fmt_vid_out(file, fh, f);
+                       if (!ret)
+                               v4l_print_pix_fmt(vfd, &f->fmt.pix);
                        break;
                case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
                        if (vfd->vidioc_g_fmt_vid_out_overlay)
@@ -980,12 +1005,11 @@ static int __video_do_ioctl(struct inode
                struct v4l2_format *f = (struct v4l2_format *)arg;
 
                /* FIXME: Should be one dump per type */
-               dbgarg (cmd, "type=%s\n", prt_names(f->type,
-                                       v4l2_type_names));
+               dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
 
                switch (f->type) {
                case V4L2_BUF_TYPE_VIDEO_CAPTURE:
-                       v4l_print_pix_fmt(vfd,&f->fmt.pix);
+                       v4l_print_pix_fmt(vfd, &f->fmt.pix);
                        if (vfd->vidioc_s_fmt_vid_cap)
                                ret = vfd->vidioc_s_fmt_vid_cap(file, fh, f);
                        break;
@@ -995,6 +1019,7 @@ static int __video_do_ioctl(struct inode
                                                                    fh, f);
                        break;
                case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+                       v4l_print_pix_fmt(vfd, &f->fmt.pix);
                        if (vfd->vidioc_s_fmt_vid_out)
                                ret = vfd->vidioc_s_fmt_vid_out(file, fh, f);
                        break;
@@ -1041,7 +1066,7 @@ static int __video_do_ioctl(struct inode
                        if (vfd->vidioc_try_fmt_vid_cap)
                                ret = vfd->vidioc_try_fmt_vid_cap(file, fh, f);
                        if (!ret)
-                               v4l_print_pix_fmt(vfd,&f->fmt.pix);
+                               v4l_print_pix_fmt(vfd, &f->fmt.pix);
                        break;
                case V4L2_BUF_TYPE_VIDEO_OVERLAY:
                        if (vfd->vidioc_try_fmt_vid_overlay)
@@ -1051,6 +1076,8 @@ static int __video_do_ioctl(struct inode
                case V4L2_BUF_TYPE_VIDEO_OUTPUT:
                        if (vfd->vidioc_try_fmt_vid_out)
                                ret = vfd->vidioc_try_fmt_vid_out(file, fh, f);
+                       if (!ret)
+                               v4l_print_pix_fmt(vfd, &f->fmt.pix);
                        break;
                case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
                        if (vfd->vidioc_try_fmt_vid_out_overlay)
@@ -1161,29 +1188,29 @@ static int __video_do_ioctl(struct inode
        }
        case VIDIOC_G_FBUF:
        {
-               struct v4l2_framebuffer *p=arg;
+               struct v4l2_framebuffer *p = arg;
+
                if (!vfd->vidioc_g_fbuf)
                        break;
-               ret=vfd->vidioc_g_fbuf(file, fh, arg);
+               ret = vfd->vidioc_g_fbuf(file, fh, arg);
                if (!ret) {
-                       dbgarg (cmd, "capability=%d, flags=%d, base=0x%08lx\n",
-                                       p->capability,p->flags,
+                       dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
+                                       p->capability, p->flags,
                                        (unsigned long)p->base);
-                       v4l_print_pix_fmt (vfd, &p->fmt);
+                       v4l_print_pix_fmt(vfd, &p->fmt);
                }
                break;
        }
        case VIDIOC_S_FBUF:
        {
-               struct v4l2_framebuffer *p=arg;
+               struct v4l2_framebuffer *p = arg;
+
                if (!vfd->vidioc_s_fbuf)
                        break;
-
-               dbgarg (cmd, "capability=%d, flags=%d, base=0x%08lx\n",
-                               p->capability,p->flags,(unsigned long)p->base);
-               v4l_print_pix_fmt (vfd, &p->fmt);
-               ret=vfd->vidioc_s_fbuf(file, fh, arg);
-
+               dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
+                       p->capability, p->flags, (unsigned long)p->base);
+               v4l_print_pix_fmt(vfd, &p->fmt);
+               ret = vfd->vidioc_s_fbuf(file, fh, arg);
                break;
        }
        case VIDIOC_STREAMON:
@@ -1235,7 +1262,7 @@ static int __video_do_ioctl(struct inode
                v4l2_video_std_construct(p, curr_id, descr);
                p->index = index;
 
-               dbgarg(cmd, "index=%d, id=%Ld, name=%s, fps=%d/%d, "
+               dbgarg(cmd, "index=%d, id=0x%Lx, name=%s, fps=%d/%d, "
                                "framelines=%d\n", p->index,
                                (unsigned long long)p->id, p->name,
                                p->frameperiod.numerator,
@@ -1257,14 +1284,14 @@ static int __video_do_ioctl(struct inode
                        *id = vfd->current_norm;
 
                if (!ret)
-                       dbgarg(cmd, "value=%08Lx\n", (long long unsigned)*id);
+                       dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id);
                break;
        }
        case VIDIOC_S_STD:
        {
                v4l2_std_id *id = arg,norm;
 
-               dbgarg (cmd, "value=%08Lx\n", (long long unsigned) *id);
+               dbgarg(cmd, "std=%08Lx\n", (long long unsigned)*id);
 
                norm = (*id) & vfd->tvnorms;
                if ( vfd->tvnorms && !norm)     /* Check if std is supported */
@@ -1353,8 +1380,8 @@ static int __video_do_ioctl(struct inode
                ret = vfd->vidioc_enum_output(file, fh, p);
                if (!ret)
                        dbgarg(cmd, "index=%d, name=%s, type=%d, "
-                               "audioset=%d, "
-                               "modulator=%d, std=%08Lx\n",
+                               "audioset=0x%x, "
+                               "modulator=%d, std=0x%08Lx\n",
                                p->index, p->name, p->type, p->audioset,
                                p->modulator, (unsigned long long)p->std);
                break;
@@ -1384,19 +1411,19 @@ static int __video_do_ioctl(struct inode
        /* --- controls ---------------------------------------------- */
        case VIDIOC_QUERYCTRL:
        {
-               struct v4l2_queryctrl *p=arg;
+               struct v4l2_queryctrl *p = arg;
 
                if (!vfd->vidioc_queryctrl)
                        break;
-               ret=vfd->vidioc_queryctrl(file, fh, p);
-
-               if (!ret)
-                       dbgarg (cmd, "id=%d, type=%d, name=%s, "
-                                       "min/max=%d/%d,"
-                                       " step=%d, default=%d, flags=0x%08x\n",
-                                       p->id,p->type,p->name,p->minimum,
-                                       p->maximum,p->step,p->default_value,
-                                       p->flags);
+               ret = vfd->vidioc_queryctrl(file, fh, p);
+               if (!ret)
+                       dbgarg(cmd, "id=0x%x, type=%d, name=%s, min/max=%d/%d, "
+                                       "step=%d, default=%d, flags=0x%08x\n",
+                                       p->id, p->type, p->name,
+                                       p->minimum, p->maximum,
+                                       p->step, p->default_value, p->flags);
+               else
+                       dbgarg(cmd, "id=0x%x\n", p->id);
                break;
        }
        case VIDIOC_G_CTRL:
@@ -1405,11 +1432,12 @@ static int __video_do_ioctl(struct inode
 
                if (!vfd->vidioc_g_ctrl)
                        break;
-               dbgarg(cmd, "Enum for index=%d\n", p->id);
-
-               ret=vfd->vidioc_g_ctrl(file, fh, p);
-               if (!ret)
-                       dbgarg2 ( "id=%d, value=%d\n", p->id, p->value);
+
+               ret = vfd->vidioc_g_ctrl(file, fh, p);
+               if (!ret)
+                       dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
+               else
+                       dbgarg(cmd, "id=0x%x\n", p->id);
                break;
        }
        case VIDIOC_S_CTRL:
@@ -1418,98 +1446,103 @@ static int __video_do_ioctl(struct inode
 
                if (!vfd->vidioc_s_ctrl)
                        break;
-               dbgarg (cmd, "id=%d, value=%d\n", p->id, p->value);
-
-               ret=vfd->vidioc_s_ctrl(file, fh, p);
+               dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
+
+               ret = vfd->vidioc_s_ctrl(file, fh, p);
                break;
        }
        case VIDIOC_G_EXT_CTRLS:
        {
                struct v4l2_ext_controls *p = arg;
 
-               if (vfd->vidioc_g_ext_ctrls) {
-                       dbgarg(cmd, "count=%d\n", p->count);
-
-                       ret=vfd->vidioc_g_ext_ctrls(file, fh, p);
+               if (!vfd->vidioc_g_ext_ctrls)
+                       break;
+               ret = vfd->vidioc_g_ext_ctrls(file, fh, p);
+               v4l_print_ext_ctrls(cmd, vfd, p, !ret);
+               break;
+       }
+       case VIDIOC_S_EXT_CTRLS:
+       {
+               struct v4l2_ext_controls *p = arg;
+
+               if (vfd->vidioc_s_ext_ctrls) {
+                       v4l_print_ext_ctrls(cmd, vfd, p, 1);
+
+                       ret = vfd->vidioc_s_ext_ctrls(file, fh, p);
                }
                break;
        }
-       case VIDIOC_S_EXT_CTRLS:
+       case VIDIOC_TRY_EXT_CTRLS:
        {
                struct v4l2_ext_controls *p = arg;
 
-               if (vfd->vidioc_s_ext_ctrls) {
-                       dbgarg(cmd, "count=%d\n", p->count);
-
-                       ret=vfd->vidioc_s_ext_ctrls(file, fh, p);
+               if (vfd->vidioc_try_ext_ctrls) {
+                       v4l_print_ext_ctrls(cmd, vfd, p, 1);
+
+                       ret = vfd->vidioc_try_ext_ctrls(file, fh, p);
                }
                break;
        }
-       case VIDIOC_TRY_EXT_CTRLS:
-       {
-               struct v4l2_ext_controls *p = arg;
-
-               if (vfd->vidioc_try_ext_ctrls) {
-                       dbgarg(cmd, "count=%d\n", p->count);
-
-                       ret=vfd->vidioc_try_ext_ctrls(file, fh, p);
-               }
-               break;
-       }
        case VIDIOC_QUERYMENU:
        {
-               struct v4l2_querymenu *p=arg;
+               struct v4l2_querymenu *p = arg;
+
                if (!vfd->vidioc_querymenu)
                        break;
-               ret=vfd->vidioc_querymenu(file, fh, p);
-               if (!ret)
-                       dbgarg (cmd, "id=%d, index=%d, name=%s\n",
-                                               p->id,p->index,p->name);
+               ret = vfd->vidioc_querymenu(file, fh, p);
+               if (!ret)
+                       dbgarg(cmd, "id=0x%x, index=%d, name=%s\n",
+                               p->id, p->index, p->name);
+               else
+                       dbgarg(cmd, "id=0x%x, index=%d\n",
+                               p->id, p->index);
                break;
        }
        /* --- audio ---------------------------------------------- */
        case VIDIOC_ENUMAUDIO:
        {
-               struct v4l2_audio *p=arg;
+               struct v4l2_audio *p = arg;
 
                if (!vfd->vidioc_enumaudio)
                        break;
-               dbgarg(cmd, "Enum for index=%d\n", p->index);
-               ret=vfd->vidioc_enumaudio(file, fh, p);
-               if (!ret)
-                       dbgarg2("index=%d, name=%s, capability=%d, "
-                                       "mode=%d\n",p->index,p->name,
+               ret = vfd->vidioc_enumaudio(file, fh, p);
+               if (!ret)
+                       dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
+                                       "mode=0x%x\n", p->index, p->name,
                                        p->capability, p->mode);
+               else
+                       dbgarg(cmd, "index=%d\n", p->index);
                break;
        }
        case VIDIOC_G_AUDIO:
        {
-               struct v4l2_audio *p=arg;
-               __u32 index=p->index;
+               struct v4l2_audio *p = arg;
+               __u32 index = p->index;
 
                if (!vfd->vidioc_g_audio)
                        break;
 
-               memset(p,0,sizeof(*p));
-               p->index=index;
-               dbgarg(cmd, "Get for index=%d\n", p->index);
-               ret=vfd->vidioc_g_audio(file, fh, p);
-               if (!ret)
-                       dbgarg2("index=%d, name=%s, capability=%d, "
-                                       "mode=%d\n",p->index,
-                                       p->name,p->capability, p->mode);
+               memset(p, 0, sizeof(*p));
+               p->index = index;
+               ret = vfd->vidioc_g_audio(file, fh, p);
+               if (!ret)
+                       dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
+                                       "mode=0x%x\n", p->index,
+                                       p->name, p->capability, p->mode);
+               else
+                       dbgarg(cmd, "index=%d\n", p->index);
                break;
        }
        case VIDIOC_S_AUDIO:
        {
-               struct v4l2_audio *p=arg;
+               struct v4l2_audio *p = arg;
 
                if (!vfd->vidioc_s_audio)
                        break;
-               dbgarg(cmd, "index=%d, name=%s, capability=%d, "
-                                       "mode=%d\n", p->index, p->name,
+               dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
+                                       "mode=0x%x\n", p->index, p->name,
                                        p->capability, p->mode);
-               ret=vfd->vidioc_s_audio(file, fh, p);
+               ret = vfd->vidioc_s_audio(file, fh, p);
                break;
        }
        case VIDIOC_ENUMAUDOUT:
@@ -1585,9 +1618,9 @@ static int __video_do_ioctl(struct inode
                struct v4l2_crop *p=arg;
                if (!vfd->vidioc_g_crop)
                        break;
+               dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
                ret=vfd->vidioc_g_crop(file, fh, p);
                if (!ret) {
-                       dbgarg(cmd, "type=%d\n", p->type);
                        dbgrect(vfd, "", &p->c);
                }
                break;
@@ -1597,21 +1630,24 @@ static int __video_do_ioctl(struct inode
                struct v4l2_crop *p=arg;
                if (!vfd->vidioc_s_crop)
                        break;
-               dbgarg(cmd, "type=%d\n", p->type);
+               dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
                dbgrect(vfd, "", &p->c);
                ret=vfd->vidioc_s_crop(file, fh, p);
                break;
        }
        case VIDIOC_CROPCAP:
        {
-               struct v4l2_cropcap *p=arg;
+               struct v4l2_cropcap *p = arg;
+
                /*FIXME: Should also show v4l2_fract pixelaspect */
                if (!vfd->vidioc_cropcap)
                        break;
-               dbgarg(cmd, "type=%d\n", p->type);
-               dbgrect(vfd, "bounds ", &p->bounds);
-               dbgrect(vfd, "defrect ", &p->defrect);
-               ret=vfd->vidioc_cropcap(file, fh, p);
+               dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
+               ret = vfd->vidioc_cropcap(file, fh, p);
+               if (!ret) {
+                       dbgrect(vfd, "bounds ", &p->bounds);
+                       dbgrect(vfd, "defrect ", &p->defrect);
+               }
                break;
        }
        case VIDIOC_G_JPEGCOMP:
@@ -1713,40 +1749,42 @@ static int __video_do_ioctl(struct inode
        }
        case VIDIOC_G_TUNER:
        {
-               struct v4l2_tuner *p=arg;
-               __u32 index=p->index;
+               struct v4l2_tuner *p = arg;
+               __u32 index = p->index;
 
                if (!vfd->vidioc_g_tuner)
                        break;
 
-               memset(p,0,sizeof(*p));
-               p->index=index;
-
-               ret=vfd->vidioc_g_tuner(file, fh, p);
-               if (!ret)
-                       dbgarg (cmd, "index=%d, name=%s, type=%d, "
-                                       "capability=%d, rangelow=%d, "
+               memset(p, 0, sizeof(*p));
+               p->index = index;
+
+               ret = vfd->vidioc_g_tuner(file, fh, p);
+               if (!ret)
+                       dbgarg(cmd, "index=%d, name=%s, type=%d, "
+                                       "capability=0x%x, rangelow=%d, "
                                        "rangehigh=%d, signal=%d, afc=%d, "
-                                       "rxsubchans=%d, audmode=%d\n",
+                                       "rxsubchans=0x%x, audmode=%d\n",
                                        p->index, p->name, p->type,
                                        p->capability, p->rangelow,
-                                       p->rangehigh, p->rxsubchans,
-                                       p->audmode, p->signal, p->afc);
+                                       p->rangehigh, p->signal, p->afc,
+                                       p->rxsubchans, p->audmode);
                break;
        }
        case VIDIOC_S_TUNER:
        {
-               struct v4l2_tuner *p=arg;
+               struct v4l2_tuner *p = arg;
+
                if (!vfd->vidioc_s_tuner)
                        break;
-               dbgarg (cmd, "index=%d, name=%s, type=%d, "
-                               "capability=%d, rangelow=%d, rangehigh=%d, "
-                               "signal=%d, afc=%d, rxsubchans=%d, "
-                               "audmode=%d\n",p->index, p->name, p->type,
-                               p->capability, p->rangelow,p->rangehigh,
-                               p->rxsubchans, p->audmode, p->signal,
-                               p->afc);
-               ret=vfd->vidioc_s_tuner(file, fh, p);
+               dbgarg(cmd, "index=%d, name=%s, type=%d, "
+                               "capability=0x%x, rangelow=%d, "
+                               "rangehigh=%d, signal=%d, afc=%d, "
+                               "rxsubchans=0x%x, audmode=%d\n",
+                               p->index, p->name, p->type,
+                               p->capability, p->rangelow,
+                               p->rangehigh, p->signal, p->afc,
+                               p->rxsubchans, p->audmode);
+               ret = vfd->vidioc_s_tuner(file, fh, p);
                break;
        }
        case VIDIOC_G_FREQUENCY:
@@ -1783,10 +1821,10 @@ static int __video_do_ioctl(struct inode
                        break;
                memset(p, 0, sizeof(*p));
                p->type = type;
+               dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
                ret = vfd->vidioc_g_sliced_vbi_cap(file, fh, p);
                if (!ret)
-                       dbgarg(cmd, "type=%d, service_set=%d\n",
-                                       p->type, p->service_set);
+                       dbgarg2("service_set=%d\n", p->service_set);
                break;
        }
        case VIDIOC_LOG_STATUS:
@@ -1847,10 +1885,9 @@ static int __video_do_ioctl(struct inode
        } /* switch */
 
        if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {
-               if (ret<0) {
-                       printk("%s: err: on ", vfd->name);
+               if (ret < 0) {
                        v4l_print_ioctl(vfd->name, cmd);
-                       printk("\n");
+                       printk(KERN_CONT " error %d\n", ret);
                }
        }
 
diff -r 0678ea1fc699 -r da6ab7fadef9 linux/include/media/v4l2-dev.h
--- a/linux/include/media/v4l2-dev.h    Sun Jun 22 13:45:12 2008 +0200
+++ b/linux/include/media/v4l2-dev.h    Sun Jun 22 13:55:09 2008 +0200
@@ -65,8 +65,8 @@ int v4l2_prio_check(struct v4l2_prio_sta
 int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
 
 /* names for fancy debug output */
-extern char *v4l2_field_names[];
-extern char *v4l2_type_names[];
+extern const char *v4l2_field_names[];
+extern const char *v4l2_type_names[];
 
 /*  Compatibility layer interface  --  v4l1-compat module */
 typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/da6ab7fadef910d041ffb416aaed8c47d1f738a6

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to