Merge remote-tracking branch 'mkp-scsi/4.8/scsi-fixes' into fixes
[deliverable/linux.git] / Documentation / media / uapi / dvb / dvbproperty.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _frontend-properties:
4
5 DVB Frontend properties
6 =======================
7
8 Tuning into a Digital TV physical channel and starting decoding it
9 requires changing a set of parameters, in order to control the tuner,
10 the demodulator, the Linear Low-noise Amplifier (LNA) and to set the
11 antenna subsystem via Satellite Equipment Control (SEC), on satellite
12 systems. The actual parameters are specific to each particular digital
13 TV standards, and may change as the digital TV specs evolves.
14
15 In the past, the strategy used was to have a union with the parameters
16 needed to tune for DVB-S, DVB-C, DVB-T and ATSC delivery systems grouped
17 there. The problem is that, as the second generation standards appeared,
18 those structs were not big enough to contain the additional parameters.
19 Also, the union didn't have any space left to be expanded without
20 breaking userspace. So, the decision was to deprecate the legacy
21 union/struct based approach, in favor of a properties set approach.
22
23 .. note:: On Linux DVB API version 3, setting a frontend were done via
24 :ref:`struct dvb_frontend_parameters <dvb-frontend-parameters>`.
25 This got replaced on version 5 (also called "S2API", as this API were
26 added originally_enabled to provide support for DVB-S2), because the
27 old API has a very limited support to new standards and new hardware.
28 This section describes the new and recommended way to set the frontend,
29 with suppports all digital TV delivery systems.
30
31 Example: with the properties based approach, in order to set the tuner
32 to a DVB-C channel at 651 kHz, modulated with 256-QAM, FEC 3/4 and
33 symbol rate of 5.217 Mbauds, those properties should be sent to
34 :ref:`FE_SET_PROPERTY <FE_GET_PROPERTY>` ioctl:
35
36 - :ref:`DTV_DELIVERY_SYSTEM <DTV-DELIVERY-SYSTEM>` =
37 SYS_DVBC_ANNEX_A
38
39 - :ref:`DTV_FREQUENCY <DTV-FREQUENCY>` = 651000000
40
41 - :ref:`DTV_MODULATION <DTV-MODULATION>` = QAM_256
42
43 - :ref:`DTV_INVERSION <DTV-INVERSION>` = INVERSION_AUTO
44
45 - :ref:`DTV_SYMBOL_RATE <DTV-SYMBOL-RATE>` = 5217000
46
47 - :ref:`DTV_INNER_FEC <DTV-INNER-FEC>` = FEC_3_4
48
49 - :ref:`DTV_TUNE <DTV-TUNE>`
50
51 The code that would that would do the above is show in
52 :ref:`dtv-prop-example`.
53
54 .. _dtv-prop-example:
55
56 Example: Setting digital TV frontend properties
57 ===============================================
58
59 .. code-block:: c
60
61 #include <stdio.h>
62 #include <fcntl.h>
63 #include <sys/ioctl.h>
64 #include <linux/dvb/frontend.h>
65
66 static struct dtv_property props[] = {
67 { .cmd = DTV_DELIVERY_SYSTEM, .u.data = SYS_DVBC_ANNEX_A },
68 { .cmd = DTV_FREQUENCY, .u.data = 651000000 },
69 { .cmd = DTV_MODULATION, .u.data = QAM_256 },
70 { .cmd = DTV_INVERSION, .u.data = INVERSION_AUTO },
71 { .cmd = DTV_SYMBOL_RATE, .u.data = 5217000 },
72 { .cmd = DTV_INNER_FEC, .u.data = FEC_3_4 },
73 { .cmd = DTV_TUNE }
74 };
75
76 static struct dtv_properties dtv_prop = {
77 .num = 6, .props = props
78 };
79
80 int main(void)
81 {
82 int fd = open("/dev/dvb/adapter0/frontend0", O_RDWR);
83
84 if (!fd) {
85 perror ("open");
86 return -1;
87 }
88 if (ioctl(fd, FE_SET_PROPERTY, &dtv_prop) == -1) {
89 perror("ioctl");
90 return -1;
91 }
92 printf("Frontend set\\n");
93 return 0;
94 }
95
96 .. attention:: While it is possible to directly call the Kernel code like the
97 above example, it is strongly recommended to use
98 `libdvbv5 <https://linuxtv.org/docs/libdvbv5/index.html>`__, as it
99 provides abstraction to work with the supported digital TV standards and
100 provides methods for usual operations like program scanning and to
101 read/write channel descriptor files.
102
103
104 .. toctree::
105 :maxdepth: 1
106
107 dtv-stats
108 dtv-fe-stats
109 dtv-property
110 dtv-properties
111 dvbproperty-006
112 fe_property_parameters
113 frontend-stat-properties
114 frontend-property-terrestrial-systems
115 frontend-property-cable-systems
116 frontend-property-satellite-systems
This page took 0.034057 seconds and 6 git commands to generate.