[PATCH 1/2] v4l2: Add decoding for VIDIOC_G/S_TUNER's arg

Edgar Kaziahmedov edos at linux.com
Mon May 1 13:25:08 UTC 2017


On Mon, 1 May 2017 16:09:19 +0300
Edgar Kaziahmedov <edos at linux.com> wrote:

> On Sun, 23 Apr 2017 04:53:47 +0300
> Edgar Kaziahmedov <edos at linux.com> wrote:
> 
> > * v4l2.c: Include "xlat/v4l2_tuner_types.h",
> > "xlat/v4l2_tuner_capabilities.h", "xlat/v4l2_tuner_rxsubchanses.h",
> > and "xlat/v4l2_tuner_audmodes.h". (print_v4l2_tuner): New function.
> > Add decoding for VIDIOC_G/S_TUNER's arg. (v4l2_ioctl): Add new cases
> > for decoding VIDIOC_G/S_TUNER's arg.
> > * xlat/v4l2_tuner_types.in: Add V4L2_TUNER_RADIO and
> > V4L2_TUNER_ANALOG_TV introduced by linux kernel commit
> > 2.5.46~39^2~23^2~4.
> > Add V4L2_TUNER_DIGITAL_TV introduced by linux kernel
> > commit v2.6.11-rc4~55^2~20.
> > Add V4L2_TUNER_ADC and V4L2_TUNER_RF introduced by linux kernel
> > commit v3.15-rc1~85^2~215.
> > Add V4L2_TUNER_SDR introduced by linux kernel commit
> > v4.4-rc1~118^2~17 (as the replacement of V4L2_TUNER_ADC).
> > * xlat/v4l2_tuner_capabilities.in: Add V4L2_TUNER_CAP_LOW,
> > V4L2_TUNER_CAP_NORM, V4L2_TUNER_CAP_STEREO, V4L2_TUNER_CAP_LANG2,
> > V4L2_TUNER_CAP_SAP, and V4L2_TUNER_CAP_LANG1 introduced by linux
> > kernel commit 2.5.46~39^2~23^2~4.
> > Add V4L2_TUNER_CAP_HWSEEK_BOUNDED and V4L2_TUNER_CAP_HWSEEK_WRAP
> > introduced by linux kernel commit v3.6-rc1~28^2~306.
> > Add V4L2_TUNER_CAP_RDS introduced by linux commit
> > v2.6.32-rc1~679^2~189. Add V4L2_TUNER_CAP_RDS_BLOCK_IO and
> > V4L2_TUNER_CAP_RDS_CONTROLS introduced by linux kernel commit
> > v2.6.37-rc1~64^2~110. Add V4L2_TUNER_CAP_FREQ_BANDS introduced by
> > linux kernel commit v3.6-rc1~28^2~46.
> > Add V4L2_TUNER_CAP_HWSEEK_PROG_LIM introduced by linux kernel commit
> > v3.6-rc1~28^2~40.
> > Add V4L2_TUNER_CAP_1HZ introduced by linux kernel commit
> > v3.15-rc1~85^2~214.
> > * xlat/v4l2_tuner_audmodes.in: Add V4L2_TUNER_MODE_MONO,
> > V4L2_TUNER_MODE_STEREO, V4L2_TUNER_MODE_LANG2, V4L2_TUNER_MODE_SAP,
> > and V4L2_TUNER_MODE_LANG1 introduced by linux kernel commit
> > 2.5.46~39^2~23^2~4.
> > Add V4L2_TUNER_MODE_LANG1_LANG2 introduced by linux kernel commit
> > v2.6.17-rc1~739^2~9.
> > * xlat/v4l2_tuner_rxsubchanses.in: Add V4L2_TUNER_SUB_MONO,
> > V4L2_TUNER_SUB_STEREO, V4L2_TUNER_SUB_LANG2, V4L2_TUNER_SUB_SAP, and
> > V4L2_TUNER_SUB_LANG1 introduced by linux kernel commit
> > 2.5.46~39^2~23^2~4.
> > Add V4L2_TUNER_SUB_RDS introduced by linux kernel commit
> > v2.6.32-rc1~679^2~189.
> > 
> > Signed-off-by: Edgar Kaziahmedov <edos at linux.com>
> > ---
> >  v4l2.c                          | 53
> > +++++++++++++++++++++++++++++++++++++++++
> > xlat/v4l2_tuner_audmodes.in     |  6 +++++
> > xlat/v4l2_tuner_capabilities.in | 14 +++++++++++
> > xlat/v4l2_tuner_rxsubchanses.in |  6 +++++
> > xlat/v4l2_tuner_types.in        |  6 +++++ 5 files changed, 85
> > insertions(+) create mode 100644 xlat/v4l2_tuner_audmodes.in
> >  create mode 100644 xlat/v4l2_tuner_capabilities.in
> >  create mode 100644 xlat/v4l2_tuner_rxsubchanses.in
> >  create mode 100644 xlat/v4l2_tuner_types.in
> > 
> > diff --git a/v4l2.c b/v4l2.c
> > index ee833c12..8c9a1927 100644
> > --- a/v4l2.c
> > +++ b/v4l2.c
> > @@ -629,6 +629,55 @@ print_v4l2_control(struct tcb *const tcp, const
> > kernel_ulong_t arg, return 1;
> >  }
> >  
> > +
> > +#include "xlat/v4l2_tuner_types.h"
> > +#include "xlat/v4l2_tuner_capabilities.h"
> > +#include "xlat/v4l2_tuner_rxsubchanses.h"
> > +#include "xlat/v4l2_tuner_audmodes.h"
> > +
> > +static int
> > +print_v4l2_tuner(struct tcb *const tcp, const kernel_ulong_t arg,
> > +		 const bool is_get)
> > +{
> > +	struct v4l2_tuner c;
> > +	if (entering(tcp)) {
> > +		tprints(", ");
> > +		if (umove_or_printaddr(tcp, arg, &c))
> > +			return RVAL_DECODED | 1;
> > +		tprintf("{index=%u", c.index);
> > +		if (is_get)
> > +			return 0;
> > +		tprints(", ");
> > +	} else {
> > +		if (syserror(tcp) || umove(tcp, arg, &c) < 0) {
> > +			tprints("}");
> > +			return 1;
> > +		}
> > +		tprints(is_get ? ", " : " => ");
> > +	}
> > +
> > +	tprints("name=");
> > +	print_quoted_string((const char *) c.name, sizeof(c.name),
> > +			    QUOTE_0_TERMINATED);
> > +	tprints(", type=");
> > +	printxval(v4l2_tuner_types, c.type, "V4L2_TUNER_TYPE_???");
> > +	tprints(", capability=");
> > +	printxval(v4l2_tuner_capabilities, c.capability,
> > +		  "V4L2_TUNER_CAP_???");
> > +	tprintf(", rangelow=%u, rangehigh=%u, rxsubchans=",
> > +		c.rangelow, c.rangehigh);
> > +	printxval(v4l2_tuner_rxsubchanses, c.rxsubchans,
> > +		  "V4L2_TUNER_SUB_???");
> > +	tprints(", audmode=");
> > +	printxval(v4l2_tuner_audmodes, c.audmode,
> > +		  "V4L2_TUNER_MODE_???");
> > +	tprintf(", signal=%d, afc=%d", c.signal, c.afc);
> > +
> > +	if (exiting(tcp))
> > +		tprints("}");
> > +	return 1;
> > +}
> > +
> >  #include "xlat/v4l2_control_types.h"
> >  #include "xlat/v4l2_control_flags.h"
> >  
> > @@ -971,6 +1020,10 @@ MPERS_PRINTER_DECL(int, v4l2_ioctl, struct tcb
> > *const tcp, case VIDIOC_S_CTRL: /* RW */
> >  		return print_v4l2_control(tcp, arg, code ==
> > VIDIOC_G_CTRL); 
> > +	case VIDIOC_G_TUNER: /* RW */
> > +	case VIDIOC_S_TUNER: /* RW */
> > +		return print_v4l2_tuner(tcp, arg, code ==
> > VIDIOC_G_TUNER); +
> >  	case VIDIOC_QUERYCTRL: /* RW */
> >  		return print_v4l2_queryctrl(tcp, arg);
> >  
> > diff --git a/xlat/v4l2_tuner_audmodes.in
> > b/xlat/v4l2_tuner_audmodes.in new file mode 100644
> > index 00000000..82decabf
> > --- /dev/null
> > +++ b/xlat/v4l2_tuner_audmodes.in
> > @@ -0,0 +1,6 @@
> > +V4L2_TUNER_MODE_MONO
> > +V4L2_TUNER_MODE_STEREO
> > +V4L2_TUNER_MODE_LANG2
> > +V4L2_TUNER_MODE_SAP
> > +V4L2_TUNER_MODE_LANG1
> > +V4L2_TUNER_MODE_LANG1_LANG2
> > diff --git a/xlat/v4l2_tuner_capabilities.in
> > b/xlat/v4l2_tuner_capabilities.in new file mode 100644
> > index 00000000..4aec41eb
> > --- /dev/null
> > +++ b/xlat/v4l2_tuner_capabilities.in
> > @@ -0,0 +1,14 @@
> > +V4L2_TUNER_CAP_LOW
> > +V4L2_TUNER_CAP_NORM
> > +V4L2_TUNER_CAP_HWSEEK_BOUNDED
> > +V4L2_TUNER_CAP_HWSEEK_WRAP
> > +V4L2_TUNER_CAP_STEREO
> > +V4L2_TUNER_CAP_LANG2
> > +V4L2_TUNER_CAP_SAP
> > +V4L2_TUNER_CAP_LANG1
> > +V4L2_TUNER_CAP_RDS
> > +V4L2_TUNER_CAP_RDS_BLOCK_IO
> > +V4L2_TUNER_CAP_RDS_CONTROLS
> > +V4L2_TUNER_CAP_FREQ_BANDS
> > +V4L2_TUNER_CAP_HWSEEK_PROG_LIM
> > +V4L2_TUNER_CAP_1HZ
> > diff --git a/xlat/v4l2_tuner_rxsubchanses.in
> > b/xlat/v4l2_tuner_rxsubchanses.in new file mode 100644
> > index 00000000..c6d59e95
> > --- /dev/null
> > +++ b/xlat/v4l2_tuner_rxsubchanses.in
> > @@ -0,0 +1,6 @@
> > +V4L2_TUNER_SUB_MONO
> > +V4L2_TUNER_SUB_STEREO
> > +V4L2_TUNER_SUB_LANG2
> > +V4L2_TUNER_SUB_SAP
> > +V4L2_TUNER_SUB_LANG1
> > +V4L2_TUNER_SUB_RDS
> > diff --git a/xlat/v4l2_tuner_types.in b/xlat/v4l2_tuner_types.in
> > new file mode 100644
> > index 00000000..59a9f3a3
> > --- /dev/null
> > +++ b/xlat/v4l2_tuner_types.in
> > @@ -0,0 +1,6 @@
> > +V4L2_TUNER_RADIO
> > +V4L2_TUNER_ANALOG_TV
> > +V4L2_TUNER_DIGITAL_TV
> > +V4L2_TUNER_ADC
> > +V4L2_TUNER_SDR
> > +V4L2_TUNER_RF  
> 
> I'm sorry for disturbing, but are you going to look the last one
> patch?

I'm sorry for disturbing, but are you going to look the last one patch?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170501/13adf019/attachment.bin>


More information about the Strace-devel mailing list