From 58f5965175a46cf205e20be8e692646f9a9f5836 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Thu, 1 Nov 2018 18:22:50 +0100 Subject: [PATCH 75/76] xlat: update V4L2_CTRL_TYPE_* constants * xlat/v4l2_control_types.in: Add fallback definitions for constants, and #sorted. * configure.ac (AC_CHECK_MEMBERS): Check for struct v4l2_ext_control.string field. * v4l2.c (print_v4l2_ext_control): Change guard macro to HAVE_STRUCT_V4L2_EXT_CONTROL_STRING. --- configure.ac | 1 + v4l2.c | 2 +- xlat/v4l2_control_types.in | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 13 deletions(-) Index: strace-5.1/configure.ac =================================================================== --- strace-5.1.orig/configure.ac 2020-01-29 12:39:56.946464178 +0100 +++ strace-5.1/configure.ac 2020-01-29 12:41:14.883725929 +0100 @@ -779,6 +779,7 @@ AC_CHECK_MEMBERS(m4_normalize([ struct v4l2_capability.device_caps, + struct v4l2_ext_control.string, struct v4l2_format.fmt.pix_mp, struct v4l2_format.fmt.sdr, struct v4l2_format.fmt.sliced, Index: strace-5.1/v4l2.c =================================================================== --- strace-5.1.orig/v4l2.c 2020-01-29 12:39:56.947464169 +0100 +++ strace-5.1/v4l2.c 2020-01-29 12:41:14.883725929 +0100 @@ -780,7 +780,7 @@ tprints("{id="); printxval(v4l2_control_ids, p->id, "V4L2_CID_???"); -# if HAVE_DECL_V4L2_CTRL_TYPE_STRING +# if HAVE_STRUCT_V4L2_EXT_CONTROL_STRING tprintf(", size=%u", p->size); if (p->size > 0) { tprints(", string="); Index: strace-5.1/xlat/v4l2_control_types.in =================================================================== --- strace-5.1.orig/xlat/v4l2_control_types.in 2017-06-22 23:48:00.000000000 +0200 +++ strace-5.1/xlat/v4l2_control_types.in 2020-01-29 12:41:14.884725919 +0100 @@ -1,12 +1,12 @@ -V4L2_CTRL_TYPE_INTEGER -V4L2_CTRL_TYPE_BOOLEAN -V4L2_CTRL_TYPE_MENU -V4L2_CTRL_TYPE_BUTTON -V4L2_CTRL_TYPE_INTEGER64 -V4L2_CTRL_TYPE_CTRL_CLASS -V4L2_CTRL_TYPE_STRING -V4L2_CTRL_TYPE_BITMASK -V4L2_CTRL_TYPE_INTEGER_MENU -V4L2_CTRL_TYPE_U8 -V4L2_CTRL_TYPE_U16 -V4L2_CTRL_TYPE_U32 +V4L2_CTRL_TYPE_INTEGER 1 +V4L2_CTRL_TYPE_BOOLEAN 2 +V4L2_CTRL_TYPE_MENU 3 +V4L2_CTRL_TYPE_BUTTON 4 +V4L2_CTRL_TYPE_INTEGER64 5 +V4L2_CTRL_TYPE_CTRL_CLASS 6 +V4L2_CTRL_TYPE_STRING 7 +V4L2_CTRL_TYPE_BITMASK 8 +V4L2_CTRL_TYPE_INTEGER_MENU 9 +V4L2_CTRL_TYPE_U8 0x100 +V4L2_CTRL_TYPE_U16 0x101 +V4L2_CTRL_TYPE_U32 0x102 Index: strace-5.1/xlat/v4l2_control_types.h =================================================================== --- strace-5.1.orig/xlat/v4l2_control_types.h 2019-05-22 15:08:31.000000000 +0200 +++ strace-5.1/xlat/v4l2_control_types.h 2020-01-29 12:41:22.628651144 +0100 @@ -3,55 +3,115 @@ #include "gcc_compat.h" #include "static_assert.h" - -#ifndef XLAT_MACROS_ONLY - -# ifdef IN_MPERS - -extern const struct xlat v4l2_control_types[]; - -# else - -# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) -static -# endif -const struct xlat v4l2_control_types[] = { #if defined(V4L2_CTRL_TYPE_INTEGER) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_INTEGER) && HAVE_DECL_V4L2_CTRL_TYPE_INTEGER) - XLAT(V4L2_CTRL_TYPE_INTEGER), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_INTEGER) == (1), "V4L2_CTRL_TYPE_INTEGER != 1"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_INTEGER 1 #endif #if defined(V4L2_CTRL_TYPE_BOOLEAN) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_BOOLEAN) && HAVE_DECL_V4L2_CTRL_TYPE_BOOLEAN) - XLAT(V4L2_CTRL_TYPE_BOOLEAN), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_BOOLEAN) == (2), "V4L2_CTRL_TYPE_BOOLEAN != 2"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_BOOLEAN 2 #endif #if defined(V4L2_CTRL_TYPE_MENU) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_MENU) && HAVE_DECL_V4L2_CTRL_TYPE_MENU) - XLAT(V4L2_CTRL_TYPE_MENU), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_MENU) == (3), "V4L2_CTRL_TYPE_MENU != 3"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_MENU 3 #endif #if defined(V4L2_CTRL_TYPE_BUTTON) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_BUTTON) && HAVE_DECL_V4L2_CTRL_TYPE_BUTTON) - XLAT(V4L2_CTRL_TYPE_BUTTON), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_BUTTON) == (4), "V4L2_CTRL_TYPE_BUTTON != 4"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_BUTTON 4 #endif #if defined(V4L2_CTRL_TYPE_INTEGER64) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_INTEGER64) && HAVE_DECL_V4L2_CTRL_TYPE_INTEGER64) - XLAT(V4L2_CTRL_TYPE_INTEGER64), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_INTEGER64) == (5), "V4L2_CTRL_TYPE_INTEGER64 != 5"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_INTEGER64 5 #endif #if defined(V4L2_CTRL_TYPE_CTRL_CLASS) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_CTRL_CLASS) && HAVE_DECL_V4L2_CTRL_TYPE_CTRL_CLASS) - XLAT(V4L2_CTRL_TYPE_CTRL_CLASS), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_CTRL_CLASS) == (6), "V4L2_CTRL_TYPE_CTRL_CLASS != 6"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_CTRL_CLASS 6 #endif #if defined(V4L2_CTRL_TYPE_STRING) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_STRING) && HAVE_DECL_V4L2_CTRL_TYPE_STRING) - XLAT(V4L2_CTRL_TYPE_STRING), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_STRING) == (7), "V4L2_CTRL_TYPE_STRING != 7"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_STRING 7 #endif #if defined(V4L2_CTRL_TYPE_BITMASK) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_BITMASK) && HAVE_DECL_V4L2_CTRL_TYPE_BITMASK) - XLAT(V4L2_CTRL_TYPE_BITMASK), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_BITMASK) == (8), "V4L2_CTRL_TYPE_BITMASK != 8"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_BITMASK 8 #endif #if defined(V4L2_CTRL_TYPE_INTEGER_MENU) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_INTEGER_MENU) && HAVE_DECL_V4L2_CTRL_TYPE_INTEGER_MENU) - XLAT(V4L2_CTRL_TYPE_INTEGER_MENU), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_INTEGER_MENU) == (9), "V4L2_CTRL_TYPE_INTEGER_MENU != 9"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_INTEGER_MENU 9 #endif #if defined(V4L2_CTRL_TYPE_U8) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_U8) && HAVE_DECL_V4L2_CTRL_TYPE_U8) - XLAT(V4L2_CTRL_TYPE_U8), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_U8) == (0x100), "V4L2_CTRL_TYPE_U8 != 0x100"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_U8 0x100 #endif #if defined(V4L2_CTRL_TYPE_U16) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_U16) && HAVE_DECL_V4L2_CTRL_TYPE_U16) - XLAT(V4L2_CTRL_TYPE_U16), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_U16) == (0x101), "V4L2_CTRL_TYPE_U16 != 0x101"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_U16 0x101 #endif #if defined(V4L2_CTRL_TYPE_U32) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_U32) && HAVE_DECL_V4L2_CTRL_TYPE_U32) - XLAT(V4L2_CTRL_TYPE_U32), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_CTRL_TYPE_U32) == (0x102), "V4L2_CTRL_TYPE_U32 != 0x102"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_CTRL_TYPE_U32 0x102 #endif + +#ifndef XLAT_MACROS_ONLY + +# ifdef IN_MPERS + +extern const struct xlat v4l2_control_types[]; + +# else + +# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +static +# endif +const struct xlat v4l2_control_types[] = { + XLAT(V4L2_CTRL_TYPE_INTEGER), + XLAT(V4L2_CTRL_TYPE_BOOLEAN), + XLAT(V4L2_CTRL_TYPE_MENU), + XLAT(V4L2_CTRL_TYPE_BUTTON), + XLAT(V4L2_CTRL_TYPE_INTEGER64), + XLAT(V4L2_CTRL_TYPE_CTRL_CLASS), + XLAT(V4L2_CTRL_TYPE_STRING), + XLAT(V4L2_CTRL_TYPE_BITMASK), + XLAT(V4L2_CTRL_TYPE_INTEGER_MENU), + XLAT(V4L2_CTRL_TYPE_U8), + XLAT(V4L2_CTRL_TYPE_U16), + XLAT(V4L2_CTRL_TYPE_U32), XLAT_END };