From: Vandana BN <bnvandana@gmail.com> To: linux-media@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org Cc: hverkuil@xs4all.nl, Vandana BN <bnvandana@gmail.com> Subject: [PATCH] v4l2-ctl:Add Support for Touch Date: Fri, 8 Nov 2019 12:42:27 +0530 [thread overview] Message-ID: <20191108071227.10982-1-bnvandana@gmail.com> (raw) Add support to verify V4L2_TCH_FMT_TU16 format touch inputs. Signed-off-by: Vandana BN <bnvandana@gmail.com> --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 4 ++++ utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 29 +++++++++++++++++++++++++++ utils/v4l2-ctl/v4l2-ctl.h | 1 + 3 files changed, 34 insertions(+) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 184bfd64..191a18c5 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -595,6 +595,10 @@ static void print_concise_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, if (v4l_type_is_meta(buf.g_type()) && buf.g_bytesused(0) && !(buf.g_flags() & V4L2_BUF_FLAG_ERROR)) print_meta_buffer(f, buf, fmt, q); + + if ((capabilities & V4L2_CAP_TOUCH) && buf.g_bytesused(0) && + !(buf.g_flags() & V4L2_BUF_FLAG_ERROR)) + print_touch_buffer(f, buf, fmt, q); } static void stream_buf_caps(cv4l_fd &fd, unsigned buftype) diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp index 3a29251a..99945248 100644 --- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp @@ -358,3 +358,32 @@ void vidcap_list(cv4l_fd &fd) } } } + +#define VIVID_TCH_HEIGHT 24 +#define VIVID_TCH_WIDTH 14 + +struct vivid_touch_buf { + __u16 buf[VIVID_TCH_WIDTH * VIVID_TCH_HEIGHT]; + int test_pattern; +}; + +void print_touch_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q) +{ + struct vivid_touch_buf *vbuf; + int i=0; + + switch (fmt.g_pixelformat()) { + case V4L2_TCH_FMT_TU16: + vbuf = (vivid_touch_buf *)q.g_dataptr(buf.g_index(), 0); + fprintf(f, "Test Pattern: %d\n",vbuf->test_pattern); + fprintf(f, "TU16: "); + for (i = 0; i < (VIVID_TCH_HEIGHT*VIVID_TCH_WIDTH); i++) { + if (vbuf->buf[i]) + fprintf(f, "x: %d y: %d Pressure Value: %d\n", + i % VIVID_TCH_WIDTH, + i / VIVID_TCH_WIDTH, + vbuf->buf[i]); + } + break; + } +} diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h index b0f65e9b..b31be7f5 100644 --- a/utils/v4l2-ctl/v4l2-ctl.h +++ b/utils/v4l2-ctl/v4l2-ctl.h @@ -373,6 +373,7 @@ int vidcap_get_and_update_fmt(cv4l_fd &_fd, struct v4l2_format &vfmt); void vidcap_set(cv4l_fd &fd); void vidcap_get(cv4l_fd &fd); void vidcap_list(cv4l_fd &fd); +void print_touch_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q); // v4l2-ctl-vidout.cpp void vidout_usage(void); -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Vandana BN <bnvandana@gmail.com> To: linux-media@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: [Linux-kernel-mentees] [PATCH] v4l2-ctl:Add Support for Touch Date: Fri, 8 Nov 2019 12:42:27 +0530 [thread overview] Message-ID: <20191108071227.10982-1-bnvandana@gmail.com> (raw) Add support to verify V4L2_TCH_FMT_TU16 format touch inputs. Signed-off-by: Vandana BN <bnvandana@gmail.com> --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 4 ++++ utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 29 +++++++++++++++++++++++++++ utils/v4l2-ctl/v4l2-ctl.h | 1 + 3 files changed, 34 insertions(+) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 184bfd64..191a18c5 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -595,6 +595,10 @@ static void print_concise_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, if (v4l_type_is_meta(buf.g_type()) && buf.g_bytesused(0) && !(buf.g_flags() & V4L2_BUF_FLAG_ERROR)) print_meta_buffer(f, buf, fmt, q); + + if ((capabilities & V4L2_CAP_TOUCH) && buf.g_bytesused(0) && + !(buf.g_flags() & V4L2_BUF_FLAG_ERROR)) + print_touch_buffer(f, buf, fmt, q); } static void stream_buf_caps(cv4l_fd &fd, unsigned buftype) diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp index 3a29251a..99945248 100644 --- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp @@ -358,3 +358,32 @@ void vidcap_list(cv4l_fd &fd) } } } + +#define VIVID_TCH_HEIGHT 24 +#define VIVID_TCH_WIDTH 14 + +struct vivid_touch_buf { + __u16 buf[VIVID_TCH_WIDTH * VIVID_TCH_HEIGHT]; + int test_pattern; +}; + +void print_touch_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q) +{ + struct vivid_touch_buf *vbuf; + int i=0; + + switch (fmt.g_pixelformat()) { + case V4L2_TCH_FMT_TU16: + vbuf = (vivid_touch_buf *)q.g_dataptr(buf.g_index(), 0); + fprintf(f, "Test Pattern: %d\n",vbuf->test_pattern); + fprintf(f, "TU16: "); + for (i = 0; i < (VIVID_TCH_HEIGHT*VIVID_TCH_WIDTH); i++) { + if (vbuf->buf[i]) + fprintf(f, "x: %d y: %d Pressure Value: %d\n", + i % VIVID_TCH_WIDTH, + i / VIVID_TCH_WIDTH, + vbuf->buf[i]); + } + break; + } +} diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h index b0f65e9b..b31be7f5 100644 --- a/utils/v4l2-ctl/v4l2-ctl.h +++ b/utils/v4l2-ctl/v4l2-ctl.h @@ -373,6 +373,7 @@ int vidcap_get_and_update_fmt(cv4l_fd &_fd, struct v4l2_format &vfmt); void vidcap_set(cv4l_fd &fd); void vidcap_get(cv4l_fd &fd); void vidcap_list(cv4l_fd &fd); +void print_touch_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q); // v4l2-ctl-vidout.cpp void vidout_usage(void); -- 2.17.1 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next reply other threads:[~2019-11-08 7:12 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-11-08 7:12 Vandana BN [this message] 2019-11-08 7:12 ` [Linux-kernel-mentees] [PATCH] v4l2-ctl:Add Support for Touch Vandana BN 2019-11-13 11:23 ` [PATCH v2] " Vandana BN 2019-11-15 13:21 ` [PATCH v3] " Vandana BN 2019-11-19 9:38 ` Hans Verkuil 2019-11-23 18:36 ` [PATCH v4] " Vandana BN
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20191108071227.10982-1-bnvandana@gmail.com \ --to=bnvandana@gmail.com \ --cc=hverkuil@xs4all.nl \ --cc=linux-kernel-mentees@lists.linuxfoundation.org \ --cc=linux-media@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.