v4l2: Add decoding for VIDIOC_G/S_TUNER's arg

* 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@linux.com>
This commit is contained in:
Edgar Kaziahmedov 2017-04-23 04:53:47 +03:00 committed by Dmitry V. Levin
parent 89390d356b
commit 99bade9917
5 changed files with 84 additions and 0 deletions

52
v4l2.c
View File

@ -629,6 +629,54 @@ 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 +1019,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);

View File

@ -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

View File

@ -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

View File

@ -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

6
xlat/v4l2_tuner_types.in Normal file
View File

@ -0,0 +1,6 @@
V4L2_TUNER_RADIO
V4L2_TUNER_ANALOG_TV
V4L2_TUNER_DIGITAL_TV
V4L2_TUNER_ADC
V4L2_TUNER_SDR
V4L2_TUNER_RF