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.
32 #include DEF_MPERS_TYPE(struct_v4l2_buffer)
33 #include DEF_MPERS_TYPE(struct_v4l2_create_buffers)
34 #include DEF_MPERS_TYPE(struct_v4l2_ext_control)
35 #include DEF_MPERS_TYPE(struct_v4l2_ext_controls)
36 #include DEF_MPERS_TYPE(struct_v4l2_format)
37 #include DEF_MPERS_TYPE(struct_v4l2_framebuffer)
38 #include DEF_MPERS_TYPE(struct_v4l2_input)
39 #include DEF_MPERS_TYPE(struct_v4l2_standard)
42 #include <linux/ioctl.h>
43 #include <linux/types.h>
44 #include <linux/videodev2.h>
46 typedef struct v4l2_buffer struct_v4l2_buffer;
47 typedef struct v4l2_create_buffers struct_v4l2_create_buffers;
48 typedef struct v4l2_ext_control struct_v4l2_ext_control;
49 typedef struct v4l2_ext_controls struct_v4l2_ext_controls;
50 typedef struct v4l2_format struct_v4l2_format;
51 typedef struct v4l2_framebuffer struct_v4l2_framebuffer;
52 typedef struct v4l2_input struct_v4l2_input;
53 typedef struct v4l2_standard struct_v4l2_standard;
57 /* some historical constants */
58 #ifndef V4L2_CID_HCENTER
59 #define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
61 #ifndef V4L2_CID_VCENTER
62 #define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
64 #ifndef V4L2_CID_BAND_STOP_FILTER
65 #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
68 #define FMT_FRACT "%u/%u"
69 #define ARGS_FRACT(x) ((x).numerator), ((x).denominator)
71 #define FMT_RECT "{left=%d, top=%d, width=%u, height=%u}"
72 #define ARGS_RECT(x) (x).left, (x).top, (x).width, (x).height
75 print_pixelformat(uint32_t fourcc)
79 unsigned char cc[sizeof(uint32_t)];
83 (unsigned char) (fourcc >> 24),
84 (unsigned char) (fourcc >> 16),
85 (unsigned char) (fourcc >> 8),
86 (unsigned char) fourcc
94 tprints("v4l2_fourcc(");
95 for (i = 0; i < sizeof(u.cc); ++i) {
96 unsigned char c = u.cc[i];
100 if (c == '\'' || c == '\\') {
109 } else if (c >= ' ' && c <= 0x7e) {
122 "0123456789abcdef"[c >> 4],
123 "0123456789abcdef"[c & 0xf],
133 #include "xlat/v4l2_device_capabilities_flags.h"
136 print_v4l2_capability(struct tcb *tcp, const long arg)
138 struct v4l2_capability caps;
143 if (umove_or_printaddr(tcp, arg, &caps))
146 print_quoted_string((const char *) caps.driver,
147 sizeof(caps.driver), QUOTE_0_TERMINATED);
149 print_quoted_string((const char *) caps.card,
150 sizeof(caps.card), QUOTE_0_TERMINATED);
151 tprints(", bus_info=");
152 print_quoted_string((const char *) caps.bus_info,
153 sizeof(caps.bus_info), QUOTE_0_TERMINATED);
154 tprintf(", version=%u.%u.%u, capabilities=",
155 (caps.version >> 16) & 0xFF,
156 (caps.version >> 8) & 0xFF,
157 caps.version & 0xFF);
158 printflags(v4l2_device_capabilities_flags, caps.capabilities,
160 #ifdef V4L2_CAP_DEVICE_CAPS
161 tprints(", device_caps=");
162 printflags(v4l2_device_capabilities_flags, caps.device_caps,
169 #include "xlat/v4l2_buf_types.h"
170 #include "xlat/v4l2_format_description_flags.h"
173 print_v4l2_fmtdesc(struct tcb *tcp, const long arg)
175 struct v4l2_fmtdesc f;
179 if (umove_or_printaddr(tcp, arg, &f))
180 return RVAL_DECODED | 1;
181 tprintf("{index=%u, type=", f.index);
182 printxval(v4l2_buf_types, f.type, "V4L2_BUF_TYPE_???");
186 if (!syserror(tcp) && !umove(tcp, arg, &f)) {
188 printflags(v4l2_format_description_flags, f.flags,
189 "V4L2_FMT_FLAG_???");
190 tprints(", description=");
191 print_quoted_string((const char *) f.description,
192 sizeof(f.description),
194 tprints(", pixelformat=");
195 print_pixelformat(f.pixelformat);
201 #include "xlat/v4l2_fields.h"
202 #include "xlat/v4l2_colorspaces.h"
205 print_v4l2_format_fmt(const char *prefix, const struct_v4l2_format *f)
208 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
209 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
211 tprintf("fmt.pix={width=%u, height=%u, pixelformat=",
212 f->fmt.pix.width, f->fmt.pix.height);
213 print_pixelformat(f->fmt.pix.pixelformat);
215 printxval(v4l2_fields, f->fmt.pix.field, "V4L2_FIELD_???");
216 tprintf(", bytesperline=%u, sizeimage=%u, colorspace=",
217 f->fmt.pix.bytesperline, f->fmt.pix.sizeimage);
218 printxval(v4l2_colorspaces, f->fmt.pix.colorspace,
219 "V4L2_COLORSPACE_???");
222 #if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
223 case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
224 case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: {
228 tprintf("fmt.pix_mp={width=%u, height=%u, pixelformat=",
229 f->fmt.pix_mp.width, f->fmt.pix_mp.height);
230 print_pixelformat(f->fmt.pix_mp.pixelformat);
232 printxval(v4l2_fields, f->fmt.pix_mp.field, "V4L2_FIELD_???");
233 tprints(", colorspace=");
234 printxval(v4l2_colorspaces, f->fmt.pix_mp.colorspace,
235 "V4L2_COLORSPACE_???");
236 tprints(", plane_fmt=[");
237 max = f->fmt.pix_mp.num_planes;
238 if (max > VIDEO_MAX_PLANES)
239 max = VIDEO_MAX_PLANES;
240 for (i = 0; i < max; i++) {
243 tprintf("{sizeimage=%u, bytesperline=%u}",
244 f->fmt.pix_mp.plane_fmt[i].sizeimage,
245 f->fmt.pix_mp.plane_fmt[i].bytesperline);
247 tprintf("], num_planes=%u}", (unsigned) f->fmt.pix_mp.num_planes);
252 /* TODO: Complete this switch statement */
254 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
255 #if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
256 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
259 tprints("fmt.win={???}");
262 case V4L2_BUF_TYPE_VBI_CAPTURE:
263 case V4L2_BUF_TYPE_VBI_OUTPUT:
265 tprints("fmt.vbi={???}");
268 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
269 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
271 tprints("fmt.sliced={???}");
274 #if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
275 case V4L2_BUF_TYPE_SDR_CAPTURE:
276 case V4L2_BUF_TYPE_SDR_OUTPUT:
278 tprints("fmt.sdr={???}");
286 print_v4l2_format(struct tcb *tcp, const long arg, const bool is_get)
288 struct_v4l2_format f;
292 if (umove_or_printaddr(tcp, arg, &f))
293 return RVAL_DECODED | 1;
295 printxval(v4l2_buf_types, f.type, "V4L2_BUF_TYPE_???");
298 print_v4l2_format_fmt(", ", &f);
300 if (!syserror(tcp) && !umove(tcp, arg, &f)) {
301 const char *delim = is_get ? ", " : " => ";
302 print_v4l2_format_fmt(delim, &f);
309 #include "xlat/v4l2_memories.h"
312 print_v4l2_requestbuffers(struct tcb *tcp, const long arg)
314 struct v4l2_requestbuffers reqbufs;
318 if (umove_or_printaddr(tcp, arg, &reqbufs))
319 return RVAL_DECODED | 1;
320 tprintf("{count=%u, type=", reqbufs.count);
321 printxval(v4l2_buf_types, reqbufs.type, "V4L2_BUF_TYPE_???");
322 tprints(", memory=");
323 printxval(v4l2_memories, reqbufs.memory, "V4L2_MEMORY_???");
327 static char outstr[sizeof("{count=}") + sizeof(int) * 3];
329 if (syserror(tcp) || umove(tcp, arg, &reqbufs) < 0)
331 sprintf(outstr, "{count=%u}", reqbufs.count);
332 tcp->auxstr = outstr;
337 #include "xlat/v4l2_buf_flags.h"
340 print_v4l2_buffer(struct tcb *tcp, const unsigned int code, const long arg)
342 struct_v4l2_buffer b;
346 if (umove_or_printaddr(tcp, arg, &b))
347 return RVAL_DECODED | 1;
349 printxval(v4l2_buf_types, b.type, "V4L2_BUF_TYPE_???");
350 if (code != VIDIOC_DQBUF)
351 tprintf(", index=%u", b.index);
353 if (!syserror(tcp) && umove(tcp, arg, &b) == 0) {
354 if (code == VIDIOC_DQBUF)
355 tprintf(", index=%u", b.index);
356 tprints(", memory=");
357 printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
359 if (b.memory == V4L2_MEMORY_MMAP) {
360 tprintf(", m.offset=%#x", b.m.offset);
361 } else if (b.memory == V4L2_MEMORY_USERPTR) {
362 tprintf(", m.userptr=%#lx",
363 (unsigned long) b.m.userptr);
366 tprintf(", length=%u, bytesused=%u, flags=",
367 b.length, b.bytesused);
368 printflags(v4l2_buf_flags, b.flags, "V4L2_BUF_FLAG_???");
369 if (code == VIDIOC_DQBUF)
370 tprintf(", timestamp = {%ju.%06ju}",
371 (uintmax_t)b.timestamp.tv_sec,
372 (uintmax_t)b.timestamp.tv_usec);
381 print_v4l2_framebuffer(struct tcb *tcp, const long arg)
383 struct_v4l2_framebuffer b;
386 if (!umove_or_printaddr(tcp, arg, &b)) {
387 tprintf("{capability=%#x, flags=%#x, base=%#lx}",
388 b.capability, b.flags, (unsigned long) b.base);
391 return RVAL_DECODED | 1;
395 print_v4l2_buf_type(struct tcb *tcp, const long arg)
400 if (!umove_or_printaddr(tcp, arg, &type)) {
402 printxval(v4l2_buf_types, type, "V4L2_BUF_TYPE_???");
405 return RVAL_DECODED | 1;
408 #include "xlat/v4l2_streaming_capabilities.h"
409 #include "xlat/v4l2_capture_modes.h"
412 print_v4l2_streamparm(struct tcb *tcp, const long arg, const bool is_get)
414 struct v4l2_streamparm s;
418 if (umove_or_printaddr(tcp, arg, &s))
419 return RVAL_DECODED | 1;
421 printxval(v4l2_buf_types, s.type, "V4L2_BUF_TYPE_???");
423 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
424 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
431 return RVAL_DECODED | 1;
434 if (syserror(tcp) || umove(tcp, arg, &s) < 0) {
438 tprints(is_get ? ", " : " => ");
441 if (s.type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
442 tprints("parm.capture={capability=");
443 printflags(v4l2_streaming_capabilities,
444 s.parm.capture.capability, "V4L2_CAP_???");
446 tprints(", capturemode=");
447 printflags(v4l2_capture_modes,
448 s.parm.capture.capturemode, "V4L2_MODE_???");
450 tprintf(", timeperframe=" FMT_FRACT,
451 ARGS_FRACT(s.parm.capture.timeperframe));
453 tprintf(", extendedmode=%u, readbuffers=%u}",
454 s.parm.capture.extendedmode,
455 s.parm.capture.readbuffers);
457 tprints("parm.output={capability=");
458 printflags(v4l2_streaming_capabilities,
459 s.parm.output.capability, "V4L2_CAP_???");
461 tprintf(", outputmode=%u", s.parm.output.outputmode);
463 tprintf(", timeperframe=" FMT_FRACT,
464 ARGS_FRACT(s.parm.output.timeperframe));
466 tprintf(", extendedmode=%u, writebuffers=%u}",
467 s.parm.output.extendedmode,
468 s.parm.output.writebuffers);
476 print_v4l2_standard(struct tcb *tcp, const long arg)
478 struct_v4l2_standard s;
482 if (umove_or_printaddr(tcp, arg, &s))
483 return RVAL_DECODED | 1;
484 tprintf("{index=%u", s.index);
486 if (!syserror(tcp) && !umove(tcp, arg, &s)) {
488 print_quoted_string((const char *) s.name,
491 tprintf(", frameperiod=" FMT_FRACT,
492 ARGS_FRACT(s.frameperiod));
493 tprintf(", framelines=%d", s.framelines);
500 #include "xlat/v4l2_input_types.h"
503 print_v4l2_input(struct tcb *tcp, const long arg)
509 if (umove_or_printaddr(tcp, arg, &i))
510 return RVAL_DECODED | 1;
511 tprintf("{index=%u", i.index);
513 if (!syserror(tcp) && !umove(tcp, arg, &i)) {
515 print_quoted_string((const char *) i.name,
519 printxval(v4l2_input_types, i.type,
520 "V4L2_INPUT_TYPE_???");
527 #include "xlat/v4l2_control_ids.h"
530 print_v4l2_control(struct tcb *tcp, const long arg, const bool is_get)
532 struct v4l2_control c;
536 if (umove_or_printaddr(tcp, arg, &c))
537 return RVAL_DECODED | 1;
539 printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
541 tprintf(", value=%d", c.value);
545 if (!syserror(tcp) && !umove(tcp, arg, &c)) {
546 tprints(is_get ? ", " : " => ");
547 tprintf("value=%d", c.value);
554 #include "xlat/v4l2_control_types.h"
555 #include "xlat/v4l2_control_flags.h"
558 print_v4l2_queryctrl(struct tcb *tcp, const long arg)
560 struct v4l2_queryctrl c;
564 if (umove_or_printaddr(tcp, arg, &c))
565 return RVAL_DECODED | 1;
568 if (syserror(tcp) || umove(tcp, arg, &c) < 0) {
576 if (entering(tcp) || tcp->auxstr) {
577 #ifdef V4L2_CTRL_FLAG_NEXT_CTRL
578 tcp->auxstr = (c.id & V4L2_CTRL_FLAG_NEXT_CTRL) ? "" : NULL;
580 tprints("V4L2_CTRL_FLAG_NEXT_CTRL|");
581 c.id &= ~V4L2_CTRL_FLAG_NEXT_CTRL;
584 printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
589 printxval(v4l2_control_types, c.type, "V4L2_CTRL_TYPE_???");
591 print_quoted_string((const char *) c.name,
594 tprintf(", minimum=%d, maximum=%d, step=%d"
595 ", default_value=%d, flags=",
596 c.minimum, c.maximum, c.step, c.default_value);
597 printflags(v4l2_control_flags, c.flags, "V4L2_CTRL_FLAG_???");
604 print_v4l2_cropcap(struct tcb *tcp, const long arg)
606 struct v4l2_cropcap c;
610 if (umove_or_printaddr(tcp, arg, &c))
611 return RVAL_DECODED | 1;
613 printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???");
616 if (!syserror(tcp) && !umove(tcp, arg, &c)) {
617 tprintf(", bounds=" FMT_RECT
618 ", defrect=" FMT_RECT
619 ", pixelaspect=" FMT_FRACT,
621 ARGS_RECT(c.defrect),
622 ARGS_FRACT(c.pixelaspect));
629 print_v4l2_crop(struct tcb *tcp, const long arg, const bool is_get)
635 if (umove_or_printaddr(tcp, arg, &c))
636 return RVAL_DECODED | 1;
638 printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???");
641 tprintf(", c=" FMT_RECT, ARGS_RECT(c.c));
643 if (!syserror(tcp) && !umove(tcp, arg, &c))
644 tprintf(", c=" FMT_RECT, ARGS_RECT(c.c));
648 return RVAL_DECODED | 1;
651 #ifdef VIDIOC_S_EXT_CTRLS
653 print_v4l2_ext_control(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
655 const struct_v4l2_ext_control *p = elem_buf;
658 printxval(v4l2_control_ids, p->id, "V4L2_CID_???");
659 # if HAVE_DECL_V4L2_CTRL_TYPE_STRING
660 tprintf(", size=%u", p->size);
662 tprints(", string=");
663 printstr(tcp, (long) p->string, p->size);
666 tprintf(", value=%d, value64=%lld", p->value,
667 (long long) p->value64);
673 #include "xlat/v4l2_control_classes.h"
676 umoven_or_printaddr_ignore_syserror(struct tcb *tcp, const long addr,
677 const unsigned int len, void *our_addr)
683 if (umoven(tcp, addr, len, our_addr) < 0) {
684 tprintf("%#lx", addr);
691 print_v4l2_ext_controls(struct tcb *tcp, const long arg, const bool is_get)
693 struct_v4l2_ext_controls c;
697 if (umove_or_printaddr(tcp, arg, &c))
698 return RVAL_DECODED | 1;
699 tprints("{ctrl_class=");
700 printxval(v4l2_control_classes, c.ctrl_class,
701 "V4L2_CTRL_CLASS_???");
702 tprintf(", count=%u", c.count);
705 return RVAL_DECODED | 1;
711 if (umove(tcp, arg, &c) < 0) {
715 tprints(is_get ? ", " : " => ");
718 tprints("controls=");
719 struct_v4l2_ext_control ctrl;
720 bool fail = !print_array(tcp, (unsigned long) c.controls, c.count,
722 umoven_or_printaddr_ignore_syserror,
723 print_v4l2_ext_control, 0);
725 if (exiting(tcp) && syserror(tcp))
726 tprintf(", error_idx=%u", c.error_idx);
728 if (exiting(tcp) || fail) {
730 return RVAL_DECODED | 1;
734 #endif /* VIDIOC_S_EXT_CTRLS */
736 #ifdef VIDIOC_ENUM_FRAMESIZES
737 # include "xlat/v4l2_framesize_types.h"
740 print_v4l2_frmsizeenum(struct tcb *tcp, const long arg)
742 struct v4l2_frmsizeenum s;
746 if (umove_or_printaddr(tcp, arg, &s))
747 return RVAL_DECODED | 1;
748 tprintf("{index=%u, pixel_format=", s.index);
749 print_pixelformat(s.pixel_format);
753 if (!syserror(tcp) && !umove(tcp, arg, &s)) {
755 printxval(v4l2_framesize_types, s.type, "V4L2_FRMSIZE_TYPE_???");
757 case V4L2_FRMSIZE_TYPE_DISCRETE:
758 tprintf(", discrete={width=%u, height=%u}",
759 s.discrete.width, s.discrete.height);
761 case V4L2_FRMSIZE_TYPE_STEPWISE:
762 tprintf(", stepwise={min_width=%u, max_width=%u, "
763 "step_width=%u, min_height=%u, max_height=%u, "
765 s.stepwise.min_width, s.stepwise.max_width,
766 s.stepwise.step_width, s.stepwise.min_height,
767 s.stepwise.max_height, s.stepwise.step_height);
774 #endif /* VIDIOC_ENUM_FRAMESIZES */
776 #ifdef VIDIOC_ENUM_FRAMEINTERVALS
777 # include "xlat/v4l2_frameinterval_types.h"
780 print_v4l2_frmivalenum(struct tcb *tcp, const long arg)
782 struct v4l2_frmivalenum f;
786 if (umove_or_printaddr(tcp, arg, &f))
787 return RVAL_DECODED | 1;
788 tprintf("{index=%u, pixel_format=", f.index);
789 print_pixelformat(f.pixel_format);
790 tprintf(", width=%u, height=%u", f.width, f.height);
793 if (!syserror(tcp) && !umove(tcp, arg, &f)) {
795 printxval(v4l2_frameinterval_types, f.type,
796 "V4L2_FRMIVAL_TYPE_???");
798 case V4L2_FRMIVAL_TYPE_DISCRETE:
799 tprintf(", discrete=" FMT_FRACT,
800 ARGS_FRACT(f.discrete));
802 case V4L2_FRMIVAL_TYPE_STEPWISE:
803 case V4L2_FRMSIZE_TYPE_CONTINUOUS:
804 tprintf(", stepwise={min=" FMT_FRACT ", max="
805 FMT_FRACT ", step=" FMT_FRACT "}",
806 ARGS_FRACT(f.stepwise.min),
807 ARGS_FRACT(f.stepwise.max),
808 ARGS_FRACT(f.stepwise.step));
815 #endif /* VIDIOC_ENUM_FRAMEINTERVALS */
817 #ifdef VIDIOC_CREATE_BUFS
819 print_v4l2_create_buffers(struct tcb *tcp, const long arg)
821 struct_v4l2_create_buffers b;
825 if (umove_or_printaddr(tcp, arg, &b))
826 return RVAL_DECODED | 1;
827 tprintf("{count=%u, memory=", b.count);
828 printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
829 tprints(", format={type=");
830 printxval(v4l2_buf_types, b.format.type,
831 "V4L2_BUF_TYPE_???");
832 print_v4l2_format_fmt(", ",
833 (struct_v4l2_format *) &b.format);
837 static const char fmt[] = "{index=%u, count=%u}";
838 static char outstr[sizeof(fmt) + sizeof(int) * 6];
840 if (syserror(tcp) || umove(tcp, arg, &b) < 0)
842 sprintf(outstr, fmt, b.index, b.count);
843 tcp->auxstr = outstr;
847 #endif /* VIDIOC_CREATE_BUFS */
849 MPERS_PRINTER_DECL(int, v4l2_ioctl,
850 struct tcb *tcp, const unsigned int code, const long arg)
856 case VIDIOC_QUERYCAP: /* R */
857 return print_v4l2_capability(tcp, arg);
859 case VIDIOC_ENUM_FMT: /* RW */
860 return print_v4l2_fmtdesc(tcp, arg);
862 case VIDIOC_G_FMT: /* RW */
863 case VIDIOC_S_FMT: /* RW */
864 case VIDIOC_TRY_FMT: /* RW */
865 return print_v4l2_format(tcp, arg, code == VIDIOC_G_FMT);
867 case VIDIOC_REQBUFS: /* RW */
868 return print_v4l2_requestbuffers(tcp, arg);
870 case VIDIOC_QUERYBUF: /* RW */
871 case VIDIOC_QBUF: /* RW */
872 case VIDIOC_DQBUF: /* RW */
873 return print_v4l2_buffer(tcp, code, arg);
875 case VIDIOC_G_FBUF: /* R */
879 case VIDIOC_S_FBUF: /* W */
880 return print_v4l2_framebuffer(tcp, arg);
882 case VIDIOC_STREAMON: /* W */
883 case VIDIOC_STREAMOFF: /* W */
884 return print_v4l2_buf_type(tcp, arg);
886 case VIDIOC_G_PARM: /* RW */
887 case VIDIOC_S_PARM: /* RW */
888 return print_v4l2_streamparm(tcp, arg, code == VIDIOC_G_PARM);
890 case VIDIOC_G_STD: /* R */
894 case VIDIOC_S_STD: /* W */
896 printnum_int64(tcp, arg, "%#" PRIx64);
897 return RVAL_DECODED | 1;
899 case VIDIOC_ENUMSTD: /* RW */
900 return print_v4l2_standard(tcp, arg);
902 case VIDIOC_ENUMINPUT: /* RW */
903 return print_v4l2_input(tcp, arg);
905 case VIDIOC_G_CTRL: /* RW */
906 case VIDIOC_S_CTRL: /* RW */
907 return print_v4l2_control(tcp, arg, code == VIDIOC_G_CTRL);
909 case VIDIOC_QUERYCTRL: /* RW */
910 return print_v4l2_queryctrl(tcp, arg);
912 case VIDIOC_G_INPUT: /* R */
916 case VIDIOC_S_INPUT: /* RW */
918 printnum_int(tcp, arg, "%u");
919 return RVAL_DECODED | 1;
921 case VIDIOC_CROPCAP: /* RW */
922 return print_v4l2_cropcap(tcp, arg);
924 case VIDIOC_G_CROP: /* RW */
925 case VIDIOC_S_CROP: /* W */
926 return print_v4l2_crop(tcp, arg, code == VIDIOC_G_CROP);
928 #ifdef VIDIOC_S_EXT_CTRLS
929 case VIDIOC_S_EXT_CTRLS: /* RW */
930 case VIDIOC_TRY_EXT_CTRLS: /* RW */
931 case VIDIOC_G_EXT_CTRLS: /* RW */
932 return print_v4l2_ext_controls(tcp, arg,
933 code == VIDIOC_G_EXT_CTRLS);
934 #endif /* VIDIOC_S_EXT_CTRLS */
936 #ifdef VIDIOC_ENUM_FRAMESIZES
937 case VIDIOC_ENUM_FRAMESIZES: /* RW */
938 return print_v4l2_frmsizeenum(tcp, arg);
939 #endif /* VIDIOC_ENUM_FRAMESIZES */
941 #ifdef VIDIOC_ENUM_FRAMEINTERVALS
942 case VIDIOC_ENUM_FRAMEINTERVALS: /* RW */
943 return print_v4l2_frmivalenum(tcp, arg);
944 #endif /* VIDIOC_ENUM_FRAMEINTERVALS */
946 #ifdef VIDIOC_CREATE_BUFS
947 case VIDIOC_CREATE_BUFS: /* RW */
948 return print_v4l2_create_buffers(tcp, arg);
949 #endif /* VIDIOC_CREATE_BUFS */