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:49 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-02-26 22:08:49 -0500
commit41f38b43e0bfbb2ba1ef3c778f376dad8820b214 (patch)
tree94a8083a12fdda21f1479f6d2fe9688a60a9e205 /drivers/media/video/v4l2-common.c
parenta8029170b907e7bfac5f6ea3fcd5d076e90beaf3 (diff)
V4L/DVB (3371): Add debug to ioctl arguments.
Added a new function that allows printing ioctl arguments. This makes easier to include debug code under v4l ioctl handling. Also fixed some declarations on internal ioctl. 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.c524
1 files changed, 524 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index cd2c4475525e..a241bf7e92ca 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -362,6 +362,529 @@ void v4l_printk_ioctl(unsigned int cmd)
362 } 362 }
363} 363}
364 364
365/* Common ioctl debug function. This function can be used by
366 external ioctl messages as well as internal V4L ioctl and its
367 arguments */
368void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
369{
370 printk(s);
371 printk(": ");
372 v4l_printk_ioctl(cmd);
373 switch (cmd) {
374 case VIDIOC_INT_G_CHIP_IDENT:
375 {
376 enum v4l2_chip_ident *p=arg;
377 printk ("%s: chip ident=%d\n", s, *p);
378 break;
379 }
380 case VIDIOC_G_PRIORITY:
381 case VIDIOC_S_PRIORITY:
382 {
383 enum v4l2_priority *p=arg;
384 printk ("%s: priority=%d\n", s, *p);
385 break;
386 }
387 case VIDIOC_INT_S_TUNER_MODE:
388 {
389 enum v4l2_tuner_type *p=arg;
390 printk ("%s: tuner type=%d\n", s, *p);
391 break;
392 }
393 case DECODER_SET_VBI_BYPASS:
394 case DECODER_ENABLE_OUTPUT:
395 case DECODER_GET_STATUS:
396 case DECODER_SET_OUTPUT:
397 case DECODER_SET_INPUT:
398 case DECODER_SET_GPIO:
399 case DECODER_SET_NORM:
400 case VIDIOCCAPTURE:
401 case VIDIOCSYNC:
402 case VIDIOCSWRITEMODE:
403 case TUNER_SET_TYPE_ADDR:
404 case TUNER_SET_STANDBY:
405 case TDA9887_SET_CONFIG:
406 case AUDC_SET_INPUT:
407 case VIDIOC_OVERLAY_OLD:
408 case VIDIOC_STREAMOFF:
409 case VIDIOC_G_OUTPUT:
410 case VIDIOC_S_OUTPUT:
411 case VIDIOC_STREAMON:
412 case VIDIOC_G_INPUT:
413 case VIDIOC_OVERLAY:
414 case VIDIOC_S_INPUT:
415 {
416 int *p=arg;
417 printk ("%s: value=%d\n", s, *p);
418 break;
419 }
420 case MSP_SET_MATRIX:
421 {
422 struct msp_matrix *p=arg;
423 printk ("%s: input=%d, output=%d\n", s, p->input, p->output);
424 break;
425 }
426 case VIDIOC_G_AUDIO:
427 case VIDIOC_S_AUDIO:
428 case VIDIOC_ENUMAUDIO:
429 case VIDIOC_G_AUDIO_OLD:
430 {
431 struct v4l2_audio *p=arg;
432
433 printk ("%s: index=%d, name=%s, capability=%d, mode=%d\n",
434 s,p->index, p->name,p->capability, p->mode);
435 break;
436 }
437 case VIDIOC_G_AUDOUT:
438 case VIDIOC_S_AUDOUT:
439 case VIDIOC_ENUMAUDOUT:
440 case VIDIOC_G_AUDOUT_OLD:
441 {
442 struct v4l2_audioout *p=arg;
443 printk ("%s: index=%d, name=%s, capability=%d, mode=%d\n", s,
444 p->index, p->name, p->capability,p->mode);
445 break;
446 }
447 case VIDIOC_QBUF:
448 case VIDIOC_DQBUF:
449 case VIDIOC_QUERYBUF:
450 {
451 struct v4l2_buffer *p=arg;
452 struct v4l2_timecode *tc=&p->timecode;
453 printk ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%d, "
454 "bytesused=%d, flags=0x%08d, "
455 "field=%0d, sequence=%d, memory=%d, offset/userptr=0x%08lx,",
456 s,
457 (p->timestamp.tv_sec/3600),
458 (int)(p->timestamp.tv_sec/60)%60,
459 (int)(p->timestamp.tv_sec%60),
460 p->timestamp.tv_usec,
461 p->index,p->type,p->bytesused,p->flags,
462 p->field,p->sequence,p->memory,p->m.userptr);
463 printk ("%s: timecode= %02d:%02d:%02d type=%d, "
464 "flags=0x%08d, frames=%d, userbits=0x%08x",
465 s,tc->hours,tc->minutes,tc->seconds,
466 tc->type, tc->flags, tc->frames, (__u32) tc->userbits);
467 break;
468 }
469 case VIDIOC_QUERYCAP:
470 {
471 struct v4l2_capability *p=arg;
472 printk ("%s: driver=%s, card=%s, bus=%s, version=%d, "
473 "capabilities=%d\n", s,
474 p->driver,p->card,p->bus_info,
475 p->version,
476 p->capabilities);
477 break;
478 }
479 case VIDIOC_G_CTRL:
480 case VIDIOC_S_CTRL:
481 case VIDIOC_S_CTRL_OLD:
482 {
483 struct v4l2_control *p=arg;
484 printk ("%s: id=%d, value=%d\n", s, p->id, p->value);
485 break;
486 }
487 case VIDIOC_G_CROP:
488 case VIDIOC_S_CROP:
489 {
490 struct v4l2_crop *p=arg;
491 /*FIXME: Should also show rect structs */
492 printk ("%s: type=%d\n", s, p->type);
493 break;
494 }
495 case VIDIOC_CROPCAP:
496 case VIDIOC_CROPCAP_OLD:
497 {
498 struct v4l2_cropcap *p=arg;
499 /*FIXME: Should also show rect structs */
500 printk ("%s: type=%d\n", s, p->type);
501 break;
502 }
503 case VIDIOC_INT_DECODE_VBI_LINE:
504 {
505 struct v4l2_decode_vbi_line *p=arg;
506 printk ("%s: is_second_field=%d, ptr=0x%08lx, line=%d, "
507 "type=%d\n", s,
508 p->is_second_field,(unsigned long)p->p,p->line,p->type);
509 break;
510 }
511 case VIDIOC_ENUM_FMT:
512 {
513 struct v4l2_fmtdesc *p=arg;
514 printk ("%s: index=%d, type=%d, flags=%d, description=%s,"
515 " pixelformat=%d\n", s,
516 p->index, p->type, p->flags,p->description,
517 p->pixelformat);
518
519 break;
520 }
521 case VIDIOC_G_FMT:
522 case VIDIOC_S_FMT:
523 case VIDIOC_TRY_FMT:
524 {
525 struct v4l2_format *p=arg;
526 /* FIXME: Should be one dump per type*/
527 printk ("%s: type=%d\n", s,p->type);
528 break;
529 }
530 case VIDIOC_G_FBUF:
531 case VIDIOC_S_FBUF:
532 {
533 struct v4l2_framebuffer *p=arg;
534 /*FIXME: should show also struct v4l2_pix_format p->fmt field */
535 printk ("%s: capability=%d, flags=%d, base=0x%08lx\n", s,
536 p->capability,p->flags, (unsigned long)p->base);
537 break;
538 }
539 case VIDIOC_G_FREQUENCY:
540 case VIDIOC_S_FREQUENCY:
541 {
542 struct v4l2_frequency *p=arg;
543 printk ("%s: tuner=%d, type=%d, frequency=%d\n", s,
544 p->tuner,p->type,p->frequency);
545 break;
546 }
547 case VIDIOC_ENUMINPUT:
548 {
549 struct v4l2_input *p=arg;
550 printk ("%s: index=%d, name=%s, type=%d, audioset=%d, "
551 "tuner=%d, std=%lld, status=%d\n", s,
552 p->index,p->name,p->type,p->audioset,
553 p->tuner,p->std,
554 p->status);
555 break;
556 }
557 case VIDIOC_G_JPEGCOMP:
558 case VIDIOC_S_JPEGCOMP:
559 {
560 struct v4l2_jpegcompression *p=arg;
561 printk ("%s: quality=%d, APPn=%d, APP_len=%d, COM_len=%d,"
562 " jpeg_markers=%d\n", s,
563 p->quality,p->APPn,p->APP_len,
564 p->COM_len,p->jpeg_markers);
565 break;
566 }
567 case VIDIOC_G_MODULATOR:
568 case VIDIOC_S_MODULATOR:
569 {
570 struct v4l2_modulator *p=arg;
571 printk ("%s: index=%d, name=%s, capability=%d, rangelow=%d,"
572 " rangehigh=%d, txsubchans=%d\n", s,
573 p->index, p->name,p->capability,p->rangelow,
574 p->rangehigh,p->txsubchans);
575 break;
576 }
577 case VIDIOC_G_MPEGCOMP:
578 case VIDIOC_S_MPEGCOMP:
579 {
580 struct v4l2_mpeg_compression *p=arg;
581 /*FIXME: Several fields not shown */
582 printk ("%s: ts_pid_pmt=%d, ts_pid_audio=%d, ts_pid_video=%d, "
583 "ts_pid_pcr=%d, ps_size=%d, au_sample_rate=%d, "
584 "au_pesid=%c, vi_frame_rate=%d, vi_frames_per_gop=%d, "
585 "vi_bframes_count=%d, vi_pesid=%c\n", s,
586 p->ts_pid_pmt,p->ts_pid_audio, p->ts_pid_video,
587 p->ts_pid_pcr, p->ps_size, p->au_sample_rate,
588 p->au_pesid, p->vi_frame_rate,
589 p->vi_frames_per_gop, p->vi_bframes_count,
590 p->vi_pesid);
591 break;
592 }
593 case VIDIOC_ENUMOUTPUT:
594 {
595 struct v4l2_output *p=arg;
596 printk ("%s: index=%d, name=%s,type=%d, audioset=%d, "
597 "modulator=%d, std=%lld\n",
598 s,p->index,p->name,p->type,p->audioset,
599 p->modulator,p->std);
600 break;
601 }
602 case VIDIOC_QUERYCTRL:
603 {
604 struct v4l2_queryctrl *p=arg;
605 printk ("%s: id=%d, type=%d, name=%s, min/max=%d/%d,"
606 " step=%d, default=%d, flags=0x%08x\n", s,
607 p->id,p->type,p->name,p->minimum,p->maximum,
608 p->step,p->default_value,p->flags);
609 break;
610 }
611 case VIDIOC_QUERYMENU:
612 {
613 struct v4l2_querymenu *p=arg;
614 printk ("%s: id=%d, index=%d, name=%s\n", s,
615 p->id,p->index,p->name);
616 break;
617 }
618 case VIDIOC_INT_G_REGISTER:
619 case VIDIOC_INT_S_REGISTER:
620 {
621 struct v4l2_register *p=arg;
622 printk ("%s: i2c_id=%d, reg=%lu, val=%d\n", s,
623 p->i2c_id,p->reg,p->val);
624
625 break;
626 }
627 case VIDIOC_REQBUFS:
628 {
629 struct v4l2_requestbuffers *p=arg;
630 printk ("%s: count=%d, type=%d, memory=%d\n", s,
631 p->count,p->type,p->memory);
632 break;
633 }
634 case VIDIOC_INT_S_AUDIO_ROUTING:
635 case VIDIOC_INT_S_VIDEO_ROUTING:
636 case VIDIOC_INT_G_AUDIO_ROUTING:
637 case VIDIOC_INT_G_VIDEO_ROUTING:
638 {
639 struct v4l2_routing *p=arg;
640 printk ("%s: input=%d, output=%d\n", s, p->input, p->output);
641 break;
642 }
643 case VIDIOC_G_SLICED_VBI_CAP:
644 {
645 struct v4l2_sliced_vbi_cap *p=arg;
646 printk ("%s: service_set=%d\n", s,
647 p->service_set);
648 break;
649 }
650 case VIDIOC_INT_S_VBI_DATA:
651 case VIDIOC_INT_G_VBI_DATA:
652 {
653 struct v4l2_sliced_vbi_data *p=arg;
654 printk ("%s: id=%d, field=%d, line=%d\n", s,
655 p->id, p->field, p->line);
656 break;
657 }
658 case VIDIOC_ENUMSTD:
659 {
660 struct v4l2_standard *p=arg;
661 printk ("%s: index=%d, id=%lld, name=%s, fps=%d/%d, framelines=%d\n", s,
662 p->index, p->id, p->name,
663 p->frameperiod.numerator,
664 p->frameperiod.denominator,
665 p->framelines);
666
667 break;
668 }
669 case VIDIOC_G_PARM:
670 case VIDIOC_S_PARM:
671 case VIDIOC_S_PARM_OLD:
672 {
673 struct v4l2_streamparm *p=arg;
674 printk ("%s: type=%d\n", s, p->type);
675
676 break;
677 }
678 case VIDIOC_G_TUNER:
679 case VIDIOC_S_TUNER:
680 {
681 struct v4l2_tuner *p=arg;
682 printk ("%s: index=%d, name=%s, type=%d, capability=%d, "
683 "rangelow=%d, rangehigh=%d, signal=%d, afc=%d, "
684 "rxsubchans=%d, audmode=%d\n", s,
685 p->index, p->name, p->type,
686 p->capability, p->rangelow,p->rangehigh,
687 p->rxsubchans, p->audmode, p->signal,
688 p->afc);
689 break;
690 }
691 case VIDIOCGVBIFMT:
692 case VIDIOCSVBIFMT:
693 {
694 struct vbi_format *p=arg;
695 printk ("%s: sampling_rate=%d, samples_per_line=%d, "
696 "sample_format=%d, start=%d/%d, count=%d/%d, flags=%d\n", s,
697 p->sampling_rate,p->samples_per_line,
698 p->sample_format,p->start[0],p->start[1],
699 p->count[0],p->count[1],p->flags);
700 break;
701 }
702 case VIDIOCGAUDIO:
703 case VIDIOCSAUDIO:
704 {
705 struct video_audio *p=arg;
706 printk ("%s: audio=%d, volume=%d, bass=%d, treble=%d, "
707 "flags=%d, name=%s, mode=%d, balance=%d, step=%d\n",
708 s,p->audio,p->volume,p->bass, p->treble,
709 p->flags,p->name,p->mode,p->balance,p->step);
710 break;
711 }
712 case VIDIOCGFBUF:
713 case VIDIOCSFBUF:
714 {
715 struct video_buffer *p=arg;
716 printk ("%s: base=%08lx, height=%d, width=%d, depth=%d, "
717 "bytesperline=%d\n", s,
718 (unsigned long) p->base, p->height, p->width,
719 p->depth,p->bytesperline);
720 break;
721 }
722 case VIDIOCGCAP:
723 {
724 struct video_capability *p=arg;
725 printk ("%s: name=%s, type=%d, channels=%d, audios=%d, "
726 "maxwidth=%d, maxheight=%d, minwidth=%d, minheight=%d\n",
727 s,p->name,p->type,p->channels,p->audios,
728 p->maxwidth,p->maxheight,p->minwidth,
729 p->minheight);
730
731 break;
732 }
733 case VIDIOCGCAPTURE:
734 case VIDIOCSCAPTURE:
735 {
736 struct video_capture *p=arg;
737 printk ("%s: x=%d, y=%d, width=%d, height=%d, decimation=%d,"
738 " flags=%d\n", s,
739 p->x, p->y,p->width, p->height,
740 p->decimation,p->flags);
741 break;
742 }
743 case VIDIOCGCHAN:
744 case VIDIOCSCHAN:
745 {
746 struct video_channel *p=arg;
747 printk ("%s: channel=%d, name=%s, tuners=%d, flags=%d, "
748 "type=%d, norm=%d\n", s,
749 p->channel,p->name,p->tuners,
750 p->flags,p->type,p->norm);
751
752 break;
753 }
754 case VIDIOCSMICROCODE:
755 {
756 struct video_code *p=arg;
757 printk ("%s: loadwhat=%s, datasize=%d\n", s,
758 p->loadwhat,p->datasize);
759 break;
760 }
761 case DECODER_GET_CAPABILITIES:
762 {
763 struct video_decoder_capability *p=arg;
764 printk ("%s: flags=%d, inputs=%d, outputs=%d\n", s,
765 p->flags,p->inputs,p->outputs);
766 break;
767 }
768 case DECODER_INIT:
769 {
770 struct video_decoder_init *p=arg;
771 printk ("%s: len=%c\n", s, p->len);
772 break;
773 }
774 case VIDIOCGPLAYINFO:
775 {
776 struct video_info *p=arg;
777 printk ("%s: frame_count=%d, h_size=%d, v_size=%d, "
778 "smpte_timecode=%d, picture_type=%d, "
779 "temporal_reference=%d, user_data=%s\n", s,
780 p->frame_count, p->h_size,
781 p->v_size, p->smpte_timecode,
782 p->picture_type, p->temporal_reference,
783 p->user_data);
784 break;
785 }
786 case VIDIOCKEY:
787 {
788 struct video_key *p=arg;
789 printk ("%s: key=%s, flags=%d\n", s,
790 p->key, p->flags);
791 break;
792 }
793 case VIDIOCGMBUF:
794 {
795 struct video_mbuf *p=arg;
796 printk ("%s: size=%d, frames=%d, offsets=0x%08lx\n", s,
797 p->size,
798 p->frames,
799 (unsigned long)p->offsets);
800 break;
801 }
802 case VIDIOCMCAPTURE:
803 {
804 struct video_mmap *p=arg;
805 printk ("%s: frame=%d, height=%d, width=%d, format=%d\n", s,
806 p->frame,
807 p->height, p->width,
808 p->format);
809 break;
810 }
811 case VIDIOCGPICT:
812 case VIDIOCSPICT:
813 case DECODER_SET_PICTURE:
814 {
815 struct video_picture *p=arg;
816
817 printk ("%s: brightness=%d, hue=%d, colour=%d, contrast=%d,"
818 " whiteness=%d, depth=%d, palette=%d\n", s,
819 p->brightness, p->hue, p->colour,
820 p->contrast, p->whiteness, p->depth,
821 p->palette);
822 break;
823 }
824 case VIDIOCSPLAYMODE:
825 {
826 struct video_play_mode *p=arg;
827 printk ("%s: mode=%d, p1=%d, p2=%d\n", s,
828 p->mode,p->p1,p->p2);
829 break;
830 }
831 case VIDIOCGTUNER:
832 case VIDIOCSTUNER:
833 {
834 struct video_tuner *p=arg;
835 printk ("%s: tuner=%d, name=%s, rangelow=%ld, rangehigh=%ld, "
836 "flags=%d, mode=%d, signal=%d\n", s,
837 p->tuner, p->name,p->rangelow, p->rangehigh,
838 p->flags,p->mode, p->signal);
839 break;
840 }
841 case VIDIOCGUNIT:
842 {
843 struct video_unit *p=arg;
844 printk ("%s: video=%d, vbi=%d, radio=%d, audio=%d, "
845 "teletext=%d\n", s,
846 p->video,p->vbi,p->radio,p->audio,p->teletext);
847 break;
848 }
849 case VIDIOCGWIN:
850 case VIDIOCSWIN:
851 {
852 struct video_window *p=arg;
853 printk ("%s: x=%d, y=%d, width=%d, height=%d, chromakey=%d,"
854 " flags=%d, clipcount=%d\n", s,
855 p->x, p->y,p->width, p->height,
856 p->chromakey,p->flags,
857 p->clipcount);
858 break;
859 }
860 case VIDIOC_INT_AUDIO_CLOCK_FREQ:
861 case VIDIOC_INT_I2S_CLOCK_FREQ:
862 case VIDIOC_INT_S_STANDBY:
863 {
864 u32 *p=arg;
865
866 printk ("%s: value=%d\n", s, *p);
867 break;
868 }
869 case VIDIOCGFREQ:
870 case VIDIOCSFREQ:
871 {
872 unsigned long *p=arg;
873 printk ("%s: value=%lu\n", s, *p);
874 break;
875 }
876 case VIDIOC_G_STD:
877 case VIDIOC_S_STD:
878 case VIDIOC_QUERYSTD:
879 {
880 v4l2_std_id *p=arg;
881
882 printk ("%s: value=%llu\n", s, *p);
883 break;
884 }
885 }
886}
887
365/* ----------------------------------------------------------------- */ 888/* ----------------------------------------------------------------- */
366 889
367EXPORT_SYMBOL(v4l2_video_std_construct); 890EXPORT_SYMBOL(v4l2_video_std_construct);
@@ -376,6 +899,7 @@ EXPORT_SYMBOL(v4l2_prio_check);
376EXPORT_SYMBOL(v4l2_field_names); 899EXPORT_SYMBOL(v4l2_field_names);
377EXPORT_SYMBOL(v4l2_type_names); 900EXPORT_SYMBOL(v4l2_type_names);
378EXPORT_SYMBOL(v4l_printk_ioctl); 901EXPORT_SYMBOL(v4l_printk_ioctl);
902EXPORT_SYMBOL(v4l_printk_ioctl_arg);
379 903
380/* 904/*
381 * Local variables: 905 * Local variables: