aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-common.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-02-26 22:08:58 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-02-26 22:08:58 -0500
commit2e0d447005d2ac05b15aa21b3846815f90bafbdb (patch)
tree7b6f83db521a76fc0f7d344dd2543d00d3114322 /drivers/media/video/v4l2-common.c
parent0bbb9c175211c2e114216978c9630d894c7760b3 (diff)
V4L/DVB (3374): Adds debuging v4l2_memory enum
Some cleanup on printing enum names. v4l2_memory now translated also to name. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/v4l2-common.c')
-rw-r--r--drivers/media/video/v4l2-common.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 9e41ab7d5677..95a6e47c99f1 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -170,7 +170,7 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local)
170 170
171 171
172/* ----------------------------------------------------------------- */ 172/* ----------------------------------------------------------------- */
173/* some arrays for pretty-printing debug messages */ 173/* some arrays for pretty-printing debug messages of enum types */
174 174
175char *v4l2_field_names[] = { 175char *v4l2_field_names[] = {
176 [V4L2_FIELD_ANY] = "any", 176 [V4L2_FIELD_ANY] = "any",
@@ -191,6 +191,14 @@ char *v4l2_type_names[] = {
191 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", 191 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
192}; 192};
193 193
194static char *v4l2_memory_names[] = {
195 [V4L2_MEMORY_MMAP] = "mmap",
196 [V4L2_MEMORY_USERPTR] = "userptr",
197 [V4L2_MEMORY_OVERLAY] = "overlay",
198};
199
200#define prt_names(a,arr) (((a)>=0)&&((a)<ARRAY_SIZE(arr)))?arr[a]:"unknown"
201
194/* ------------------------------------------------------------------ */ 202/* ------------------------------------------------------------------ */
195/* debug help functions */ 203/* debug help functions */
196 204
@@ -328,8 +336,7 @@ static void v4l_print_pix_fmt (char *s, struct v4l2_pix_format *fmt)
328 printk ("%s: width=%d, height=%d, format=%d, field=%s, " 336 printk ("%s: width=%d, height=%d, format=%d, field=%s, "
329 "bytesperline=%d sizeimage=%d, colorspace=%d\n", s, 337 "bytesperline=%d sizeimage=%d, colorspace=%d\n", s,
330 fmt->width,fmt->height,fmt->pixelformat, 338 fmt->width,fmt->height,fmt->pixelformat,
331 ((fmt->field>=0)&&(fmt->field<ARRAY_SIZE(v4l2_field_names)))? 339 prt_names(fmt->field,v4l2_field_names),
332 v4l2_field_names[fmt->field]:"unknown",
333 fmt->bytesperline,fmt->sizeimage,fmt->colorspace); 340 fmt->bytesperline,fmt->sizeimage,fmt->colorspace);
334}; 341};
335 342
@@ -461,17 +468,18 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
461 struct v4l2_timecode *tc=&p->timecode; 468 struct v4l2_timecode *tc=&p->timecode;
462 printk ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%s, " 469 printk ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%s, "
463 "bytesused=%d, flags=0x%08d, " 470 "bytesused=%d, flags=0x%08d, "
464 "field=%0d, sequence=%d, memory=%d, offset/userptr=0x%08lx\n", 471 "field=%0d, sequence=%d, memory=%s, offset/userptr=0x%08lx\n",
465 s, 472 s,
466 (p->timestamp.tv_sec/3600), 473 (p->timestamp.tv_sec/3600),
467 (int)(p->timestamp.tv_sec/60)%60, 474 (int)(p->timestamp.tv_sec/60)%60,
468 (int)(p->timestamp.tv_sec%60), 475 (int)(p->timestamp.tv_sec%60),
469 p->timestamp.tv_usec, 476 p->timestamp.tv_usec,
470 p->index, 477 p->index,
471 ((p->type>=0)&&(p->type<ARRAY_SIZE(v4l2_type_names)))? 478 prt_names(p->type,v4l2_type_names),
472 v4l2_type_names[p->type]:"unknown",
473 p->bytesused,p->flags, 479 p->bytesused,p->flags,
474 p->field,p->sequence,p->memory,p->m.userptr); 480 p->field,p->sequence,
481 prt_names(p->memory,v4l2_memory_names),
482 p->m.userptr);
475 printk ("%s: timecode= %02d:%02d:%02d type=%d, " 483 printk ("%s: timecode= %02d:%02d:%02d type=%d, "
476 "flags=0x%08d, frames=%d, userbits=0x%08x", 484 "flags=0x%08d, frames=%d, userbits=0x%08x",
477 s,tc->hours,tc->minutes,tc->seconds, 485 s,tc->hours,tc->minutes,tc->seconds,
@@ -536,8 +544,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
536 { 544 {
537 struct v4l2_format *p=arg; 545 struct v4l2_format *p=arg;
538 printk ("%s: type=%s\n", s, 546 printk ("%s: type=%s\n", s,
539 ((p->type>=0)&&(p->type<ARRAY_SIZE(v4l2_type_names)))? 547 prt_names(p->type,v4l2_type_names));
540 v4l2_type_names[p->type]:"unknown");
541 switch (p->type) { 548 switch (p->type) {
542 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 549 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
543 v4l_print_pix_fmt (s, &p->fmt.pix); 550 v4l_print_pix_fmt (s, &p->fmt.pix);
@@ -646,8 +653,10 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
646 case VIDIOC_REQBUFS: 653 case VIDIOC_REQBUFS:
647 { 654 {
648 struct v4l2_requestbuffers *p=arg; 655 struct v4l2_requestbuffers *p=arg;
649 printk ("%s: count=%d, type=%d, memory=%d\n", s, 656 printk ("%s: count=%d, type=%s, memory=%s\n", s,
650 p->count,p->type,p->memory); 657 p->count,
658 prt_names(p->type,v4l2_type_names),
659 prt_names(p->memory,v4l2_memory_names));
651 break; 660 break;
652 } 661 }
653 case VIDIOC_INT_S_AUDIO_ROUTING: 662 case VIDIOC_INT_S_AUDIO_ROUTING: