Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[deliverable/linux.git] / Documentation / media / uapi / 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
706f8a99
MCC
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.
5377d91f
MH
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
282f02cb
MCC
51The code that would that would do the above is show in
52:ref:`dtv-prop-example`.
5377d91f 53
282f02cb
MCC
54.. _dtv-prop-example:
55
56Example: Setting digital TV frontend properties
57===============================================
5377d91f
MH
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[] = {
0579e6e3
MCC
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 }
5377d91f
MH
74 };
75
76 static struct dtv_properties dtv_prop = {
0579e6e3 77 .num = 6, .props = props
5377d91f
MH
78 };
79
80 int main(void)
81 {
0579e6e3
MCC
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;
5377d91f
MH
94 }
95
706f8a99
MCC
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.
5377d91f
MH
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.079175 seconds and 5 git commands to generate.