Commit 21575c13 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

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: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 7dc1b884
...@@ -17,15 +17,19 @@ ...@@ -17,15 +17,19 @@
*/ */
#define dbgarg(cmd, fmt, arg...) \ #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); \ printk(KERN_DEBUG "%s: ", vfd->name); \
v4l_printk_ioctl(cmd); \ v4l_printk_ioctl(cmd); \
printk(" " fmt, ## arg); \ printk(" " fmt, ## arg); \
} } \
} while (0)
#define dbgarg2(fmt, arg...) \ #define dbgarg2(fmt, arg...) \
if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) \ do { \
printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg); if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) \
printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);\
} while (0)
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -138,7 +142,7 @@ EXPORT_SYMBOL(v4l2_video_std_construct); ...@@ -138,7 +142,7 @@ EXPORT_SYMBOL(v4l2_video_std_construct);
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/* some arrays for pretty-printing debug messages of enum types */ /* 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_ANY] = "any",
[V4L2_FIELD_NONE] = "none", [V4L2_FIELD_NONE] = "none",
[V4L2_FIELD_TOP] = "top", [V4L2_FIELD_TOP] = "top",
...@@ -152,19 +156,19 @@ char *v4l2_field_names[] = { ...@@ -152,19 +156,19 @@ char *v4l2_field_names[] = {
}; };
EXPORT_SYMBOL(v4l2_field_names); EXPORT_SYMBOL(v4l2_field_names);
char *v4l2_type_names[] = { const char *v4l2_type_names[] = {
[V4L2_BUF_TYPE_VIDEO_CAPTURE] = "video-cap", [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "vid-cap",
[V4L2_BUF_TYPE_VIDEO_OVERLAY] = "video-over", [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "vid-overlay",
[V4L2_BUF_TYPE_VIDEO_OUTPUT] = "video-out", [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "vid-out",
[V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap", [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap",
[V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
[V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap", [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
[V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out", [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); EXPORT_SYMBOL(v4l2_type_names);
static char *v4l2_memory_names[] = { static const char *v4l2_memory_names[] = {
[V4L2_MEMORY_MMAP] = "mmap", [V4L2_MEMORY_MMAP] = "mmap",
[V4L2_MEMORY_USERPTR] = "userptr", [V4L2_MEMORY_USERPTR] = "userptr",
[V4L2_MEMORY_OVERLAY] = "overlay", [V4L2_MEMORY_OVERLAY] = "overlay",
...@@ -660,7 +664,7 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd, ...@@ -660,7 +664,7 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd,
p->field, p->sequence, p->field, p->sequence,
prt_names(p->memory, v4l2_memory_names), prt_names(p->memory, v4l2_memory_names),
p->m.userptr, p->length); 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", "flags=0x%08d, frames=%d, userbits=0x%08x\n",
tc->hours,tc->minutes,tc->seconds, tc->hours,tc->minutes,tc->seconds,
tc->type, tc->flags, tc->frames, *(__u32 *) tc->userbits); tc->type, tc->flags, tc->frames, *(__u32 *) tc->userbits);
...@@ -669,7 +673,7 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd, ...@@ -669,7 +673,7 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd,
static inline void dbgrect(struct video_device *vfd, char *s, static inline void dbgrect(struct video_device *vfd, char *s,
struct v4l2_rect *r) 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); r->width, r->height);
}; };
...@@ -687,6 +691,25 @@ static inline void v4l_print_pix_fmt (struct video_device *vfd, ...@@ -687,6 +691,25 @@ static inline void v4l_print_pix_fmt (struct video_device *vfd,
fmt->bytesperline, fmt->sizeimage, fmt->colorspace); 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) static int check_fmt (struct video_device *vfd, enum v4l2_buf_type type)
{ {
...@@ -894,7 +917,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -894,7 +917,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
if (vfd->vidioc_g_fmt_vid_cap) if (vfd->vidioc_g_fmt_vid_cap)
ret = vfd->vidioc_g_fmt_vid_cap(file, fh, f); ret = vfd->vidioc_g_fmt_vid_cap(file, fh, f);
if (!ret) if (!ret)
v4l_print_pix_fmt(vfd,&f->fmt.pix); v4l_print_pix_fmt(vfd, &f->fmt.pix);
break; break;
case V4L2_BUF_TYPE_VIDEO_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (vfd->vidioc_g_fmt_vid_overlay) if (vfd->vidioc_g_fmt_vid_overlay)
...@@ -904,6 +927,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -904,6 +927,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
case V4L2_BUF_TYPE_VIDEO_OUTPUT: case V4L2_BUF_TYPE_VIDEO_OUTPUT:
if (vfd->vidioc_g_fmt_vid_out) if (vfd->vidioc_g_fmt_vid_out)
ret = vfd->vidioc_g_fmt_vid_out(file, fh, f); ret = vfd->vidioc_g_fmt_vid_out(file, fh, f);
if (!ret)
v4l_print_pix_fmt(vfd, &f->fmt.pix);
break; break;
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (vfd->vidioc_g_fmt_vid_out_overlay) if (vfd->vidioc_g_fmt_vid_out_overlay)
...@@ -942,12 +967,11 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -942,12 +967,11 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
struct v4l2_format *f = (struct v4l2_format *)arg; struct v4l2_format *f = (struct v4l2_format *)arg;
/* FIXME: Should be one dump per type */ /* FIXME: Should be one dump per type */
dbgarg (cmd, "type=%s\n", prt_names(f->type, dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
v4l2_type_names));
switch (f->type) { switch (f->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE: 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) if (vfd->vidioc_s_fmt_vid_cap)
ret = vfd->vidioc_s_fmt_vid_cap(file, fh, f); ret = vfd->vidioc_s_fmt_vid_cap(file, fh, f);
break; break;
...@@ -957,6 +981,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -957,6 +981,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
fh, f); fh, f);
break; break;
case V4L2_BUF_TYPE_VIDEO_OUTPUT: case V4L2_BUF_TYPE_VIDEO_OUTPUT:
v4l_print_pix_fmt(vfd, &f->fmt.pix);
if (vfd->vidioc_s_fmt_vid_out) if (vfd->vidioc_s_fmt_vid_out)
ret = vfd->vidioc_s_fmt_vid_out(file, fh, f); ret = vfd->vidioc_s_fmt_vid_out(file, fh, f);
break; break;
...@@ -1003,7 +1028,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1003,7 +1028,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
if (vfd->vidioc_try_fmt_vid_cap) if (vfd->vidioc_try_fmt_vid_cap)
ret = vfd->vidioc_try_fmt_vid_cap(file, fh, f); ret = vfd->vidioc_try_fmt_vid_cap(file, fh, f);
if (!ret) if (!ret)
v4l_print_pix_fmt(vfd,&f->fmt.pix); v4l_print_pix_fmt(vfd, &f->fmt.pix);
break; break;
case V4L2_BUF_TYPE_VIDEO_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (vfd->vidioc_try_fmt_vid_overlay) if (vfd->vidioc_try_fmt_vid_overlay)
...@@ -1013,6 +1038,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1013,6 +1038,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
case V4L2_BUF_TYPE_VIDEO_OUTPUT: case V4L2_BUF_TYPE_VIDEO_OUTPUT:
if (vfd->vidioc_try_fmt_vid_out) if (vfd->vidioc_try_fmt_vid_out)
ret = vfd->vidioc_try_fmt_vid_out(file, fh, f); ret = vfd->vidioc_try_fmt_vid_out(file, fh, f);
if (!ret)
v4l_print_pix_fmt(vfd, &f->fmt.pix);
break; break;
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (vfd->vidioc_try_fmt_vid_out_overlay) if (vfd->vidioc_try_fmt_vid_out_overlay)
...@@ -1123,29 +1150,29 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1123,29 +1150,29 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
} }
case VIDIOC_G_FBUF: case VIDIOC_G_FBUF:
{ {
struct v4l2_framebuffer *p=arg; struct v4l2_framebuffer *p = arg;
if (!vfd->vidioc_g_fbuf) if (!vfd->vidioc_g_fbuf)
break; break;
ret=vfd->vidioc_g_fbuf(file, fh, arg); ret = vfd->vidioc_g_fbuf(file, fh, arg);
if (!ret) { if (!ret) {
dbgarg (cmd, "capability=%d, flags=%d, base=0x%08lx\n", dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
p->capability,p->flags, p->capability, p->flags,
(unsigned long)p->base); (unsigned long)p->base);
v4l_print_pix_fmt (vfd, &p->fmt); v4l_print_pix_fmt(vfd, &p->fmt);
} }
break; break;
} }
case VIDIOC_S_FBUF: case VIDIOC_S_FBUF:
{ {
struct v4l2_framebuffer *p=arg; struct v4l2_framebuffer *p = arg;
if (!vfd->vidioc_s_fbuf) if (!vfd->vidioc_s_fbuf)
break; break;
dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
dbgarg (cmd, "capability=%d, flags=%d, base=0x%08lx\n", p->capability, p->flags, (unsigned long)p->base);
p->capability,p->flags,(unsigned long)p->base); v4l_print_pix_fmt(vfd, &p->fmt);
v4l_print_pix_fmt (vfd, &p->fmt); ret = vfd->vidioc_s_fbuf(file, fh, arg);
ret=vfd->vidioc_s_fbuf(file, fh, arg);
break; break;
} }
case VIDIOC_STREAMON: case VIDIOC_STREAMON:
...@@ -1197,7 +1224,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1197,7 +1224,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
v4l2_video_std_construct(p, curr_id, descr); v4l2_video_std_construct(p, curr_id, descr);
p->index = index; 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, "framelines=%d\n", p->index,
(unsigned long long)p->id, p->name, (unsigned long long)p->id, p->name,
p->frameperiod.numerator, p->frameperiod.numerator,
...@@ -1219,14 +1246,14 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1219,14 +1246,14 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
*id = vfd->current_norm; *id = vfd->current_norm;
if (!ret) if (!ret)
dbgarg(cmd, "value=%08Lx\n", (long long unsigned)*id); dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id);
break; break;
} }
case VIDIOC_S_STD: case VIDIOC_S_STD:
{ {
v4l2_std_id *id = arg,norm; 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; norm = (*id) & vfd->tvnorms;
if ( vfd->tvnorms && !norm) /* Check if std is supported */ 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,8 +1342,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
ret = vfd->vidioc_enum_output(file, fh, p); ret = vfd->vidioc_enum_output(file, fh, p);
if (!ret) if (!ret)
dbgarg(cmd, "index=%d, name=%s, type=%d, " dbgarg(cmd, "index=%d, name=%s, type=%d, "
"audioset=%d, " "audioset=0x%x, "
"modulator=%d, std=%08Lx\n", "modulator=%d, std=0x%08Lx\n",
p->index, p->name, p->type, p->audioset, p->index, p->name, p->type, p->audioset,
p->modulator, (unsigned long long)p->std); p->modulator, (unsigned long long)p->std);
break; break;
...@@ -1346,19 +1373,19 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1346,19 +1373,19 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
/* --- controls ---------------------------------------------- */ /* --- controls ---------------------------------------------- */
case VIDIOC_QUERYCTRL: case VIDIOC_QUERYCTRL:
{ {
struct v4l2_queryctrl *p=arg; struct v4l2_queryctrl *p = arg;
if (!vfd->vidioc_queryctrl) if (!vfd->vidioc_queryctrl)
break; break;
ret=vfd->vidioc_queryctrl(file, fh, p); ret = vfd->vidioc_queryctrl(file, fh, p);
if (!ret) if (!ret)
dbgarg (cmd, "id=%d, type=%d, name=%s, " dbgarg(cmd, "id=0x%x, type=%d, name=%s, min/max=%d/%d, "
"min/max=%d/%d," "step=%d, default=%d, flags=0x%08x\n",
" step=%d, default=%d, flags=0x%08x\n", p->id, p->type, p->name,
p->id,p->type,p->name,p->minimum, p->minimum, p->maximum,
p->maximum,p->step,p->default_value, p->step, p->default_value, p->flags);
p->flags); else
dbgarg(cmd, "id=0x%x\n", p->id);
break; break;
} }
case VIDIOC_G_CTRL: case VIDIOC_G_CTRL:
...@@ -1367,11 +1394,12 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1367,11 +1394,12 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
if (!vfd->vidioc_g_ctrl) if (!vfd->vidioc_g_ctrl)
break; break;
dbgarg(cmd, "Enum for index=%d\n", p->id);
ret=vfd->vidioc_g_ctrl(file, fh, p); ret = vfd->vidioc_g_ctrl(file, fh, p);
if (!ret) if (!ret)
dbgarg2 ( "id=%d, value=%d\n", p->id, p->value); dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
else
dbgarg(cmd, "id=0x%x\n", p->id);
break; break;
} }
case VIDIOC_S_CTRL: case VIDIOC_S_CTRL:
...@@ -1380,20 +1408,19 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1380,20 +1408,19 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
if (!vfd->vidioc_s_ctrl) if (!vfd->vidioc_s_ctrl)
break; break;
dbgarg (cmd, "id=%d, value=%d\n", p->id, p->value); dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
ret=vfd->vidioc_s_ctrl(file, fh, p); ret = vfd->vidioc_s_ctrl(file, fh, p);
break; break;
} }
case VIDIOC_G_EXT_CTRLS: case VIDIOC_G_EXT_CTRLS:
{ {
struct v4l2_ext_controls *p = arg; struct v4l2_ext_controls *p = arg;
if (vfd->vidioc_g_ext_ctrls) { if (!vfd->vidioc_g_ext_ctrls)
dbgarg(cmd, "count=%d\n", p->count); break;
ret = vfd->vidioc_g_ext_ctrls(file, fh, p);
ret=vfd->vidioc_g_ext_ctrls(file, fh, p); v4l_print_ext_ctrls(cmd, vfd, p, !ret);
}
break; break;
} }
case VIDIOC_S_EXT_CTRLS: case VIDIOC_S_EXT_CTRLS:
...@@ -1401,9 +1428,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1401,9 +1428,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
struct v4l2_ext_controls *p = arg; struct v4l2_ext_controls *p = arg;
if (vfd->vidioc_s_ext_ctrls) { if (vfd->vidioc_s_ext_ctrls) {
dbgarg(cmd, "count=%d\n", p->count); v4l_print_ext_ctrls(cmd, vfd, p, 1);
ret=vfd->vidioc_s_ext_ctrls(file, fh, p); ret = vfd->vidioc_s_ext_ctrls(file, fh, p);
} }
break; break;
} }
...@@ -1412,66 +1439,72 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1412,66 +1439,72 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
struct v4l2_ext_controls *p = arg; struct v4l2_ext_controls *p = arg;
if (vfd->vidioc_try_ext_ctrls) { if (vfd->vidioc_try_ext_ctrls) {
dbgarg(cmd, "count=%d\n", p->count); v4l_print_ext_ctrls(cmd, vfd, p, 1);
ret=vfd->vidioc_try_ext_ctrls(file, fh, p); ret = vfd->vidioc_try_ext_ctrls(file, fh, p);
} }
break; break;
} }
case VIDIOC_QUERYMENU: case VIDIOC_QUERYMENU:
{ {
struct v4l2_querymenu *p=arg; struct v4l2_querymenu *p = arg;
if (!vfd->vidioc_querymenu) if (!vfd->vidioc_querymenu)
break; break;
ret=vfd->vidioc_querymenu(file, fh, p); ret = vfd->vidioc_querymenu(file, fh, p);
if (!ret) if (!ret)
dbgarg (cmd, "id=%d, index=%d, name=%s\n", dbgarg(cmd, "id=0x%x, index=%d, name=%s\n",
p->id,p->index,p->name); p->id, p->index, p->name);
else
dbgarg(cmd, "id=0x%x, index=%d\n",
p->id, p->index);
break; break;
} }
/* --- audio ---------------------------------------------- */ /* --- audio ---------------------------------------------- */
case VIDIOC_ENUMAUDIO: case VIDIOC_ENUMAUDIO:
{ {
struct v4l2_audio *p=arg; struct v4l2_audio *p = arg;
if (!vfd->vidioc_enumaudio) if (!vfd->vidioc_enumaudio)
break; break;
dbgarg(cmd, "Enum for index=%d\n", p->index); ret = vfd->vidioc_enumaudio(file, fh, p);
ret=vfd->vidioc_enumaudio(file, fh, p);
if (!ret) if (!ret)
dbgarg2("index=%d, name=%s, capability=%d, " dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
"mode=%d\n",p->index,p->name, "mode=0x%x\n", p->index, p->name,
p->capability, p->mode); p->capability, p->mode);
else
dbgarg(cmd, "index=%d\n", p->index);
break; break;
} }
case VIDIOC_G_AUDIO: case VIDIOC_G_AUDIO:
{ {
struct v4l2_audio *p=arg; struct v4l2_audio *p = arg;
__u32 index=p->index; __u32 index = p->index;
if (!vfd->vidioc_g_audio) if (!vfd->vidioc_g_audio)
break; break;
memset(p,0,sizeof(*p)); memset(p, 0, sizeof(*p));
p->index=index; p->index = index;
dbgarg(cmd, "Get for index=%d\n", p->index); ret = vfd->vidioc_g_audio(file, fh, p);
ret=vfd->vidioc_g_audio(file, fh, p);
if (!ret) if (!ret)
dbgarg2("index=%d, name=%s, capability=%d, " dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
"mode=%d\n",p->index, "mode=0x%x\n", p->index,
p->name,p->capability, p->mode); p->name, p->capability, p->mode);
else
dbgarg(cmd, "index=%d\n", p->index);
break; break;
} }
case VIDIOC_S_AUDIO: case VIDIOC_S_AUDIO:
{ {
struct v4l2_audio *p=arg; struct v4l2_audio *p = arg;
if (!vfd->vidioc_s_audio) if (!vfd->vidioc_s_audio)
break; break;
dbgarg(cmd, "index=%d, name=%s, capability=%d, " dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
"mode=%d\n", p->index, p->name, "mode=0x%x\n", p->index, p->name,
p->capability, p->mode); p->capability, p->mode);
ret=vfd->vidioc_s_audio(file, fh, p); ret = vfd->vidioc_s_audio(file, fh, p);
break; break;
} }
case VIDIOC_ENUMAUDOUT: case VIDIOC_ENUMAUDOUT:
...@@ -1547,9 +1580,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1547,9 +1580,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
struct v4l2_crop *p=arg; struct v4l2_crop *p=arg;
if (!vfd->vidioc_g_crop) if (!vfd->vidioc_g_crop)
break; break;
dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
ret=vfd->vidioc_g_crop(file, fh, p); ret=vfd->vidioc_g_crop(file, fh, p);
if (!ret) { if (!ret) {
dbgarg(cmd, "type=%d\n", p->type);
dbgrect(vfd, "", &p->c); dbgrect(vfd, "", &p->c);
} }
break; break;
...@@ -1559,21 +1592,24 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1559,21 +1592,24 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
struct v4l2_crop *p=arg; struct v4l2_crop *p=arg;
if (!vfd->vidioc_s_crop) if (!vfd->vidioc_s_crop)
break; break;
dbgarg(cmd, "type=%d\n", p->type); dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
dbgrect(vfd, "", &p->c); dbgrect(vfd, "", &p->c);
ret=vfd->vidioc_s_crop(file, fh, p); ret=vfd->vidioc_s_crop(file, fh, p);
break; break;
} }
case VIDIOC_CROPCAP: case VIDIOC_CROPCAP:
{ {
struct v4l2_cropcap *p=arg; struct v4l2_cropcap *p = arg;
/*FIXME: Should also show v4l2_fract pixelaspect */ /*FIXME: Should also show v4l2_fract pixelaspect */
if (!vfd->vidioc_cropcap) if (!vfd->vidioc_cropcap)
break; break;
dbgarg(cmd, "type=%d\n", p->type); dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
dbgrect(vfd, "bounds ", &p->bounds); ret = vfd->vidioc_cropcap(file, fh, p);
dbgrect(vfd, "defrect ", &p->defrect); if (!ret) {
ret=vfd->vidioc_cropcap(file, fh, p); dbgrect(vfd, "bounds ", &p->bounds);
dbgrect(vfd, "defrect ", &p->defrect);
}
break; break;
} }
case VIDIOC_G_JPEGCOMP: case VIDIOC_G_JPEGCOMP:
...@@ -1675,40 +1711,42 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1675,40 +1711,42 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
} }
case VIDIOC_G_TUNER: case VIDIOC_G_TUNER:
{ {
struct v4l2_tuner *p=arg; struct v4l2_tuner *p = arg;
__u32 index=p->index; __u32 index = p->index;
if (!vfd->vidioc_g_tuner) if (!vfd->vidioc_g_tuner)
break; break;
memset(p,0,sizeof(*p)); memset(p, 0, sizeof(*p));
p->index=index; p->index = index;
ret=vfd->vidioc_g_tuner(file, fh, p); ret = vfd->vidioc_g_tuner(file, fh, p);
if (!ret) if (!ret)
dbgarg (cmd, "index=%d, name=%s, type=%d, " dbgarg(cmd, "index=%d, name=%s, type=%d, "
"capability=%d, rangelow=%d, " "capability=0x%x, rangelow=%d, "
"rangehigh=%d, signal=%d, afc=%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->index, p->name, p->type,
p->capability, p->rangelow, p->capability, p->rangelow,
p->rangehigh, p->rxsubchans, p->rangehigh, p->signal, p->afc,
p->audmode, p->signal, p->afc); p->rxsubchans, p->audmode);
break; break;
} }
case VIDIOC_S_TUNER: case VIDIOC_S_TUNER:
{ {
struct v4l2_tuner *p=arg; struct v4l2_tuner *p = arg;
if (!vfd->vidioc_s_tuner) if (!vfd->vidioc_s_tuner)
break; break;
dbgarg (cmd, "index=%d, name=%s, type=%d, " dbgarg(cmd, "index=%d, name=%s, type=%d, "
"capability=%d, rangelow=%d, rangehigh=%d, " "capability=0x%x, rangelow=%d, "
"signal=%d, afc=%d, rxsubchans=%d, " "rangehigh=%d, signal=%d, afc=%d, "
"audmode=%d\n",p->index, p->name, p->type, "rxsubchans=0x%x, audmode=%d\n",
p->capability, p->rangelow,p->rangehigh, p->index, p->name, p->type,
p->rxsubchans, p->audmode, p->signal, p->capability, p->rangelow,
p->afc); p->rangehigh, p->signal, p->afc,
ret=vfd->vidioc_s_tuner(file, fh, p); p->rxsubchans, p->audmode);
ret = vfd->vidioc_s_tuner(file, fh, p);
break; break;
} }
case VIDIOC_G_FREQUENCY: case VIDIOC_G_FREQUENCY:
...@@ -1745,10 +1783,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1745,10 +1783,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
break; break;
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
p->type = type; 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); ret = vfd->vidioc_g_sliced_vbi_cap(file, fh, p);
if (!ret) if (!ret)
dbgarg(cmd, "type=%d, service_set=%d\n", dbgarg2("service_set=%d\n", p->service_set);
p->type, p->service_set);
break; break;
} }
case VIDIOC_LOG_STATUS: case VIDIOC_LOG_STATUS:
...@@ -1809,10 +1847,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1809,10 +1847,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
} /* switch */ } /* switch */
if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {
if (ret<0) { if (ret < 0) {
printk("%s: err: on ", vfd->name);
v4l_print_ioctl(vfd->name, cmd); v4l_print_ioctl(vfd->name, cmd);
printk("\n"); printk(KERN_CONT " error %d\n", ret);
} }
} }
......
...@@ -59,8 +59,8 @@ enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); ...@@ -59,8 +59,8 @@ enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local); int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
/* names for fancy debug output */ /* names for fancy debug output */
extern char *v4l2_field_names[]; extern const char *v4l2_field_names[];
extern char *v4l2_type_names[]; extern const char *v4l2_type_names[];
/* Compatibility layer interface -- v4l1-compat module */ /* Compatibility layer interface -- v4l1-compat module */
typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
......
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