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