2 * Copyright (c) 2014 Philippe De Muyter <phdm@macqel.be>
3 * Copyright (c) 2014 William Manley <will@williammanley.net>
4 * Copyright (c) 2011 Peter Zotov <whitequark@whitequark.org>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include <sys/ioctl.h>
34 #include <linux/types.h>
35 #include <linux/videodev2.h>
37 /* some historical constants */
38 #ifndef V4L2_CID_HCENTER
39 #define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
41 #ifndef V4L2_CID_VCENTER
42 #define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
44 #ifndef V4L2_CID_BAND_STOP_FILTER
45 #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
48 #define FMT_FRACT "%u/%u"
49 #define ARGS_FRACT(x) ((x).numerator), ((x).denominator)
51 #define FMT_RECT "{left=%d, top=%d, width=%u, height=%u}"
52 #define ARGS_RECT(x) (x).left, (x).top, (x).width, (x).height
55 print_pixelformat(uint32_t fourcc)
59 unsigned char cc[sizeof(uint32_t)];
60 } u = { .pixelformat = htole32(fourcc) };
63 tprints("v4l2_fourcc(");
64 for (i = 0; i < sizeof(u.cc); ++i) {
65 unsigned char c = u.cc[i];
69 if (c == '\'' || c == '\\') {
78 } else if (c >= ' ' && c <= 0x7e) {
91 "0123456789abcdef"[c >> 4],
92 "0123456789abcdef"[c & 0xf],
102 #include "xlat/v4l2_device_capabilities_flags.h"
105 print_v4l2_capability(struct tcb *tcp, const long arg)
107 struct v4l2_capability caps;
112 if (umove_or_printaddr(tcp, arg, &caps))
115 print_quoted_string((const char *) caps.driver,
116 sizeof(caps.driver), QUOTE_0_TERMINATED);
118 print_quoted_string((const char *) caps.card,
119 sizeof(caps.card), QUOTE_0_TERMINATED);
120 tprints(", bus_info=");
121 print_quoted_string((const char *) caps.bus_info,
122 sizeof(caps.bus_info), QUOTE_0_TERMINATED);
123 tprintf(", version=%u.%u.%u, capabilities=",
124 (caps.version >> 16) & 0xFF,
125 (caps.version >> 8) & 0xFF,
126 caps.version & 0xFF);
127 printflags(v4l2_device_capabilities_flags, caps.capabilities,
129 #ifdef V4L2_CAP_DEVICE_CAPS
130 tprints(", device_caps=");
131 printflags(v4l2_device_capabilities_flags, caps.device_caps,
138 #include "xlat/v4l2_buf_types.h"
139 #include "xlat/v4l2_format_description_flags.h"
142 print_v4l2_fmtdesc(struct tcb *tcp, const long arg)
144 struct v4l2_fmtdesc f;
148 if (umove_or_printaddr(tcp, arg, &f))
149 return RVAL_DECODED | 1;
150 tprintf("{index=%u, type=", f.index);
151 printxval(v4l2_buf_types, f.type, "V4L2_BUF_TYPE_???");
155 if (!syserror(tcp) && !umove(tcp, arg, &f)) {
157 printflags(v4l2_format_description_flags, f.flags,
158 "V4L2_FMT_FLAG_???");
159 tprints(", description=");
160 print_quoted_string((const char *) f.description,
161 sizeof(f.description),
163 tprints(", pixelformat=");
164 print_pixelformat(f.pixelformat);
170 #include "xlat/v4l2_fields.h"
171 #include "xlat/v4l2_colorspaces.h"
174 print_v4l2_format_fmt(const char *prefix, const struct v4l2_format *f)
177 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
178 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
180 tprintf("fmt.pix={width=%u, height=%u, pixelformat=",
181 f->fmt.pix.width, f->fmt.pix.height);
182 print_pixelformat(f->fmt.pix.pixelformat);
184 printxval(v4l2_fields, f->fmt.pix.field, "V4L2_FIELD_???");
185 tprintf(", bytesperline=%u, sizeimage=%u, colorspace=",
186 f->fmt.pix.bytesperline, f->fmt.pix.sizeimage);
187 printxval(v4l2_colorspaces, f->fmt.pix.colorspace,
188 "V4L2_COLORSPACE_???");
191 #if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
192 case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
193 case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: {
197 tprintf("fmt.pix_mp={width=%u, height=%u, pixelformat=",
198 f->fmt.pix_mp.width, f->fmt.pix_mp.height);
199 print_pixelformat(f->fmt.pix_mp.pixelformat);
201 printxval(v4l2_fields, f->fmt.pix_mp.field, "V4L2_FIELD_???");
202 tprints(", colorspace=");
203 printxval(v4l2_colorspaces, f->fmt.pix_mp.colorspace,
204 "V4L2_COLORSPACE_???");
205 tprints(", plane_fmt=[");
206 max = f->fmt.pix_mp.num_planes;
207 if (max > VIDEO_MAX_PLANES)
208 max = VIDEO_MAX_PLANES;
209 for (i = 0; i < max; i++) {
212 tprintf("{sizeimage=%u, bytesperline=%u}",
213 f->fmt.pix_mp.plane_fmt[i].sizeimage,
214 f->fmt.pix_mp.plane_fmt[i].bytesperline);
216 tprintf("], num_planes=%u}", (unsigned) f->fmt.pix_mp.num_planes);
221 /* TODO: Complete this switch statement */
223 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
224 #if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
225 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
228 tprints("fmt.win={???}");
231 case V4L2_BUF_TYPE_VBI_CAPTURE:
232 case V4L2_BUF_TYPE_VBI_OUTPUT:
234 tprints("fmt.vbi={???}");
237 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
238 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
240 tprints("fmt.sliced={???}");
243 #if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
244 case V4L2_BUF_TYPE_SDR_CAPTURE:
245 case V4L2_BUF_TYPE_SDR_OUTPUT:
247 tprints("fmt.sdr={???}");
255 print_v4l2_format(struct tcb *tcp, const long arg, const bool is_get)
257 struct v4l2_format f;
261 if (umove_or_printaddr(tcp, arg, &f))
262 return RVAL_DECODED | 1;
264 printxval(v4l2_buf_types, f.type, "V4L2_BUF_TYPE_???");
267 print_v4l2_format_fmt(", ", &f);
269 if (!syserror(tcp) && !umove(tcp, arg, &f)) {
270 const char *delim = is_get ? ", " : " => ";
271 print_v4l2_format_fmt(delim, &f);
278 #include "xlat/v4l2_memories.h"
281 print_v4l2_requestbuffers(struct tcb *tcp, const long arg)
283 struct v4l2_requestbuffers reqbufs;
287 if (umove_or_printaddr(tcp, arg, &reqbufs))
288 return RVAL_DECODED | 1;
289 tprintf("{count=%u, type=", reqbufs.count);
290 printxval(v4l2_buf_types, reqbufs.type, "V4L2_BUF_TYPE_???");
291 tprints(", memory=");
292 printxval(v4l2_memories, reqbufs.memory, "V4L2_MEMORY_???");
296 static char outstr[sizeof("{count=}") + sizeof(int) * 3];
298 if (syserror(tcp) || umove(tcp, arg, &reqbufs) < 0)
300 sprintf(outstr, "{count=%u}", reqbufs.count);
301 tcp->auxstr = outstr;
306 #include "xlat/v4l2_buf_flags.h"
309 print_v4l2_buffer(struct tcb *tcp, const unsigned int code, const long arg)
311 struct v4l2_buffer b;
315 if (umove_or_printaddr(tcp, arg, &b))
316 return RVAL_DECODED | 1;
318 printxval(v4l2_buf_types, b.type, "V4L2_BUF_TYPE_???");
319 if (code != VIDIOC_DQBUF)
320 tprintf(", index=%u", b.index);
322 if (!syserror(tcp) && umove(tcp, arg, &b) == 0) {
323 if (code == VIDIOC_DQBUF)
324 tprintf(", index=%u", b.index);
325 tprints(", memory=");
326 printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
328 if (b.memory == V4L2_MEMORY_MMAP) {
329 tprintf(", m.offset=%#x", b.m.offset);
330 } else if (b.memory == V4L2_MEMORY_USERPTR) {
331 tprintf(", m.userptr=%#lx",
332 (unsigned long) b.m.userptr);
335 tprintf(", length=%u, bytesused=%u, flags=",
336 b.length, b.bytesused);
337 printflags(v4l2_buf_flags, b.flags, "V4L2_BUF_FLAG_???");
338 if (code == VIDIOC_DQBUF)
339 tprintf(", timestamp = {%ju.%06ju}",
340 (uintmax_t)b.timestamp.tv_sec,
341 (uintmax_t)b.timestamp.tv_usec);
350 print_v4l2_framebuffer(struct tcb *tcp, const long arg)
352 struct v4l2_framebuffer b;
355 if (!umove_or_printaddr(tcp, arg, &b)) {
356 tprintf("{capability=%#x, flags=%#x, base=%#lx}",
357 b.capability, b.flags, (unsigned long) b.base);
360 return RVAL_DECODED | 1;
364 print_v4l2_buf_type(struct tcb *tcp, const long arg)
369 if (!umove_or_printaddr(tcp, arg, &type)) {
371 printxval(v4l2_buf_types, type, "V4L2_BUF_TYPE_???");
374 return RVAL_DECODED | 1;
377 #include "xlat/v4l2_streaming_capabilities.h"
378 #include "xlat/v4l2_capture_modes.h"
381 print_v4l2_streamparm(struct tcb *tcp, const long arg, const bool is_get)
383 struct v4l2_streamparm s;
387 if (umove_or_printaddr(tcp, arg, &s))
388 return RVAL_DECODED | 1;
390 printxval(v4l2_buf_types, s.type, "V4L2_BUF_TYPE_???");
392 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
393 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
400 return RVAL_DECODED | 1;
403 if (syserror(tcp) || umove(tcp, arg, &s) < 0) {
407 tprints(is_get ? ", " : " => ");
410 if (s.type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
411 tprints("parm.capture={capability=");
412 printflags(v4l2_streaming_capabilities,
413 s.parm.capture.capability, "V4L2_CAP_???");
415 tprints(", capturemode=");
416 printflags(v4l2_capture_modes,
417 s.parm.capture.capturemode, "V4L2_MODE_???");
419 tprintf(", timeperframe=" FMT_FRACT,
420 ARGS_FRACT(s.parm.capture.timeperframe));
422 tprintf(", extendedmode=%u, readbuffers=%u}",
423 s.parm.capture.extendedmode,
424 s.parm.capture.readbuffers);
426 tprints("parm.output={capability=");
427 printflags(v4l2_streaming_capabilities,
428 s.parm.output.capability, "V4L2_CAP_???");
430 tprintf(", outputmode=%u", s.parm.output.outputmode);
432 tprintf(", timeperframe=" FMT_FRACT,
433 ARGS_FRACT(s.parm.output.timeperframe));
435 tprintf(", extendedmode=%u, writebuffers=%u}",
436 s.parm.output.extendedmode,
437 s.parm.output.writebuffers);
445 print_v4l2_standard(struct tcb *tcp, const long arg)
447 struct v4l2_standard s;
451 if (umove_or_printaddr(tcp, arg, &s))
452 return RVAL_DECODED | 1;
453 tprintf("{index=%u", s.index);
455 if (!syserror(tcp) && !umove(tcp, arg, &s)) {
457 print_quoted_string((const char *) s.name,
460 tprintf(", frameperiod=" FMT_FRACT,
461 ARGS_FRACT(s.frameperiod));
462 tprintf(", framelines=%d", s.framelines);
469 #include "xlat/v4l2_input_types.h"
472 print_v4l2_input(struct tcb *tcp, const long arg)
478 if (umove_or_printaddr(tcp, arg, &i))
479 return RVAL_DECODED | 1;
480 tprintf("{index=%u", i.index);
482 if (!syserror(tcp) && !umove(tcp, arg, &i)) {
484 print_quoted_string((const char *) i.name,
488 printxval(v4l2_input_types, i.type,
489 "V4L2_INPUT_TYPE_???");
496 #include "xlat/v4l2_control_ids.h"
499 print_v4l2_control(struct tcb *tcp, const long arg, const bool is_get)
501 struct v4l2_control c;
505 if (umove_or_printaddr(tcp, arg, &c))
506 return RVAL_DECODED | 1;
508 printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
510 tprintf(", value=%d", c.value);
514 if (!syserror(tcp) && !umove(tcp, arg, &c)) {
515 tprints(is_get ? ", " : " => ");
516 tprintf("value=%d", c.value);
523 #include "xlat/v4l2_control_types.h"
524 #include "xlat/v4l2_control_flags.h"
527 print_v4l2_queryctrl(struct tcb *tcp, const long arg)
529 struct v4l2_queryctrl c;
533 if (umove_or_printaddr(tcp, arg, &c))
534 return RVAL_DECODED | 1;
537 if (syserror(tcp) || umove(tcp, arg, &c) < 0) {
545 if (entering(tcp) || tcp->auxstr) {
546 #ifdef V4L2_CTRL_FLAG_NEXT_CTRL
547 tcp->auxstr = (c.id & V4L2_CTRL_FLAG_NEXT_CTRL) ? "" : NULL;
549 tprints("V4L2_CTRL_FLAG_NEXT_CTRL|");
550 c.id &= ~V4L2_CTRL_FLAG_NEXT_CTRL;
553 printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
558 printxval(v4l2_control_types, c.type, "V4L2_CTRL_TYPE_???");
560 print_quoted_string((const char *) c.name,
563 tprintf(", minimum=%d, maximum=%d, step=%d"
564 ", default_value=%d, flags=",
565 c.minimum, c.maximum, c.step, c.default_value);
566 printflags(v4l2_control_flags, c.flags, "V4L2_CTRL_FLAG_???");
573 print_v4l2_cropcap(struct tcb *tcp, const long arg)
575 struct v4l2_cropcap c;
579 if (umove_or_printaddr(tcp, arg, &c))
580 return RVAL_DECODED | 1;
582 printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???");
585 if (!syserror(tcp) && !umove(tcp, arg, &c)) {
586 tprintf(", bounds=" FMT_RECT
587 ", defrect=" FMT_RECT
588 ", pixelaspect=" FMT_FRACT,
590 ARGS_RECT(c.defrect),
591 ARGS_FRACT(c.pixelaspect));
598 print_v4l2_crop(struct tcb *tcp, const long arg, const bool is_get)
604 if (umove_or_printaddr(tcp, arg, &c))
605 return RVAL_DECODED | 1;
607 printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???");
610 tprintf(", c=" FMT_RECT, ARGS_RECT(c.c));
612 if (!syserror(tcp) && !umove(tcp, arg, &c))
613 tprintf(", c=" FMT_RECT, ARGS_RECT(c.c));
617 return RVAL_DECODED | 1;
620 #ifdef VIDIOC_S_EXT_CTRLS
622 print_v4l2_ext_control_array(struct tcb *tcp, const unsigned long addr,
623 const unsigned count)
625 struct v4l2_ext_control ctrl;
626 const unsigned long size = count * sizeof(ctrl);
627 const unsigned long end = addr + size;
630 if (!addr || end <= addr || size / sizeof(ctrl) != count) {
634 const unsigned long abbrev_end =
635 (abbrev(tcp) && max_strlen < count) ?
636 addr + max_strlen * sizeof(ctrl) : end;
638 for (cur = addr; cur < end; cur += sizeof(ctrl)) {
642 if (umove(tcp, cur, &ctrl)) {
651 if (cur >= abbrev_end) {
658 printxval(v4l2_control_ids, ctrl.id, "V4L2_CID_???");
659 # if HAVE_DECL_V4L2_CTRL_TYPE_STRING
660 tprintf(", size=%u", ctrl.size);
662 tprints(", string=");
663 printstr(tcp, (long) ctrl.string, ctrl.size);
666 tprintf(", value=%d, value64=%lld", ctrl.value,
667 (long long) ctrl.value64);
675 #include "xlat/v4l2_control_classes.h"
678 print_v4l2_ext_controls(struct tcb *tcp, const long arg, const bool is_get)
680 struct v4l2_ext_controls c;
684 if (umove_or_printaddr(tcp, arg, &c))
685 return RVAL_DECODED | 1;
686 tprints("{ctrl_class=");
687 printxval(v4l2_control_classes, c.ctrl_class,
688 "V4L2_CTRL_CLASS_???");
689 tprintf(", count=%u", c.count);
692 return RVAL_DECODED | 1;
698 if (umove(tcp, arg, &c) < 0) {
702 tprints(is_get ? ", " : " => ");
705 tprints("controls=");
706 int fail = print_v4l2_ext_control_array(tcp,
707 (unsigned long) c.controls,
710 if (exiting(tcp) && syserror(tcp))
711 tprintf(", error_idx=%u", c.error_idx);
713 if (exiting(tcp) || fail) {
715 return RVAL_DECODED | 1;
719 #endif /* VIDIOC_S_EXT_CTRLS */
721 #ifdef VIDIOC_ENUM_FRAMESIZES
722 # include "xlat/v4l2_framesize_types.h"
725 print_v4l2_frmsizeenum(struct tcb *tcp, const long arg)
727 struct v4l2_frmsizeenum s;
731 if (umove_or_printaddr(tcp, arg, &s))
732 return RVAL_DECODED | 1;
733 tprintf("{index=%u, pixel_format=", s.index);
734 print_pixelformat(s.pixel_format);
738 if (!syserror(tcp) && !umove(tcp, arg, &s)) {
740 printxval(v4l2_framesize_types, s.type, "V4L2_FRMSIZE_TYPE_???");
742 case V4L2_FRMSIZE_TYPE_DISCRETE:
743 tprintf(", discrete={width=%u, height=%u}",
744 s.discrete.width, s.discrete.height);
746 case V4L2_FRMSIZE_TYPE_STEPWISE:
747 tprintf(", stepwise={min_width=%u, max_width=%u, "
748 "step_width=%u, min_height=%u, max_height=%u, "
750 s.stepwise.min_width, s.stepwise.max_width,
751 s.stepwise.step_width, s.stepwise.min_height,
752 s.stepwise.max_height, s.stepwise.step_height);
759 #endif /* VIDIOC_ENUM_FRAMESIZES */
761 #ifdef VIDIOC_ENUM_FRAMEINTERVALS
762 # include "xlat/v4l2_frameinterval_types.h"
765 print_v4l2_frmivalenum(struct tcb *tcp, const long arg)
767 struct v4l2_frmivalenum f;
771 if (umove_or_printaddr(tcp, arg, &f))
772 return RVAL_DECODED | 1;
773 tprintf("{index=%u, pixel_format=", f.index);
774 print_pixelformat(f.pixel_format);
775 tprintf(", width=%u, height=%u", f.width, f.height);
778 if (!syserror(tcp) && !umove(tcp, arg, &f)) {
780 printxval(v4l2_frameinterval_types, f.type,
781 "V4L2_FRMIVAL_TYPE_???");
783 case V4L2_FRMIVAL_TYPE_DISCRETE:
784 tprintf(", discrete=" FMT_FRACT,
785 ARGS_FRACT(f.discrete));
787 case V4L2_FRMIVAL_TYPE_STEPWISE:
788 case V4L2_FRMSIZE_TYPE_CONTINUOUS:
789 tprintf(", stepwise={min=" FMT_FRACT ", max="
790 FMT_FRACT ", step=" FMT_FRACT "}",
791 ARGS_FRACT(f.stepwise.min),
792 ARGS_FRACT(f.stepwise.max),
793 ARGS_FRACT(f.stepwise.step));
800 #endif /* VIDIOC_ENUM_FRAMEINTERVALS */
802 #ifdef VIDIOC_CREATE_BUFS
804 print_v4l2_create_buffers(struct tcb *tcp, const long arg)
806 struct v4l2_create_buffers b;
810 if (umove_or_printaddr(tcp, arg, &b))
811 return RVAL_DECODED | 1;
812 tprintf("{count=%u, memory=", b.count);
813 printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
814 tprints(", format={type=");
815 printxval(v4l2_buf_types, b.format.type,
816 "V4L2_BUF_TYPE_???");
817 print_v4l2_format_fmt(", ",
818 (struct v4l2_format *) &b.format);
822 static const char fmt[] = "{index=%u, count=%u}";
823 static char outstr[sizeof(fmt) + sizeof(int) * 6];
825 if (syserror(tcp) || umove(tcp, arg, &b) < 0)
827 sprintf(outstr, fmt, b.index, b.count);
828 tcp->auxstr = outstr;
832 #endif /* VIDIOC_CREATE_BUFS */
835 v4l2_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
841 case VIDIOC_QUERYCAP: /* R */
842 return print_v4l2_capability(tcp, arg);
844 case VIDIOC_ENUM_FMT: /* RW */
845 return print_v4l2_fmtdesc(tcp, arg);
847 case VIDIOC_G_FMT: /* RW */
848 case VIDIOC_S_FMT: /* RW */
849 case VIDIOC_TRY_FMT: /* RW */
850 return print_v4l2_format(tcp, arg, code == VIDIOC_G_FMT);
852 case VIDIOC_REQBUFS: /* RW */
853 return print_v4l2_requestbuffers(tcp, arg);
855 case VIDIOC_QUERYBUF: /* RW */
856 case VIDIOC_QBUF: /* RW */
857 case VIDIOC_DQBUF: /* RW */
858 return print_v4l2_buffer(tcp, code, arg);
860 case VIDIOC_G_FBUF: /* R */
864 case VIDIOC_S_FBUF: /* W */
865 return print_v4l2_framebuffer(tcp, arg);
867 case VIDIOC_STREAMON: /* W */
868 case VIDIOC_STREAMOFF: /* W */
869 return print_v4l2_buf_type(tcp, arg);
871 case VIDIOC_G_PARM: /* RW */
872 case VIDIOC_S_PARM: /* RW */
873 return print_v4l2_streamparm(tcp, arg, code == VIDIOC_G_PARM);
875 case VIDIOC_G_STD: /* R */
879 case VIDIOC_S_STD: /* W */
881 printnum_int64(tcp, arg, "%#" PRIx64);
882 return RVAL_DECODED | 1;
884 case VIDIOC_ENUMSTD: /* RW */
885 return print_v4l2_standard(tcp, arg);
887 case VIDIOC_ENUMINPUT: /* RW */
888 return print_v4l2_input(tcp, arg);
890 case VIDIOC_G_CTRL: /* RW */
891 case VIDIOC_S_CTRL: /* RW */
892 return print_v4l2_control(tcp, arg, code == VIDIOC_G_CTRL);
894 case VIDIOC_QUERYCTRL: /* RW */
895 return print_v4l2_queryctrl(tcp, arg);
897 case VIDIOC_G_INPUT: /* R */
901 case VIDIOC_S_INPUT: /* RW */
903 printnum_int(tcp, arg, "%u");
904 return RVAL_DECODED | 1;
906 case VIDIOC_CROPCAP: /* RW */
907 return print_v4l2_cropcap(tcp, arg);
909 case VIDIOC_G_CROP: /* RW */
910 case VIDIOC_S_CROP: /* W */
911 return print_v4l2_crop(tcp, arg, code == VIDIOC_G_CROP);
913 #ifdef VIDIOC_S_EXT_CTRLS
914 case VIDIOC_S_EXT_CTRLS: /* RW */
915 case VIDIOC_TRY_EXT_CTRLS: /* RW */
916 case VIDIOC_G_EXT_CTRLS: /* RW */
917 return print_v4l2_ext_controls(tcp, arg,
918 code == VIDIOC_G_EXT_CTRLS);
919 #endif /* VIDIOC_S_EXT_CTRLS */
921 #ifdef VIDIOC_ENUM_FRAMESIZES
922 case VIDIOC_ENUM_FRAMESIZES: /* RW */
923 return print_v4l2_frmsizeenum(tcp, arg);
924 #endif /* VIDIOC_ENUM_FRAMESIZES */
926 #ifdef VIDIOC_ENUM_FRAMEINTERVALS
927 case VIDIOC_ENUM_FRAMEINTERVALS: /* RW */
928 return print_v4l2_frmivalenum(tcp, arg);
929 #endif /* VIDIOC_ENUM_FRAMEINTERVALS */
931 #ifdef VIDIOC_CREATE_BUFS
932 case VIDIOC_CREATE_BUFS: /* RW */
933 return print_v4l2_create_buffers(tcp, arg);
934 #endif /* VIDIOC_CREATE_BUFS */