Commit Graph

15 Commits

Author SHA1 Message Date
17d1a1633d v4l2.c: use print_array function
* v4l2.c (print_v4l2_ext_control, umoven_or_printaddr_ignore_syserror):
New functions.
(print_v4l2_ext_controls): Use them via print_array.
2016-05-07 23:37:53 +00:00
1e56814f77 Mpersify VIDIOC_* ioctl parser
* v4l2.c: Mpersify arch-specific structures.
(v4l2_ioctl): Mpersify.
* tests/ioctl_v4l2.c: New file.
* tests/ioctl_v4l2.test: New test.
* tests/.gitignore: Add ioctl_v4l2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_v4l2.test.
2016-05-05 21:20:56 +00:00
0a47ff79ca Fix decoding of VIDIOC_* ioctls
* v4l2.c: Fix numerous bugs in decoding of VIDIOC_* ioctls.
* tests/ioctl.c (main): Update.
2016-05-05 21:20:45 +00:00
fffe50d321 Fix build on systems that lack VIDIOC_CREATE_BUFS definition
* v4l2.c (v4l2_ioctl): Check that v4l2_ioctl is defined.
2015-08-26 11:55:05 +00:00
Philippe De Muyter
e459ba943e v4l2: add decoding for VIDIOC_S_CROP's arg
* v4l2.c (v4l2_ioctl): Add decoding for VIDIOC_S_CROP's arg.
2015-05-21 17:48:38 +00:00
Philippe De Muyter
86b4fb5bc5 v4l2: VIDIOC_CROPCAP: add missing braces around arg printout
* v4l2.c (v4l2_ioctl): case VIDIOC_CROPCAP: add missing braces around arg
printout.
2015-05-19 22:31:10 +00:00
Philippe De Muyter
6779e71acc v4l2: add decoding for VIDIOC_CREATE_BUFS's arg.
* v4l2.c (v4l2_ioctl): Add decoding for VIDIOC_CREATE_BUFS's arg.
2015-04-18 13:26:48 +00:00
Mike Frysinger
bfe6d04d9c v4l2: use uintmax_t for times
There is no guarantee that the backing value for the various time fields
are ints or longs which makes printfs annoying.  Lets cast them to the
uintmax_t type so we can use the j flag and not worry about truncation.

* v4l2.c (v4l2_ioctl): Use j and uintmax_t when printing tv_sec/tv_usec.
2015-02-26 20:00:03 +00:00
d67ba3e434 Fix compilation warnings about incompatible print formats
On some platforms printing of __s64 types with "%lld" format,
or __u64 types with "%llu" or "%llx" formats causes a warning
that __s64/__u64 type is not compatible with long long format.
From my PoV, this is nonsense, but the workaround costs nothing.

* scsi.c (print_sg_io_v4_req, print_sg_io_v4_res): Cast __u64 types
to (unsigned long long).
* v4l2.c (v4l2_ioctl): Likewise.  Cast __s64 type to (long long).
2015-02-23 22:19:19 +00:00
0f4ad30bdc Fix build with old kernel headers
* strace.c (print_debug_info, maybe_allocate_tcb, print_signalled,
print_exited): Remove "const" qualifier from status variable to
workaround some old implementations of WIFSIGNALED/WIFSTOPPED/WIFEXITED
macros.
* v4l2.c: Include <linux/types.h>.
(v4l2_ioctl): Check that V4L2_CTRL_FLAG_NEXT_CTRL and VIDIOC_S_EXT_CTRLS
macros are defined.
* tests/Makefile.am (AM_CPPFLAGS): Define.
2015-02-22 02:29:54 +00:00
f0a5b083c9 v4l2: quote pixelformat
* v4l2.c (print_pixelformat): Output in quoted v4l2_fourcc() format.
2015-01-26 19:08:37 +00:00
1de59cf746 v4l2: quote strings
* v4l2.c (v4l2_ioctl): Print strings using print_quoted_string.
2015-01-26 19:08:37 +00:00
c7afb4881f ioctl: assume that all ioctl commands have unsigned int type
In linux, ioctl command number has a 32-bit unsigned integer type:
	fs/ioctl.c:SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
If the kernel completely ignores other bits on 64-bit architectures,
why should strace care?
Let's follow the kernel and treat it as unsigned int.

* defs.h (struct_ioctlent): Change "code" type to "unsigned int".
(ioctl_decode, ioctl_lookup, block_ioctl, loop_ioctl, mtd_ioctl,
ubi_ioctl, ptp_ioctl, scsi_ioctl, sock_ioctl, term_ioctl, rtc_ioctl,
v4l2_ioctl): Likewise.
* ioctl.c (ioctl_decode, ioctl_lookup, compare, ioctl_next_match):
Likewise.
* block.c (block_ioctl): Likewise.
* loop.c (loop_ioctl): Likewise.
* mtd.c (mtd_ioctl, ubi_ioctl): Likewise.
* ptp.c (ptp_ioctl): Likewise.
* scsi.c (scsi_ioctl): Likewise.
* sock.c (sock_ioctl): Likewise.
* term.c (term_ioctl): Likewise.
* time.c (rtc_ioctl): Likewise.
* v4l2.c (v4l2_ioctl): Likewise.
* ioctlsort.c (struct ioctlent, compare, main): Likewise.
2015-01-20 00:28:10 +00:00
197db577e8 v4l2: fix build on systems with older kernel headers
* v4l2.c (print_v4l2_format_fmt): Do not use
V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY unless it is defined.
(v4l2_ioctl): Do not use VIDIOC_ENUM_FRAMESIZES and
VIDIOC_ENUM_FRAMEINTERVALS unless they are defined.
2015-01-09 04:53:19 +00:00
Philippe De Muyter
0cc961440b Implement Video4Linux video-input ioctls decoder
Introduce v4l2.c, a decoder for the arguments of the video-input subset
of the v4l2 ioctl's.  This is a combination of
- previous work by Peter Zotov <whitequark@whitequark.org>, found at
https://gist.githubusercontent.com/whitequark/1263207/raw/strace-4.6-v4l2-ioctls.patch
- previous work by William Manley <will@williammanley.net>, found at
http://marc.info/?l=strace&m=139395588520675
- forward port, additions and fixes by Philippe De Muyter <phdm@macqel.be>

As v4l2 is a moving target, I have made v4l2.c compilable with ancient
linux kernels by testing the availability of some macros.  It has been
succesfully compiled on linux 3.10, 3.1, 2.6.31 and 2.6.22, and
succesfully used on linux 3.10 with a camera device.

* configure.ac: Check for availabilty of V4L2_* enum constants.
* Makefile.am (strace_SOURCES): Add v4l2.c.
* defs.h (v4l2_ioctl): New prototype.
* ioctl.c (ioctl_decode): Use v4l2_ioctl.
* v4l2.c: New file.
* xlat/v4l2_*.in: New files.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Cc: Peter Zotov <whitequark@whitequark.org>
Cc: William Manley <will@williammanley.net>
2014-11-04 15:27:31 +00:00