[PATCH] v4l2: Improve decoding of VIDIOC_QBUF's arg.
Philippe De Muyter
phdm at macqel.be
Fri May 22 07:22:22 UTC 2015
* v4l2.c (v4l2_ioctl): Improve decoding of VIDIOC_QBUF's arg.
---
v4l2.c | 38 +++++++++++++++++++++++++++-----------
1 file changed, 27 insertions(+), 11 deletions(-)
diff --git a/v4l2.c b/v4l2.c
index 6377717..6201ddc 100644
--- a/v4l2.c
+++ b/v4l2.c
@@ -646,6 +646,10 @@ v4l2_ioctl(struct tcb *tcp, const unsigned int code, long arg)
case VIDIOC_DQBUF: {
struct v4l2_buffer b;
+ if (exiting(tcp) && syserror(tcp)) {
+ tprints("}");
+ return 1;
+ }
if (umove(tcp, arg, &b) < 0)
return 0;
if (entering(tcp)) {
@@ -653,10 +657,22 @@ v4l2_ioctl(struct tcb *tcp, const unsigned int code, long arg)
printxval(v4l2_buf_types, b.type, "V4L2_BUF_TYPE_???");
if (code != VIDIOC_DQBUF)
tprintf(", index=%u", b.index);
+ if (code == VIDIOC_QBUF) {
+ tprints(", memory=");
+ printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
+ if (b.memory == V4L2_MEMORY_MMAP) {
+ tprintf(", m.offset=%#x", b.m.offset);
+ } else if (b.memory == V4L2_MEMORY_USERPTR) {
+ tprintf(", m.userptr=%#lx", b.m.userptr);
+ }
+ tprintf(", length=%u, bytesused=%u, flags=",
+ b.length, b.bytesused);
+ printflags(v4l2_buf_flags, b.flags, "V4L2_BUF_FLAG_???");
+ }
} else {
- if (!syserror(tcp)) {
- if (code == VIDIOC_DQBUF)
- tprintf(", index=%u", b.index);
+ if (code == VIDIOC_DQBUF)
+ tprintf(", index=%u", b.index);
+ if (code != VIDIOC_QBUF) {
tprints(", memory=");
printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
@@ -666,16 +682,16 @@ v4l2_ioctl(struct tcb *tcp, const unsigned int code, long arg)
tprintf(", m.userptr=%#lx", b.m.userptr);
}
- tprintf(", length=%u, bytesused=%u, flags=",
+ tprintf(", length=%u, bytesused=%u",
b.length, b.bytesused);
- printflags(v4l2_buf_flags, b.flags, "V4L2_BUF_FLAG_???");
- if (code == VIDIOC_DQBUF)
- tprintf(", timestamp = {%ju.%06ju}",
- (uintmax_t)b.timestamp.tv_sec,
- (uintmax_t)b.timestamp.tv_usec);
- tprints(", ...");
}
- tprints("}");
+ tprintf(code == VIDIOC_QBUF ? " => " : ", flags=");
+ printflags(v4l2_buf_flags, b.flags, "V4L2_BUF_FLAG_???");
+ if (code == VIDIOC_DQBUF)
+ tprintf(", timestamp = {%ju.%06ju}",
+ (uintmax_t)b.timestamp.tv_sec,
+ (uintmax_t)b.timestamp.tv_usec);
+ tprints(", ...}");
}
return 1;
}
--
1.8.4.5
More information about the Strace-devel
mailing list