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 tprints(", m.userptr=");
363 printaddr((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=",
388 b.capability, b.flags);
389 printaddr((unsigned long) b.base);
393 return RVAL_DECODED | 1;
397 print_v4l2_buf_type(struct tcb *tcp, const long arg)
402 if (!umove_or_printaddr(tcp, arg, &type)) {
404 printxval(v4l2_buf_types, type, "V4L2_BUF_TYPE_???");
407 return RVAL_DECODED | 1;
410 #include "xlat/v4l2_streaming_capabilities.h"
411 #include "xlat/v4l2_capture_modes.h"
414 print_v4l2_streamparm(struct tcb *tcp, const long arg, const bool is_get)
416 struct v4l2_streamparm s;
420 if (umove_or_printaddr(tcp, arg, &s))
421 return RVAL_DECODED | 1;
423 printxval(v4l2_buf_types, s.type, "V4L2_BUF_TYPE_???");
425 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
426 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
433 return RVAL_DECODED | 1;
436 if (syserror(tcp) || umove(tcp, arg, &s) < 0) {
440 tprints(is_get ? ", " : " => ");
443 if (s.type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
444 tprints("parm.capture={capability=");
445 printflags(v4l2_streaming_capabilities,
446 s.parm.capture.capability, "V4L2_CAP_???");
448 tprints(", capturemode=");
449 printflags(v4l2_capture_modes,
450 s.parm.capture.capturemode, "V4L2_MODE_???");
452 tprintf(", timeperframe=" FMT_FRACT,
453 ARGS_FRACT(s.parm.capture.timeperframe));
455 tprintf(", extendedmode=%u, readbuffers=%u}",
456 s.parm.capture.extendedmode,
457 s.parm.capture.readbuffers);
459 tprints("parm.output={capability=");
460 printflags(v4l2_streaming_capabilities,
461 s.parm.output.capability, "V4L2_CAP_???");
463 tprintf(", outputmode=%u", s.parm.output.outputmode);
465 tprintf(", timeperframe=" FMT_FRACT,
466 ARGS_FRACT(s.parm.output.timeperframe));
468 tprintf(", extendedmode=%u, writebuffers=%u}",
469 s.parm.output.extendedmode,
470 s.parm.output.writebuffers);
478 print_v4l2_standard(struct tcb *tcp, const long arg)
480 struct_v4l2_standard s;
484 if (umove_or_printaddr(tcp, arg, &s))
485 return RVAL_DECODED | 1;
486 tprintf("{index=%u", s.index);
488 if (!syserror(tcp) && !umove(tcp, arg, &s)) {
490 print_quoted_string((const char *) s.name,
493 tprintf(", frameperiod=" FMT_FRACT,
494 ARGS_FRACT(s.frameperiod));
495 tprintf(", framelines=%d", s.framelines);
502 #include "xlat/v4l2_input_types.h"
505 print_v4l2_input(struct tcb *tcp, const long arg)
511 if (umove_or_printaddr(tcp, arg, &i))
512 return RVAL_DECODED | 1;
513 tprintf("{index=%u", i.index);
515 if (!syserror(tcp) && !umove(tcp, arg, &i)) {
517 print_quoted_string((const char *) i.name,
521 printxval(v4l2_input_types, i.type,
522 "V4L2_INPUT_TYPE_???");
529 #include "xlat/v4l2_control_ids.h"
532 print_v4l2_control(struct tcb *tcp, const long arg, const bool is_get)
534 struct v4l2_control c;
538 if (umove_or_printaddr(tcp, arg, &c))
539 return RVAL_DECODED | 1;
541 printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
543 tprintf(", value=%d", c.value);
547 if (!syserror(tcp) && !umove(tcp, arg, &c)) {
548 tprints(is_get ? ", " : " => ");
549 tprintf("value=%d", c.value);
556 #include "xlat/v4l2_control_types.h"
557 #include "xlat/v4l2_control_flags.h"
560 print_v4l2_queryctrl(struct tcb *tcp, const long arg)
562 struct v4l2_queryctrl c;
566 if (umove_or_printaddr(tcp, arg, &c))
567 return RVAL_DECODED | 1;
570 if (syserror(tcp) || umove(tcp, arg, &c) < 0) {
574 if (get_tcb_priv_ulong(tcp))
578 if (entering(tcp) || get_tcb_priv_ulong(tcp)) {
579 #ifdef V4L2_CTRL_FLAG_NEXT_CTRL
580 const unsigned long next = c.id & V4L2_CTRL_FLAG_NEXT_CTRL;
581 set_tcb_priv_ulong(tcp, next);
583 tprints("V4L2_CTRL_FLAG_NEXT_CTRL|");
584 c.id &= ~V4L2_CTRL_FLAG_NEXT_CTRL;
587 printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
592 printxval(v4l2_control_types, c.type, "V4L2_CTRL_TYPE_???");
594 print_quoted_string((const char *) c.name,
597 tprintf(", minimum=%d, maximum=%d, step=%d"
598 ", default_value=%d, flags=",
599 c.minimum, c.maximum, c.step, c.default_value);
600 printflags(v4l2_control_flags, c.flags, "V4L2_CTRL_FLAG_???");
607 print_v4l2_cropcap(struct tcb *tcp, const long arg)
609 struct v4l2_cropcap c;
613 if (umove_or_printaddr(tcp, arg, &c))
614 return RVAL_DECODED | 1;
616 printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???");
619 if (!syserror(tcp) && !umove(tcp, arg, &c)) {
620 tprintf(", bounds=" FMT_RECT
621 ", defrect=" FMT_RECT
622 ", pixelaspect=" FMT_FRACT,
624 ARGS_RECT(c.defrect),
625 ARGS_FRACT(c.pixelaspect));
632 print_v4l2_crop(struct tcb *tcp, const long arg, const bool is_get)
638 if (umove_or_printaddr(tcp, arg, &c))
639 return RVAL_DECODED | 1;
641 printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???");
644 tprintf(", c=" FMT_RECT, ARGS_RECT(c.c));
646 if (!syserror(tcp) && !umove(tcp, arg, &c))
647 tprintf(", c=" FMT_RECT, ARGS_RECT(c.c));
651 return RVAL_DECODED | 1;
654 #ifdef VIDIOC_S_EXT_CTRLS
656 print_v4l2_ext_control(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
658 const struct_v4l2_ext_control *p = elem_buf;
661 printxval(v4l2_control_ids, p->id, "V4L2_CID_???");
662 # if HAVE_DECL_V4L2_CTRL_TYPE_STRING
663 tprintf(", size=%u", p->size);
665 tprints(", string=");
666 printstr(tcp, (long) p->string, p->size);
669 tprintf(", value=%d, value64=%lld", p->value,
670 (long long) p->value64);
676 #include "xlat/v4l2_control_classes.h"
679 umoven_or_printaddr_ignore_syserror(struct tcb *tcp, const long addr,
680 const unsigned int len, void *our_addr)
682 if (!addr || umoven(tcp, addr, len, our_addr) < 0) {
690 print_v4l2_ext_controls(struct tcb *tcp, const long arg, const bool is_get)
692 struct_v4l2_ext_controls c;
696 if (umove_or_printaddr(tcp, arg, &c))
697 return RVAL_DECODED | 1;
698 tprints("{ctrl_class=");
699 printxval(v4l2_control_classes, c.ctrl_class,
700 "V4L2_CTRL_CLASS_???");
701 tprintf(", count=%u", c.count);
704 return RVAL_DECODED | 1;
710 if (umove(tcp, arg, &c) < 0) {
714 tprints(is_get ? ", " : " => ");
717 tprints("controls=");
718 struct_v4l2_ext_control ctrl;
719 bool fail = !print_array(tcp, (unsigned long) c.controls, c.count,
721 umoven_or_printaddr_ignore_syserror,
722 print_v4l2_ext_control, 0);
724 if (exiting(tcp) && syserror(tcp))
725 tprintf(", error_idx=%u", c.error_idx);
727 if (exiting(tcp) || fail) {
729 return RVAL_DECODED | 1;
733 #endif /* VIDIOC_S_EXT_CTRLS */
735 #ifdef VIDIOC_ENUM_FRAMESIZES
736 # include "xlat/v4l2_framesize_types.h"
739 print_v4l2_frmsizeenum(struct tcb *tcp, const long arg)
741 struct v4l2_frmsizeenum s;
745 if (umove_or_printaddr(tcp, arg, &s))
746 return RVAL_DECODED | 1;
747 tprintf("{index=%u, pixel_format=", s.index);
748 print_pixelformat(s.pixel_format);
752 if (!syserror(tcp) && !umove(tcp, arg, &s)) {
754 printxval(v4l2_framesize_types, s.type, "V4L2_FRMSIZE_TYPE_???");
756 case V4L2_FRMSIZE_TYPE_DISCRETE:
757 tprintf(", discrete={width=%u, height=%u}",
758 s.discrete.width, s.discrete.height);
760 case V4L2_FRMSIZE_TYPE_STEPWISE:
761 tprintf(", stepwise={min_width=%u, max_width=%u, "
762 "step_width=%u, min_height=%u, max_height=%u, "
764 s.stepwise.min_width, s.stepwise.max_width,
765 s.stepwise.step_width, s.stepwise.min_height,
766 s.stepwise.max_height, s.stepwise.step_height);
773 #endif /* VIDIOC_ENUM_FRAMESIZES */
775 #ifdef VIDIOC_ENUM_FRAMEINTERVALS
776 # include "xlat/v4l2_frameinterval_types.h"
779 print_v4l2_frmivalenum(struct tcb *tcp, const long arg)
781 struct v4l2_frmivalenum f;
785 if (umove_or_printaddr(tcp, arg, &f))
786 return RVAL_DECODED | 1;
787 tprintf("{index=%u, pixel_format=", f.index);
788 print_pixelformat(f.pixel_format);
789 tprintf(", width=%u, height=%u", f.width, f.height);
792 if (!syserror(tcp) && !umove(tcp, arg, &f)) {
794 printxval(v4l2_frameinterval_types, f.type,
795 "V4L2_FRMIVAL_TYPE_???");
797 case V4L2_FRMIVAL_TYPE_DISCRETE:
798 tprintf(", discrete=" FMT_FRACT,
799 ARGS_FRACT(f.discrete));
801 case V4L2_FRMIVAL_TYPE_STEPWISE:
802 case V4L2_FRMSIZE_TYPE_CONTINUOUS:
803 tprintf(", stepwise={min=" FMT_FRACT ", max="
804 FMT_FRACT ", step=" FMT_FRACT "}",
805 ARGS_FRACT(f.stepwise.min),
806 ARGS_FRACT(f.stepwise.max),
807 ARGS_FRACT(f.stepwise.step));
814 #endif /* VIDIOC_ENUM_FRAMEINTERVALS */
816 #ifdef VIDIOC_CREATE_BUFS
818 print_v4l2_create_buffers(struct tcb *tcp, const long arg)
820 struct_v4l2_create_buffers b;
824 if (umove_or_printaddr(tcp, arg, &b))
825 return RVAL_DECODED | 1;
826 tprintf("{count=%u, memory=", b.count);
827 printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
828 tprints(", format={type=");
829 printxval(v4l2_buf_types, b.format.type,
830 "V4L2_BUF_TYPE_???");
831 print_v4l2_format_fmt(", ",
832 (struct_v4l2_format *) &b.format);
836 static const char fmt[] = "{index=%u, count=%u}";
837 static char outstr[sizeof(fmt) + sizeof(int) * 6];
839 if (syserror(tcp) || umove(tcp, arg, &b) < 0)
841 sprintf(outstr, fmt, b.index, b.count);
842 tcp->auxstr = outstr;
846 #endif /* VIDIOC_CREATE_BUFS */
848 MPERS_PRINTER_DECL(int, v4l2_ioctl,
849 struct tcb *tcp, const unsigned int code, const long arg)
855 case VIDIOC_QUERYCAP: /* R */
856 return print_v4l2_capability(tcp, arg);
858 case VIDIOC_ENUM_FMT: /* RW */
859 return print_v4l2_fmtdesc(tcp, arg);
861 case VIDIOC_G_FMT: /* RW */
862 case VIDIOC_S_FMT: /* RW */
863 case VIDIOC_TRY_FMT: /* RW */
864 return print_v4l2_format(tcp, arg, code == VIDIOC_G_FMT);
866 case VIDIOC_REQBUFS: /* RW */
867 return print_v4l2_requestbuffers(tcp, arg);
869 case VIDIOC_QUERYBUF: /* RW */
870 case VIDIOC_QBUF: /* RW */
871 case VIDIOC_DQBUF: /* RW */
872 return print_v4l2_buffer(tcp, code, arg);
874 case VIDIOC_G_FBUF: /* R */
878 case VIDIOC_S_FBUF: /* W */
879 return print_v4l2_framebuffer(tcp, arg);
881 case VIDIOC_STREAMON: /* W */
882 case VIDIOC_STREAMOFF: /* W */
883 return print_v4l2_buf_type(tcp, arg);
885 case VIDIOC_G_PARM: /* RW */
886 case VIDIOC_S_PARM: /* RW */
887 return print_v4l2_streamparm(tcp, arg, code == VIDIOC_G_PARM);
889 case VIDIOC_G_STD: /* R */
893 case VIDIOC_S_STD: /* W */
895 printnum_int64(tcp, arg, "%#" PRIx64);
896 return RVAL_DECODED | 1;
898 case VIDIOC_ENUMSTD: /* RW */
899 return print_v4l2_standard(tcp, arg);
901 case VIDIOC_ENUMINPUT: /* RW */
902 return print_v4l2_input(tcp, arg);
904 case VIDIOC_G_CTRL: /* RW */
905 case VIDIOC_S_CTRL: /* RW */
906 return print_v4l2_control(tcp, arg, code == VIDIOC_G_CTRL);
908 case VIDIOC_QUERYCTRL: /* RW */
909 return print_v4l2_queryctrl(tcp, arg);
911 case VIDIOC_G_INPUT: /* R */
915 case VIDIOC_S_INPUT: /* RW */
917 printnum_int(tcp, arg, "%u");
918 return RVAL_DECODED | 1;
920 case VIDIOC_CROPCAP: /* RW */
921 return print_v4l2_cropcap(tcp, arg);
923 case VIDIOC_G_CROP: /* RW */
924 case VIDIOC_S_CROP: /* W */
925 return print_v4l2_crop(tcp, arg, code == VIDIOC_G_CROP);
927 #ifdef VIDIOC_S_EXT_CTRLS
928 case VIDIOC_S_EXT_CTRLS: /* RW */
929 case VIDIOC_TRY_EXT_CTRLS: /* RW */
930 case VIDIOC_G_EXT_CTRLS: /* RW */
931 return print_v4l2_ext_controls(tcp, arg,
932 code == VIDIOC_G_EXT_CTRLS);
933 #endif /* VIDIOC_S_EXT_CTRLS */
935 #ifdef VIDIOC_ENUM_FRAMESIZES
936 case VIDIOC_ENUM_FRAMESIZES: /* RW */
937 return print_v4l2_frmsizeenum(tcp, arg);
938 #endif /* VIDIOC_ENUM_FRAMESIZES */
940 #ifdef VIDIOC_ENUM_FRAMEINTERVALS
941 case VIDIOC_ENUM_FRAMEINTERVALS: /* RW */
942 return print_v4l2_frmivalenum(tcp, arg);
943 #endif /* VIDIOC_ENUM_FRAMEINTERVALS */
945 #ifdef VIDIOC_CREATE_BUFS
946 case VIDIOC_CREATE_BUFS: /* RW */
947 return print_v4l2_create_buffers(tcp, arg);
948 #endif /* VIDIOC_CREATE_BUFS */