From e46d490e0559199ebff4a0fd691369fbfd42e9ed Mon Sep 17 00:00:00 2001 From: tth Date: Wed, 24 Jul 2019 17:00:07 +0200 Subject: [PATCH] more and more semi-useless datas --- v4l2/v4l2_pr_structs.c | 44 +++++++++++++++-- v4l2/v4l2_pr_structs.h | 4 ++ v4l2/video-infos.c | 110 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 153 insertions(+), 5 deletions(-) diff --git a/v4l2/v4l2_pr_structs.c b/v4l2/v4l2_pr_structs.c index 7f7f6e5..c40faa5 100644 --- a/v4l2/v4l2_pr_structs.c +++ b/v4l2/v4l2_pr_structs.c @@ -73,7 +73,7 @@ fprintf(FP, " device caps 0x%X\n", ptr->device_caps); return -1; } /* --------------------------------------------------------------------- */ -static char *str_input_type(int t) +char *str_input_type(int t) { switch (t) { case V4L2_INPUT_TYPE_TUNER: return "tuner"; @@ -144,6 +144,44 @@ fprintf(FP, " type %d\n", ptr->type); /* enum v4l2_buf_type */ return 0; } /* --------------------------------------------------------------------- */ -/* --------------------------------------------------------------------- */ -/* --------------------------------------------------------------------- */ +char *str_ctrl_type(int type) +{ +switch (type) { + case V4L2_CTRL_TYPE_INTEGER: return "integer"; + case V4L2_CTRL_TYPE_BOOLEAN: return "boolean"; + case V4L2_CTRL_TYPE_MENU: return "menu"; + case V4L2_CTRL_TYPE_BUTTON: return "button"; + case V4L2_CTRL_TYPE_INTEGER64: return "int64"; + case V4L2_CTRL_TYPE_CTRL_CLASS: return "ctrl-class"; + case V4L2_CTRL_TYPE_STRING: return "string"; + case V4L2_CTRL_TYPE_BITMASK: return "bitmask"; + case V4L2_CTRL_TYPE_INTEGER_MENU: return "int-menu"; + } +return "???"; +} +/* --------------------------------------------------------------------- */ +/* + The 32-bit qctrl.id value is subdivided into three bit ranges: + the top 4 bits are reserved for flags (e. g. V4L2_CTRL_FLAG_NEXT_CTRL) + and are not actually part of the ID. + The remaining 28 bits form the control ID, of which the most significant + 12 bits define the control class and the least significant + 16 bits identify the control within the control class. + */ +void pr_ctrl_id(uint32_t id) +{ + +if (verbosity) fprintf(FP, "%08x : ", id); + +fprintf(FP, "%x %03x %04x", (id>>28)&0xf, + V4L2_CTRL_ID2CLASS(id)>>16, id&0xffff); + +} +/* --------------------------------------------------------------------- */ +int pr_v4l2_control(char *txt, struct v4l2_control *ptr) +{ + +return -1; +} +/* --------------------------------------------------------------------- */ diff --git a/v4l2/v4l2_pr_structs.h b/v4l2/v4l2_pr_structs.h index 592c9cb..27aa743 100644 --- a/v4l2/v4l2_pr_structs.h +++ b/v4l2/v4l2_pr_structs.h @@ -9,5 +9,9 @@ int pr_v4l2_capability(char *txt, struct v4l2_capability *ptr); int pr_v4l2_input(char *txt, struct v4l2_input *ptr); int pr_v4l2_format(char *txt, struct v4l2_format *ptr); int pr_v4l2_requestbuffers(char *txt, struct v4l2_requestbuffers *ptr); + +char *str_input_type(int t); +char *str_ctrl_type(int type); + /* --------------------------------------------------------------------- */ diff --git a/v4l2/video-infos.c b/v4l2/video-infos.c index 7579a7d..64efe95 100644 --- a/v4l2/video-infos.c +++ b/v4l2/video-infos.c @@ -8,7 +8,7 @@ #include #include #include - +#include #include #include "../floatimg.h" @@ -19,12 +19,109 @@ int verbosity; /* --------------------------------------------------------------------- */ -static int enum_input(char *txt, int k) +static int enum_inputs(int fd, char *txt, int k) { +int index, foo; +struct v4l2_input input; + +printf("-- inputs enumeration '%s'\n", txt); + +index = 0; +for(;;) { + memset (&input, 0, sizeof (input)); + input.index = index; + foo = ioctl(fd, VIDIOC_ENUMINPUT, &input); + if (foo) { + if (EINVAL==errno) { break; } + else { + perror("enuminput"); + return -1; + } + } + + printf("%-32s | %-10s\n", input.name, + str_input_type(input.type)); + + index++; + } + +return 0; +} +/* --------------------------------------------------------------------- */ + +int enum_controls(int fd, char *txt, int k) +{ +struct v4l2_queryctrl qctrl; +int foo, idx; + + +printf("-- controls enumeration '%s'\n", txt); + +memset (&qctrl, 0, sizeof (qctrl)); + +/* V4L2_CID_BASE defined in linux/v4l2-controls.h */ + +for (idx=V4L2_CID_BASE; idx