code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _dmx_fwrite:

========================
Digital TV demux write()
========================

Name
----

Digital TV demux write()

Synopsis
--------

.. c:function:: ssize_t write(int fd, const void *buf, size_t count)

Arguments
---------

``fd``
  File descriptor returned by a previous call to :c:func:`open()`.

``buf``
     Buffer with data to be written

``count``
    Number of bytes at the buffer

Description
-----------

This system call is only provided by the logical device
``/dev/dvb/adapter?/dvr?``, associated with the physical demux device that
provides the actual DVR functionality. It is used for replay of a
digitally recorded Transport Stream. Matching filters have to be defined
in the corresponding physical demux device, ``/dev/dvb/adapter?/demux?``.
The amount of data to be transferred is implied by count.

Return Value
------------

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|

.. flat-table::
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 16

    -  -  ``EWOULDBLOCK``
       -  No data was written. This might happen if ``O_NONBLOCK`` was
	  specified and there is no more buffer space available (if
	  ``O_NONBLOCK`` is not specified the function will block until buffer
	  space is available).

    -  -  ``EBUSY``
       -  This error code indicates that there are conflicting requests. The
	  corresponding demux device is setup to receive data from the
	  front- end. Make sure that these filters are stopped and that the
	  filters with input set to ``DMX_IN_DVR`` are started.

The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _DMX_GET_PES_PIDS:

================
DMX_GET_PES_PIDS
================

Name
----

DMX_GET_PES_PIDS

Synopsis
--------

.. c:macro:: DMX_GET_PES_PIDS

``int ioctl(fd, DMX_GET_PES_PIDS, __u16 pids[5])``

Arguments
---------

``fd``
    File descriptor returned by :c:func:`open()`.

``pids``
    Array used to store 5 Program IDs.

Description
-----------

This ioctl allows to query a DVB device to return the first PID used
by audio, video, textext, subtitle and PCR programs on a given service.
They're stored as:

=======================	========	=======================================
PID  element		position	content
=======================	========	=======================================
pids[DMX_PES_AUDIO]	0		first audio PID
pids[DMX_PES_VIDEO]	1		first video PID
pids[DMX_PES_TELETEXT]	2		first teletext PID
pids[DMX_PES_SUBTITLE]	3		first subtitle PID
pids[DMX_PES_PCR]	4		first Program Clock Reference PID
=======================	========	=======================================

.. note::

	A value equal to 0xffff means that the PID was not filled by the
	Kernel.

Return Value
------------

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.

repo_name: angery/linux


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _DMX_GET_STC:

===========
DMX_GET_STC
===========

Name
----

DMX_GET_STC

Synopsis
--------

.. c:macro:: DMX_GET_STC

``int ioctl(int fd, DMX_GET_STC, struct dmx_stc *stc)``

Arguments
---------

``fd``
    File descriptor returned by :c:func:`open()`.

``stc``
    Pointer to :c:type:`dmx_stc` where the stc data is to be stored.

Description
-----------

This ioctl call returns the current value of the system time counter
(which is driven by a PES filter of type :c:type:`DMX_PES_PCR <dmx_ts_pes>`).
Some hardware supports more than one STC, so you must specify which one by
setting the :c:type:`num <dmx_stc>` field of stc before the ioctl (range 0...n).
The result is returned in form of a ratio with a 64 bit numerator
and a 32 bit denominator, so the real 90kHz STC value is
``stc->stc / stc->base``.

Return Value
------------

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|

.. flat-table::
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 16

    -  .. row 1

       -  ``EINVAL``

       -  Invalid stc number.

The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _dmx-mmap:

*****************
Digital TV mmap()
*****************

Name
====

dmx-mmap - Map device memory into application address space

.. warning:: this API is still experimental

Synopsis
========

.. code-block:: c

    #include <unistd.h>
    #include <sys/mman.h>

.. c:function:: void *mmap( void *start, size_t length, int prot, int flags, int fd, off_t offset )

Arguments
=========

``start``
    Map the buffer to this address in the application's address space.
    When the ``MAP_FIXED`` flag is specified, ``start`` must be a
    multiple of the pagesize and mmap will fail when the specified
    address cannot be used. Use of this option is discouraged;
    applications should just specify a ``NULL`` pointer here.

``length``
    Length of the memory area to map. This must be a multiple of the
    DVB packet length (188, on most drivers).

``prot``
    The ``prot`` argument describes the desired memory protection.
    Regardless of the device type and the direction of data exchange it
    should be set to ``PROT_READ`` | ``PROT_WRITE``, permitting read
    and write access to image buffers. Drivers should support at least
    this combination of flags.

``flags``
    The ``flags`` parameter specifies the type of the mapped object,
    mapping options and whether modifications made to the mapped copy of
    the page are private to the process or are to be shared with other
    references.

    ``MAP_FIXED`` requests that the driver selects no other address than
    the one specified. If the specified address cannot be used,
    :c:func:`mmap()` will fail. If ``MAP_FIXED`` is specified,
    ``start`` must be a multiple of the pagesize. Use of this option is
    discouraged.

    One of the ``MAP_SHARED`` or ``MAP_PRIVATE`` flags must be set.
    ``MAP_SHARED`` allows applications to share the mapped memory with
    other (e. g. child-) processes.

    .. note::

       The Linux Digital TV applications should not set the
       ``MAP_PRIVATE``, ``MAP_DENYWRITE``, ``MAP_EXECUTABLE`` or ``MAP_ANON``
       flags.

``fd``
    File descriptor returned by :c:func:`open()`.

``offset``
    Offset of the buffer in device memory, as returned by
    :ref:`DMX_QUERYBUF` ioctl.

Description
===========

The :c:func:`mmap()` function asks to map ``length`` bytes starting at
``offset`` in the memory of the device specified by ``fd`` into the
application address space, preferably at address ``start``. This latter
address is a hint only, and is usually specified as 0.

Suitable length and offset parameters are queried with the
:ref:`DMX_QUERYBUF` ioctl. Buffers must be allocated with the
:ref:`DMX_REQBUFS` ioctl before they can be queried.

To unmap buffers the :c:func:`munmap()` function is used.

Return Value
============

On success :c:func:`mmap()` returns a pointer to the mapped buffer. On
error ``MAP_FAILED`` (-1) is returned, and the ``errno`` variable is set
appropriately. Possible error codes are:

EBADF
    ``fd`` is not a valid file descriptor.

EACCES
    ``fd`` is not open for reading and writing.

EINVAL
    The ``start`` or ``length`` or ``offset`` are not suitable. (E. g.
    they are too large, or not aligned on a ``PAGESIZE`` boundary.)

    The ``flags`` or ``prot`` value is not supported.

    No buffers have been allocated with the
    :ref:`DMX_REQBUFS` ioctl.

ENOMEM
    Not enough physical or virtual memory was available to complete the
    request.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _dmx-munmap:

************
DVB munmap()
************

Name
====

dmx-munmap - Unmap device memory

.. warning:: This API is still experimental.

Synopsis
========

.. code-block:: c

    #include <unistd.h>
    #include <sys/mman.h>

.. c:function:: int munmap( void *start, size_t length )

Arguments
=========

``start``
    Address of the mapped buffer as returned by the
    :c:func:`mmap()` function.

``length``
    Length of the mapped buffer. This must be the same value as given to
    :c:func:`mmap()`.

Description
===========

Unmaps a previously with the :c:func:`mmap()` function mapped
buffer and frees it, if possible.

Return Value
============

On success :c:func:`munmap()` returns 0, on failure -1 and the
``errno`` variable is set appropriately:

EINVAL
    The ``start`` or ``length`` is incorrect, or no buffers have been
    mapped yet.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _DMX_QBUF:

*************************
ioctl DMX_QBUF, DMX_DQBUF
*************************

Name
====

DMX_QBUF - DMX_DQBUF - Exchange a buffer with the driver

.. warning:: this API is still experimental

Synopsis
========

.. c:macro:: DMX_QBUF

``int ioctl(int fd, DMX_QBUF, struct dmx_buffer *argp)``

.. c:macro:: DMX_DQBUF

``int ioctl(int fd, DMX_DQBUF, struct dmx_buffer *argp)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``argp``
    Pointer to struct :c:type:`dmx_buffer`.

Description
===========

Applications call the ``DMX_QBUF`` ioctl to enqueue an empty
(capturing) or filled (output) buffer in the driver's incoming queue.
The semantics depend on the selected I/O method.

To enqueue a buffer applications set the ``index`` field. Valid index
numbers range from zero to the number of buffers allocated with
:ref:`DMX_REQBUFS` (struct :c:type:`dmx_requestbuffers` ``count``) minus
one. The contents of the struct :c:type:`dmx_buffer` returned
by a :ref:`DMX_QUERYBUF` ioctl will do as well.

When ``DMX_QBUF`` is called with a pointer to this structure, it locks the
memory pages of the buffer in physical memory, so they cannot be swapped
out to disk. Buffers remain locked until dequeued, until the
device is closed.

Applications call the ``DMX_DQBUF`` ioctl to dequeue a filled
(capturing) buffer from the driver's outgoing queue.
They just set the ``index`` field with the buffer ID to be queued.
When ``DMX_DQBUF`` is called with a pointer to struct :c:type:`dmx_buffer`,
the driver fills the remaining fields or returns an error code.

By default ``DMX_DQBUF`` blocks when no buffer is in the outgoing
queue. When the ``O_NONBLOCK`` flag was given to the
:c:func:`open()` function, ``DMX_DQBUF`` returns
immediately with an ``EAGAIN`` error code when no buffer is available.

The struct :c:type:`dmx_buffer` structure is specified in
:ref:`buffer`.

Return Value
============

On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.

EAGAIN
    Non-blocking I/O has been selected using ``O_NONBLOCK`` and no
    buffer was in the outgoing queue.

EINVAL
    The ``index`` is out of bounds, or no buffers have been allocated yet.

EIO
    ``DMX_DQBUF`` failed due to an internal error. Can also indicate
    temporary problems like signal loss or CRC errors.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _DMX_QUERYBUF:

******************
ioctl DMX_QUERYBUF
******************

Name
====

DMX_QUERYBUF - Query the status of a buffer

.. warning:: this API is still experimental

Synopsis
========

.. c:macro:: DMX_QUERYBUF

``int ioctl(int fd, DMX_QUERYBUF, struct dvb_buffer *argp)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``argp``
    Pointer to struct :c:type:`dvb_buffer`.

Description
===========

This ioctl is part of the mmap streaming I/O method. It can
be used to query the status of a buffer at any time after buffers have
been allocated with the :ref:`DMX_REQBUFS` ioctl.

Applications set the ``index`` field. Valid index numbers range from zero
to the number of buffers allocated with :ref:`DMX_REQBUFS`
(struct :c:type:`dvb_requestbuffers` ``count``) minus one.

After calling :ref:`DMX_QUERYBUF` with a pointer to this structure,
drivers return an error code or fill the rest of the structure.

On success, the ``offset`` will contain the offset of the buffer from the
start of the device memory, the ``length`` field its size, and the
``bytesused`` the number of bytes occupied by data in the buffer (payload).

Return Value
============

On success 0 is returned, the ``offset`` will contain the offset of the
buffer from the start of the device memory, the ``length`` field its size,
and the ``bytesused`` the number of bytes occupied by data in the buffer
(payload).

On error it returns -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.

EINVAL
    The ``index`` is out of bounds.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _DMX_REMOVE_PID:

==============
DMX_REMOVE_PID
==============

Name
----

DMX_REMOVE_PID

Synopsis
--------

.. c:macro:: DMX_REMOVE_PID

``int ioctl(fd, DMX_REMOVE_PID, __u16 *pid)``

Arguments
---------

``fd``
    File descriptor returned by :c:func:`open()`.

``pid``
    PID of the PES filter to be removed.

Description
-----------

This ioctl call allows to remove a PID when multiple PIDs are set on a
transport stream filter, e. g. a filter previously set up with output
equal to :c:type:`DMX_OUT_TSDEMUX_TAP <dmx_output>`, created via either
:ref:`DMX_SET_PES_FILTER` or :ref:`DMX_ADD_PID`.

Return Value
------------

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _DMX_REQBUFS:

*****************
ioctl DMX_REQBUFS
*****************

Name
====

DMX_REQBUFS - Initiate Memory Mapping and/or DMA buffer I/O

.. warning:: this API is still experimental

Synopsis
========

.. c:macro:: DMX_REQBUFS

``int ioctl(int fd, DMX_REQBUFS, struct dmx_requestbuffers *argp)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``argp``
    Pointer to struct :c:type:`dmx_requestbuffers`.

Description
===========

This ioctl is used to initiate a memory mapped or DMABUF based demux I/O.

Memory mapped buffers are located in device memory and must be allocated
with this ioctl before they can be mapped into the application's address
space. User buffers are allocated by applications themselves, and this
ioctl is merely used to switch the driver into user pointer I/O mode and
to setup some internal structures. Similarly, DMABUF buffers are
allocated by applications through a device driver, and this ioctl only
configures the driver into DMABUF I/O mode without performing any direct
allocation.

To allocate device buffers applications initialize all fields of the
struct :c:type:`dmx_requestbuffers` structure. They set the  ``count`` field
to the desired number of buffers,  and ``size`` to the size of each
buffer.

When the ioctl is called with a pointer to this structure, the driver will
attempt to allocate the requested number of buffers and it stores the actual
number allocated in the ``count`` field. The ``count`` can be smaller than the number requested, even zero, when the driver runs out of free memory. A larger
number is also possible when the driver requires more buffers to
function correctly. The actual allocated buffer size can is returned
at ``size``, and can be smaller than what's requested.

When this I/O method is not supported, the ioctl returns an ``EOPNOTSUPP``
error code.

Applications can call :ref:`DMX_REQBUFS` again to change the number of
buffers, however this cannot succeed when any buffers are still mapped.
A ``count`` value of zero frees all buffers, after aborting or finishing
any DMA in progress.

Return Value
============

On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.

EOPNOTSUPP
    The  the requested I/O method is not supported.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _DMX_SET_BUFFER_SIZE:

===================
DMX_SET_BUFFER_SIZE
===================

Name
----

DMX_SET_BUFFER_SIZE

Synopsis
--------

.. c:macro:: DMX_SET_BUFFER_SIZE

``int ioctl(int fd, DMX_SET_BUFFER_SIZE, unsigned long size)``

Arguments
---------

``fd``
    File descriptor returned by :c:func:`open()`.

``size``
    Unsigned long size

Description
-----------

This ioctl call is used to set the size of the circular buffer used for
filtered data. The default size is two maximum sized sections, i.e. if
this function is not called a buffer size of ``2 * 4096`` bytes will be
used.

Return Value
------------

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _DMX_SET_FILTER:

==============
DMX_SET_FILTER
==============

Name
----

DMX_SET_FILTER

Synopsis
--------

.. c:macro:: DMX_SET_FILTER

``int ioctl(int fd, DMX_SET_FILTER, struct dmx_sct_filter_params *params)``

Arguments
---------

``fd``
    File descriptor returned by :c:func:`open()`.

``params``

    Pointer to structure containing filter parameters.

Description
-----------

This ioctl call sets up a filter according to the filter and mask
parameters provided. A timeout may be defined stating number of seconds
to wait for a section to be loaded. A value of 0 means that no timeout
should be applied. Finally there is a flag field where it is possible to
state whether a section should be CRC-checked, whether the filter should
be a "one-shot" filter, i.e. if the filtering operation should be
stopped after the first section is received, and whether the filtering
operation should be started immediately (without waiting for a
:ref:`DMX_START` ioctl call). If a filter was previously set-up, this
filter will be canceled, and the receive buffer will be flushed.

Return Value
------------

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _DMX_SET_PES_FILTER:

==================
DMX_SET_PES_FILTER
==================

Name
----

DMX_SET_PES_FILTER

Synopsis
--------

.. c:macro:: DMX_SET_PES_FILTER

``int ioctl(int fd, DMX_SET_PES_FILTER, struct dmx_pes_filter_params *params)``

Arguments
---------

``fd``
    File descriptor returned by :c:func:`open()`.

``params``
    Pointer to structure containing filter parameters.

Description
-----------

This ioctl call sets up a PES filter according to the parameters
provided. By a PES filter is meant a filter that is based just on the
packet identifier (PID), i.e. no PES header or payload filtering
capability is supported.

Return Value
------------

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|

.. flat-table::
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 16

    -  .. row 1

       -  ``EBUSY``

       -  This error code indicates that there are conflicting requests.
	  There are active filters filtering data from another input source.
	  Make sure that these filters are stopped before starting this
	  filter.

The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _DMX_START:

=========
DMX_START
=========

Name
----

DMX_START

Synopsis
--------

.. c:macro:: DMX_START

``int ioctl(int fd, DMX_START)``

Arguments
---------

``fd``
    File descriptor returned by :c:func:`open()`.

Description
-----------

This ioctl call is used to start the actual filtering operation defined
via the ioctl calls :ref:`DMX_SET_FILTER` or :ref:`DMX_SET_PES_FILTER`.

Return Value
------------

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|

.. flat-table::
    :header-rows:  0
    :stub-columns: 0

    -  .. row 1

       -  ``EINVAL``

       -  Invalid argument, i.e. no filtering parameters provided via the
	  :ref:`DMX_SET_FILTER` or :ref:`DMX_SET_PES_FILTER` ioctls.

    -  .. row 2

       -  ``EBUSY``

       -  This error code indicates that there are conflicting requests.
	  There are active filters filtering data from another input source.
	  Make sure that these filters are stopped before starting this
	  filter.

The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _DMX_STOP:

========
DMX_STOP
========

Name
----

DMX_STOP

Synopsis
--------

.. c:macro:: DMX_STOP

``int ioctl(int fd, DMX_STOP)``

Arguments
---------

``fd``
    File descriptor returned by :c:func:`open()`.

Description
-----------

This ioctl call is used to stop the actual filtering operation defined
via the ioctl calls :ref:`DMX_SET_FILTER` or :ref:`DMX_SET_PES_FILTER` and
started via the :ref:`DMX_START` command.

Return Value
------------

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. _dmx_fcalls:

********************
Demux Function Calls
********************

.. toctree::
    :maxdepth: 1

    dmx-fopen
    dmx-fclose
    dmx-fread
    dmx-fwrite
    dmx-mmap
    dmx-munmap
    dmx-start
    dmx-stop
    dmx-set-filter
    dmx-set-pes-filter
    dmx-set-buffer-size
    dmx-get-stc
    dmx-get-pes-pids
    dmx-add-pid
    dmx-remove-pid
    dmx-reqbufs
    dmx-querybuf
    dmx-expbuf
    dmx-qbuf


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. _dmx_types:

****************
Demux Data Types
****************

.. kernel-doc:: include/uapi/linux/dvb/dmx.h


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. _dvb-fe-read-status:

***************************************
Querying frontend status and statistics
***************************************

Once :ref:`FE_SET_PROPERTY <FE_GET_PROPERTY>` is called, the
frontend will run a kernel thread that will periodically check for the
tuner lock status and provide statistics about the quality of the
signal.

The information about the frontend tuner locking status can be queried
using :ref:`FE_READ_STATUS`.

Signal statistics are provided via
:ref:`FE_GET_PROPERTY`.

.. note::

   Most statistics require the demodulator to be fully locked
   (e. g. with :c:type:`FE_HAS_LOCK <fe_status>` bit set). See
   :ref:`Frontend statistics indicators <frontend-stat-properties>` for
   more details.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. c:type:: dvb_frontend_event

***************
frontend events
***************

.. code-block:: c

     struct dvb_frontend_event {
	 fe_status_t status;
	 struct dvb_frontend_parameters parameters;
     };


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. c:type:: dvb_frontend_parameters

*******************
frontend parameters
*******************

The kind of parameters passed to the frontend device for tuning depend
on the kind of hardware you are using.

The struct ``dvb_frontend_parameters`` uses a union with specific
per-system parameters. However, as newer delivery systems required more
data, the structure size weren't enough to fit, and just extending its
size would break the existing applications. So, those parameters were
replaced by the usage of
:ref:`FE_GET_PROPERTY/FE_SET_PROPERTY <FE_GET_PROPERTY>`
ioctl's. The new API is flexible enough to add new parameters to
existing delivery systems, and to add newer delivery systems.

So, newer applications should use
:ref:`FE_GET_PROPERTY/FE_SET_PROPERTY <FE_GET_PROPERTY>`
instead, in order to be able to support the newer System Delivery like
DVB-S2, DVB-T2, DVB-C2, ISDB, etc.

All kinds of parameters are combined as a union in the
``dvb_frontend_parameters`` structure:

.. code-block:: c

    struct dvb_frontend_parameters {
	uint32_t frequency;     /* (absolute) frequency in Hz for QAM/OFDM */
		    /* intermediate frequency in kHz for QPSK */
	fe_spectral_inversion_t inversion;
	union {
	    struct dvb_qpsk_parameters qpsk;
	    struct dvb_qam_parameters  qam;
	    struct dvb_ofdm_parameters ofdm;
	    struct dvb_vsb_parameters  vsb;
	} u;
    };

In the case of QPSK frontends the ``frequency`` field specifies the
intermediate frequency, i.e. the offset which is effectively added to
the local oscillator frequency (LOF) of the LNB. The intermediate
frequency has to be specified in units of kHz. For QAM and OFDM
frontends the ``frequency`` specifies the absolute frequency and is
given in Hz.

.. c:type:: dvb_qpsk_parameters

QPSK parameters
===============

For satellite QPSK frontends you have to use the ``dvb_qpsk_parameters``
structure:

.. code-block:: c

     struct dvb_qpsk_parameters {
	 uint32_t        symbol_rate;  /* symbol rate in Symbols per second */
	 fe_code_rate_t  fec_inner;    /* forward error correction (see above) */
     };

.. c:type:: dvb_qam_parameters

QAM parameters
==============

for cable QAM frontend you use the ``dvb_qam_parameters`` structure:

.. code-block:: c

     struct dvb_qam_parameters {
	 uint32_t         symbol_rate; /* symbol rate in Symbols per second */
	 fe_code_rate_t   fec_inner;   /* forward error correction (see above) */
	 fe_modulation_t  modulation;  /* modulation type (see above) */
     };

.. c:type:: dvb_vsb_parameters

VSB parameters
==============

ATSC frontends are supported by the ``dvb_vsb_parameters`` structure:

.. code-block:: c

    struct dvb_vsb_parameters {
	fe_modulation_t modulation; /* modulation type (see above) */
    };

.. c:type:: dvb_ofdm_parameters

OFDM parameters
===============

DVB-T frontends are supported by the ``dvb_ofdm_parameters`` structure:

.. code-block:: c

     struct dvb_ofdm_parameters {
	 fe_bandwidth_t      bandwidth;
	 fe_code_rate_t      code_rate_HP;  /* high priority stream code rate */
	 fe_code_rate_t      code_rate_LP;  /* low priority stream code rate */
	 fe_modulation_t     constellation; /* modulation type (see above) */
	 fe_transmit_mode_t  transmission_mode;
	 fe_guard_interval_t guard_interval;
	 fe_hierarchy_t      hierarchy_information;
     };


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. include:: <isonum.txt>

.. _dvbapi:

########################
Part II - Digital TV API
########################

.. note::

   This API is also known as Linux **DVB API**.

   It it was originally written to support the European digital TV
   standard (DVB), and later extended to support all digital TV standards.

   In order to avoid confusion, within this document, it was opted to refer to
   it, and to associated hardware as **Digital TV**.

   The word **DVB** is reserved to be used for:

     - the Digital TV API version
       (e. g. DVB API version 3 or DVB API version 5);
     - digital TV data types (enums, structs, defines, etc);
     - digital TV device nodes (``/dev/dvb/...``);
     - the European DVB standard.

**Version 5.10**

.. only:: html

   .. class:: toc-title

        Table of Contents

.. toctree::
    :maxdepth: 5
    :numbered:

    intro
    frontend
    demux
    ca
    net
    legacy_dvb_apis
    examples
    headers

**********************
Revision and Copyright
**********************

Authors:

- J. K. Metzler, Ralph <rjkm@metzlerbros.de>

 - Original author of the Digital TV API documentation.

- O. C. Metzler, Marcus <rjkm@metzlerbros.de>

 - Original author of the Digital TV API documentation.

- Carvalho Chehab, Mauro <mchehab+samsung@kernel.org>

 - Ported document to Docbook XML, addition of DVBv5 API, documentation gaps fix.

**Copyright** |copy| 2002-2003 : Convergence GmbH

**Copyright** |copy| 2009-2017 : Mauro Carvalho Chehab

****************
Revision History
****************

:revision: 2.2.0 / 2017-09-01 (*mcc*)

Most gaps between the uAPI document and the Kernel implementation
got fixed for the non-legacy API.

:revision: 2.1.0 / 2015-05-29 (*mcc*)

DocBook improvements and cleanups, in order to document the system calls
on a more standard way and provide more description about the current
Digital TV API.

:revision: 2.0.4 / 2011-05-06 (*mcc*)

Add more information about DVBv5 API, better describing the frontend
GET/SET props ioctl's.

:revision: 2.0.3 / 2010-07-03 (*mcc*)

Add some frontend capabilities flags, present on kernel, but missing at
the specs.

:revision: 2.0.2 / 2009-10-25 (*mcc*)

documents FE_SET_FRONTEND_TUNE_MODE and
FE_DISHETWORK_SEND_LEGACY_CMD ioctls.

:revision: 2.0.1 / 2009-09-16 (*mcc*)

Added ISDB-T test originally written by Patrick Boettcher

:revision: 2.0.0 / 2009-09-06 (*mcc*)

Conversion from LaTex to DocBook XML. The contents is the same as the
original LaTex version.

:revision: 1.0.0 / 2003-07-24 (*rjkm*)

Initial revision on LaTEX.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. _frontend-properties:

**************
Property types
**************

Tuning into a Digital TV physical channel and starting decoding it
requires changing a set of parameters, in order to control the tuner,
the demodulator, the Linear Low-noise Amplifier (LNA) and to set the
antenna subsystem via Satellite Equipment Control - SEC (on satellite
systems). The actual parameters are specific to each particular digital
TV standards, and may change as the digital TV specs evolves.

In the past (up to DVB API version 3 - DVBv3), the strategy used was to have a
union with the parameters needed to tune for DVB-S, DVB-C, DVB-T and
ATSC delivery systems grouped there. The problem is that, as the second
generation standards appeared, the size of such union was not big
enough to group the structs that would be required for those new
standards. Also, extending it would break userspace.

So, the legacy union/struct based approach was deprecated, in favor
of a properties set approach. On such approach,
:ref:`FE_GET_PROPERTY and FE_SET_PROPERTY <FE_GET_PROPERTY>` are used
to setup the frontend and read its status.

The actual action is determined by a set of dtv_property cmd/data pairs.
With one single ioctl, is possible to get/set up to 64 properties.

This section describes the new and recommended way to set the frontend,
with supports all digital TV delivery systems.

.. note::

   1. On Linux DVB API version 3, setting a frontend was done via
      struct :c:type:`dvb_frontend_parameters`.

   2. Don't use DVB API version 3 calls on hardware with supports
      newer standards. Such API provides no support or a very limited
      support to new standards and/or new hardware.

   3. Nowadays, most frontends support multiple delivery systems.
      Only with DVB API version 5 calls it is possible to switch between
      the multiple delivery systems supported by a frontend.

   4. DVB API version 5 is also called *S2API*, as the first
      new standard added to it was DVB-S2.

**Example**: in order to set the hardware to tune into a DVB-C channel
at 651 kHz, modulated with 256-QAM, FEC 3/4 and symbol rate of 5.217
Mbauds, those properties should be sent to
:ref:`FE_SET_PROPERTY <FE_GET_PROPERTY>` ioctl:

  :ref:`DTV_DELIVERY_SYSTEM <DTV-DELIVERY-SYSTEM>` = SYS_DVBC_ANNEX_A

  :ref:`DTV_FREQUENCY <DTV-FREQUENCY>` = 651000000

  :ref:`DTV_MODULATION <DTV-MODULATION>` = QAM_256

  :ref:`DTV_INVERSION <DTV-INVERSION>` = INVERSION_AUTO

  :ref:`DTV_SYMBOL_RATE <DTV-SYMBOL-RATE>` = 5217000

  :ref:`DTV_INNER_FEC <DTV-INNER-FEC>` = FEC_3_4

  :ref:`DTV_TUNE <DTV-TUNE>`

The code that would that would do the above is show in
:ref:`dtv-prop-example`.

.. code-block:: c
    :caption: Example: Setting digital TV frontend properties
    :name: dtv-prop-example

    #include <stdio.h>
    #include <fcntl.h>
    #include <sys/ioctl.h>
    #include <linux/dvb/frontend.h>

    static struct dtv_property props[] = {
	{ .cmd = DTV_DELIVERY_SYSTEM, .u.data = SYS_DVBC_ANNEX_A },
	{ .cmd = DTV_FREQUENCY,       .u.data = 651000000 },
	{ .cmd = DTV_MODULATION,      .u.data = QAM_256 },
	{ .cmd = DTV_INVERSION,       .u.data = INVERSION_AUTO },
	{ .cmd = DTV_SYMBOL_RATE,     .u.data = 5217000 },
	{ .cmd = DTV_INNER_FEC,       .u.data = FEC_3_4 },
	{ .cmd = DTV_TUNE }
    };

    static struct dtv_properties dtv_prop = {
	.num = 6, .props = props
    };

    int main(void)
    {
	int fd = open("/dev/dvb/adapter0/frontend0", O_RDWR);

	if (!fd) {
	    perror ("open");
	    return -1;
	}
	if (ioctl(fd, FE_SET_PROPERTY, &dtv_prop) == -1) {
	    perror("ioctl");
	    return -1;
	}
	printf("Frontend set\\n");
	return 0;
    }

.. attention:: While it is possible to directly call the Kernel code like the
   above example, it is strongly recommended to use
   `libdvbv5 <https://linuxtv.org/docs/libdvbv5/index.html>`__, as it
   provides abstraction to work with the supported digital TV standards and
   provides methods for usual operations like program scanning and to
   read/write channel descriptor files.

.. toctree::
    :maxdepth: 1

    fe_property_parameters
    frontend-stat-properties
    frontend-property-terrestrial-systems
    frontend-property-cable-systems
    frontend-property-satellite-systems
    frontend-header


code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later -->
<svg id="svg2" width="15.847cm" height="8.4187cm" fill-rule="evenodd" stroke-linejoin="round" stroke-width="28.222" preserveAspectRatio="xMidYMid" version="1.2" viewBox="0 0 23770.123 12628.122" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><defs id="defs142"><marker id="Arrow1Lend" overflow="visible" orient="auto"><path id="path954" transform="matrix(-.8 0 0 -.8 -10 0)" d="m0 0 5-5-17.5 5 17.5 5z" fill-rule="evenodd" stroke="#000" stroke-width="1pt"/></marker><marker id="marker1243" overflow="visible" orient="auto"><path id="path1241" transform="matrix(-.8 0 0 -.8 -10 0)" d="m0 0 5-5-17.5 5 17.5 5z" fill-rule="evenodd" stroke="#000" stroke-width="1pt"/></marker></defs><metadata id="metadata519"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata><rect id="rect197" class="BoundingBox" x="5355.1" y="13.122" width="18403" height="9603" fill="none"/><path id="path199" d="m14556 9614.1h-9200v-9600h18400v9600z" fill="#fff"/><path id="path201" d="m14556 9614.1h-9200v-9600h18400v9600z" fill="none" stroke="#000"/><rect id="rect206" class="BoundingBox" x="13.122" y="4013.1" width="4544" height="2403" fill="none"/><path id="path208" d="m2285.1 6414.1h-2271v-2400h4541v2400z" fill="#fff"/><path id="path210" d="m2285.1 6414.1h-2271v-2400h4541v2400z" fill="none" stroke="#000"/><text id="text212" class="TextShape" x="-2443.8779" y="-4585.8779"><tspan id="tspan214" class="TextParagraph" font-family="sans-serif" font-size="635px" font-weight="400"><tspan id="tspan216" class="TextPosition"
x="1013.1317" y="5435.1221"><tspan id="tspan218" fill="#000000">Antenna</tspan></tspan></tspan></text>
<rect id="rect223" class="BoundingBox" x="6213.1" y="1813.1" width="4544" height="2403" fill="none"/><path id="path225" d="m8485.1 4214.1h-2271v-2400h4541v2400z" fill="#fff"/><path id="path227" d="m8485.1 4214.1h-2271v-2400h4541v2400z" fill="none" stroke="#000"/><text id="text229" class="TextShape" x="-2443.8779" y="-4585.8779"><tspan id="tspan231" class="TextParagraph" font-family="sans-serif" font-size="635px" font-weight="400"><tspan id="tspan233" class="TextPosition" x="7217.1221" y="3235.1221"><tspan id="tspan235" fill="#000000">Frontend</tspan></tspan></tspan></text>
<rect id="rect240" class="BoundingBox" x="12113" y="1813.1" width="4544" height="2403" fill="none"/><path id="path242" d="m14385 4214.1h-2271v-2400h4541v2400z" fill="#fff"/><path id="path244" d="m14385 4214.1h-2271v-2400h4541v2400z" fill="none" stroke="#000"/><text id="text246" class="TextShape" x="-2443.8779" y="-4585.8779"><tspan id="tspan248" class="TextParagraph" font-family="sans-serif" font-size="635px" font-weight="400"><tspan id="tspan250" class="TextPosition" x="13944.122" y="3235.1221"><tspan id="tspan252" fill="#000000">CA</tspan></tspan></tspan></text>
<rect id="rect257" class="BoundingBox" x="18113" y="1813.1" width="4544" height="2403" fill="none"/><path id="path259" d="m20385 4214.1h-2271v-2400h4541v2400z" fill="#fff"/><path id="path261" d="m20385 4214.1h-2271v-2400h4541v2400z" fill="none" stroke="#000"/><text id="text263" class="TextShape" x="-2443.8779" y="-4585.8779"><tspan id="tspan265" class="TextParagraph" font-family="sans-serif" font-size="635px" font-weight="400"><tspan id="tspan267" class="TextPosition" x="19384.123" y="3235.1221"><tspan id="tspan269" fill="#000000">Demux</tspan></tspan></tspan></text>
<rect id="rect274" class="BoundingBox" x="6113.1" y="5813.1" width="4544" height="2403" fill="none"/><path id="path276" d="m8385.1 8214.1h-2271v-2400h4541v2400z" fill="#fff"/><path id="path278" d="m8385.1 8214.1h-2271v-2400h4541v2400z" fill="none" stroke="#000"/><text id="text280" class="TextShape" x="-2443.8779" y="-4585.8779"><tspan id="tspan282" class="TextParagraph" font-family="sans-serif" font-size="635px" font-weight="400"><tspan id="tspan284" class="TextPosition" x="7733.1221" y="7235.1221"><tspan id="tspan286" fill="#000000">SEC</tspan></tspan></tspan></text>
<rect id="rect291" class="BoundingBox" x="12213" y="5813.1" width="4544" height="2403" fill="none"/><path id="path293" d="m14485 8214.1h-2271v-2400h4541v2400z" fill="#fff"/><path id="path295" d="m14485 8214.1h-2271v-2400h4541v2400z" fill="none" stroke="#000" stroke-dasharray="28.22200113,56.44400226" stroke-width="28.222"/><text id="text297" class="TextShape" x="-2443.8779" y="-4903.3779"><tspan id="tspan299" class="TextParagraph" font-family="sans-serif" font-size="635px" font-weight="400"><tspan id="tspan301" class="TextPosition" x="13676.122" y="6917.6221"><tspan id="tspan303" fill="#000000">Audio</tspan></tspan></tspan></text>
<rect id="rect308" class="BoundingBox" x="18113" y="5813.1" width="4544" height="2403" fill="none"/><path id="path310" d="m20385 8214.1h-2271v-2400h4541v2400z" fill="#fff"/><path id="path312" d="m20385 8214.1h-2271v-2400h4541v2400z" fill="none" stroke="#000" stroke-dasharray="28.22200113,56.44400226" stroke-width="28.222"/><text id="text314" class="TextShape" x="-2443.8779" y="-4903.3779"><tspan id="tspan316" class="TextParagraph" font-family="sans-serif" font-size="635px" font-weight="400"><tspan id="tspan318" class="TextPosition" x="19583.123" y="6917.6221"><tspan id="tspan320" fill="#000000">Video</tspan></tspan></tspan></text>
<rect id="rect325" class="BoundingBox" x="15213" y="10213" width="4544" height="2403" fill="none"/><path id="path327" d="m17485 12614h-2271v-2400h4541v2400z" fill="#fff"/><path id="path329" d="m17485 12614h-2271v-2400h4541v2400z" fill="none" stroke="#000" stroke-dasharray="28.22200113,56.44400226" stroke-width="28.222"/><text id="text331" class="TextShape" x="-2443.8779" y="-4585.8779"><tspan id="tspan333" class="TextParagraph" font-family="sans-serif" font-size="635px" font-weight="400"><tspan id="tspan335" class="TextPosition" x="17076.123" y="11635.122"><tspan id="tspan337" fill="#000000">TV</tspan></tspan></tspan></text>
<rect id="rect342" class="BoundingBox" x="4555.1" y="3014.1" width="1661" height="2202" fill="none"/><path id="path344" d="m4556.1 5214.1 1400-1857" fill="none" stroke="#000"/><path id="path346" d="m6215.1 3014.1-391 269 240 181z"/><rect id="rect351" class="BoundingBox" x="4555.1" y="5213.1" width="1561" height="1802" fill="none"/><path id="path353" d="m4556.1 5214.1 1277 1475" fill="none" stroke="#000"/><path id="path355" d="m6115.1 7014.1-181-438-227 196z"/><rect id="rect360" class="BoundingBox" x="10755" y="2864.1" width="1361" height="301" fill="none"/><path id="path362" d="m10756 3014.1h929" fill="none" stroke="#000"/><path id="path364" d="m12115 3014.1-450-150v300z"/><rect id="rect369" class="BoundingBox" x="16655" y="2864.1" width="1461" height="301" fill="none"/><path id="path371" d="m16656 3014.1h1029" fill="none" stroke="#000"/><path id="path373" d="m18115
3014.1-450-150v300z"/><rect id="rect378" class="BoundingBox" x="20235" y="4213.1" width="301" height="1602" fill="none"/><rect id="rect387" class="BoundingBox" x="17485" y="8213.1" width="2902" height="2002" fill="none"/><path id="path389" d="m20385 8214.1-2546 1756" fill="none" stroke="#000" stroke-dasharray="28.22200113,56.44400226" stroke-width="28.222"/><path id="path391" d="m17485 10214 456-132-171-247z"/><rect id="rect396" class="BoundingBox" x="14484" y="8213.1" width="3002" height="2002" fill="none"/><path id="path398" d="m14485 8214.1 2642 1761" fill="none" stroke="#000" stroke-dasharray="28.22200113,56.44400226" stroke-width="28.222"/><path id="path400" d="m17485 10214-291-374-167 249z"/><rect id="rect405" class="BoundingBox" x="14485" y="4213.1" width="5902" height="1629" fill="none"/><path id="path949" d="m20387 4213.1v1629" fill="none" marker-end="url(#Arrow1Lend)"
stroke="#000" stroke-dasharray="26.45879596, 52.91759192999999328" stroke-linejoin="miter" stroke-width="26.459"/><path id="path1233" d="m20385 4214.1-3628 1599" fill="none" marker-end="url(#marker1243)" stroke="#000" stroke-dasharray="26.45879596, 52.91759193" stroke-linejoin="miter" stroke-width="26.459"/><text id="text297-3" class="TextShape" x="-2911.9202" y="-4257.2061" font-size="12px" stroke-width="1"><tspan id="tspan299-6" class="TextParagraph" font-family="sans-serif" font-size="635px" font-weight="400" stroke-width="1"><tspan id="tspan301-7" class="TextPosition" x="13208.079" y="7563.793" stroke-width="1"><tspan id="tspan303-5" fill="#000000" stroke-width="1">Decoder</tspan></tspan></tspan></text>
<text id="text297-3-3" class="TextShape" x="2950.9287" y="-4259.5928" font-size="12px" stroke-width="1"><tspan id="tspan299-6-5" class="TextParagraph" font-family="sans-serif" font-size="635px" font-weight="400" stroke-width="1"><tspan id="tspan301-7-6" class="TextPosition" x="19070.928" y="7561.4053" stroke-width="1"><tspan id="tspan303-5-2" fill="#000000" stroke-width="1">Decoder</tspan></tspan></tspan></text>
</svg>


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. _dvb_examples:

********
Examples
********

In the past, we used to have a set of examples here. However, those
examples got out of date and doesn't even compile nowadays.

Also, nowadays, the best is to use the libdvbv5 DVB API nowadays,
with is fully documented.

Please refer to the `libdvbv5 <https://linuxtv.org/docs/libdvbv5/index.html>`__
for updated/recommended examples.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

******************
Frontend bandwidth
******************

.. c:type:: fe_bandwidth

.. flat-table:: enum fe_bandwidth
    :header-rows:  1
    :stub-columns: 0

    -  .. row 1

       -  ID

       -  Description

    -  .. row 2

       -  .. _BANDWIDTH-AUTO:

	  ``BANDWIDTH_AUTO``

       -  Autodetect bandwidth (if supported)

    -  .. row 3

       -  .. _BANDWIDTH-1-712-MHZ:

	  ``BANDWIDTH_1_712_MHZ``

       -  1.712 MHz

    -  .. row 4

       -  .. _BANDWIDTH-5-MHZ:

	  ``BANDWIDTH_5_MHZ``

       -  5 MHz

    -  .. row 5

       -  .. _BANDWIDTH-6-MHZ:

	  ``BANDWIDTH_6_MHZ``

       -  6 MHz

    -  .. row 6

       -  .. _BANDWIDTH-7-MHZ:

	  ``BANDWIDTH_7_MHZ``

       -  7 MHz

    -  .. row 7

       -  .. _BANDWIDTH-8-MHZ:

	  ``BANDWIDTH_8_MHZ``

       -  8 MHz

    -  .. row 8

       -  .. _BANDWIDTH-10-MHZ:

	  ``BANDWIDTH_10_MHZ``

       -  10 MHz


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_DISEQC_RECV_SLAVE_REPLY:

********************************
ioctl FE_DISEQC_RECV_SLAVE_REPLY
********************************

Name
====

FE_DISEQC_RECV_SLAVE_REPLY - Receives reply from a DiSEqC 2.0 command

Synopsis
========

.. c:macro:: FE_DISEQC_RECV_SLAVE_REPLY

``int ioctl(int fd, FE_DISEQC_RECV_SLAVE_REPLY, struct dvb_diseqc_slave_reply *argp)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``argp``
    pointer to struct :c:type:`dvb_diseqc_slave_reply`.

Description
===========

Receives reply from a DiSEqC 2.0 command.

The received message is stored at the buffer pointed by ``argp``.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_DISEQC_RESET_OVERLOAD:

******************************
ioctl FE_DISEQC_RESET_OVERLOAD
******************************

Name
====

FE_DISEQC_RESET_OVERLOAD - Restores the power to the antenna subsystem, if it was powered off due - to power overload.

Synopsis
========

.. c:macro:: FE_DISEQC_RESET_OVERLOAD

``int ioctl(int fd, FE_DISEQC_RESET_OVERLOAD, NULL)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

Description
===========

If the bus has been automatically powered off due to power overload,
this ioctl call restores the power to the bus. The call requires
read/write access to the device. This call has no effect if the device
is manually powered off. Not all Digital TV adapters support this ioctl.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_DISEQC_SEND_BURST:

**************************
ioctl FE_DISEQC_SEND_BURST
**************************

Name
====

FE_DISEQC_SEND_BURST - Sends a 22KHz tone burst for 2x1 mini DiSEqC satellite selection.

Synopsis
========

.. c:macro:: FE_DISEQC_SEND_BURST

``int ioctl(int fd, FE_DISEQC_SEND_BURST, enum fe_sec_mini_cmd tone)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``tone``
    An integer enumered value described at :c:type:`fe_sec_mini_cmd`.

Description
===========

This ioctl is used to set the generation of a 22kHz tone burst for mini
DiSEqC satellite selection for 2x1 switches. This call requires
read/write permissions.

It provides support for what's specified at
`Digital Satellite Equipment Control (DiSEqC) - Simple "ToneBurst" Detection Circuit specification. <http://www.eutelsat.com/files/contributed/satellites/pdf/Diseqc/associated%20docs/simple_tone_burst_detec.pdf>`__

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_DISEQC_SEND_MASTER_CMD:

*******************************
ioctl FE_DISEQC_SEND_MASTER_CMD
*******************************

Name
====

FE_DISEQC_SEND_MASTER_CMD - Sends a DiSEqC command

Synopsis
========

.. c:macro:: FE_DISEQC_SEND_MASTER_CMD

``int ioctl(int fd, FE_DISEQC_SEND_MASTER_CMD, struct dvb_diseqc_master_cmd *argp)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``argp``
    pointer to struct
    :c:type:`dvb_diseqc_master_cmd`

Description
===========

Sends the DiSEqC command pointed by :c:type:`dvb_diseqc_master_cmd`
to the antenna subsystem.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_DISHNETWORK_SEND_LEGACY_CMD:

******************************
FE_DISHNETWORK_SEND_LEGACY_CMD
******************************

Name
====

FE_DISHNETWORK_SEND_LEGACY_CMD

Synopsis
========

.. c:macro:: FE_DISHNETWORK_SEND_LEGACY_CMD

``int ioctl(int fd, FE_DISHNETWORK_SEND_LEGACY_CMD, unsigned long cmd)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``cmd``
    Sends the specified raw cmd to the dish via DISEqC.

Description
===========

.. warning::
   This is a very obscure legacy command, used only at stv0299
   driver. Should not be used on newer drivers.

It provides a non-standard method for selecting Diseqc voltage on the
frontend, for Dish Network legacy switches.

As support for this ioctl were added in 2004, this means that such
dishes were already legacy in 2004.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_ENABLE_HIGH_LNB_VOLTAGE:

********************************
ioctl FE_ENABLE_HIGH_LNB_VOLTAGE
********************************

Name
====

FE_ENABLE_HIGH_LNB_VOLTAGE - Select output DC level between normal LNBf voltages or higher LNBf - voltages.

Synopsis
========

.. c:macro:: FE_ENABLE_HIGH_LNB_VOLTAGE

``int ioctl(int fd, FE_ENABLE_HIGH_LNB_VOLTAGE, unsigned int high)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``high``
    Valid flags:

    -  0 - normal 13V and 18V.

    -  >0 - enables slightly higher voltages instead of 13/18V, in order
       to compensate for long antenna cables.

Description
===========

Select output DC level between normal LNBf voltages or higher LNBf
voltages between 0 (normal) or a value grater than 0 for higher
voltages.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_GET_EVENT:

************
FE_GET_EVENT
************

Name
====

FE_GET_EVENT

.. attention:: This ioctl is deprecated.

Synopsis
========

.. c:macro:: FE_GET_EVENT

``int ioctl(int fd, FE_GET_EVENT, struct dvb_frontend_event *ev)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``ev``
    Points to the location where the event, if any, is to be stored.

Description
===========

This ioctl call returns a frontend event if available. If an event is
not available, the behavior depends on whether the device is in blocking
or non-blocking mode. In the latter case, the call fails immediately
with errno set to ``EWOULDBLOCK``. In the former case, the call blocks until
an event becomes available.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

.. flat-table::
    :header-rows:  0
    :stub-columns: 0

    -  .. row 1

       -  ``EWOULDBLOCK``

       -  There is no event pending, and the device is in non-blocking mode.

    -  .. row 2

       -  ``EOVERFLOW``

       -  Overflow in event queue - one or more events were lost.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_GET_FRONTEND:

***************
FE_GET_FRONTEND
***************

Name
====

FE_GET_FRONTEND

.. attention:: This ioctl is deprecated.

Synopsis
========

.. c:macro:: FE_GET_FRONTEND

``int ioctl(int fd, FE_GET_FRONTEND, struct dvb_frontend_parameters *p)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``p``
    Points to parameters for tuning operation.

Description
===========

This ioctl call queries the currently effective frontend parameters. For
this command, read-only access to the device is sufficient.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

.. flat-table::
    :header-rows:  0
    :stub-columns: 0

    -  .. row 1

       -  ``EINVAL``

       -  Maximum supported symbol rate reached.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_GET_INFO:

*****************
ioctl FE_GET_INFO
*****************

Name
====

FE_GET_INFO - Query Digital TV frontend capabilities and returns information
about the - front-end. This call only requires read-only access to the device.

Synopsis
========

.. c:macro:: FE_GET_INFO

``int ioctl(int fd, FE_GET_INFO, struct dvb_frontend_info *argp)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``argp``
    pointer to struct :c:type:`dvb_frontend_info`

Description
===========

All Digital TV frontend devices support the :ref:`FE_GET_INFO` ioctl. It is
used to identify kernel devices compatible with this specification and to
obtain information about driver and hardware capabilities. The ioctl
takes a pointer to dvb_frontend_info which is filled by the driver.
When the driver is not compatible with this specification the ioctl
returns an error.

frontend capabilities
=====================

Capabilities describe what a frontend can do. Some capabilities are
supported only on some specific frontend types.

The frontend capabilities are described at :c:type:`fe_caps`.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_GET_PROPERTY:

**************************************
ioctl FE_SET_PROPERTY, FE_GET_PROPERTY
**************************************

Name
====

FE_SET_PROPERTY - FE_GET_PROPERTY - FE_SET_PROPERTY sets one or more frontend properties. - FE_GET_PROPERTY returns one or more frontend properties.

Synopsis
========

.. c:macro:: FE_GET_PROPERTY

``int ioctl(int fd, FE_GET_PROPERTY, struct dtv_properties *argp)``

.. c:macro:: FE_SET_PROPERTY

``int ioctl(int fd, FE_SET_PROPERTY, struct dtv_properties *argp)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``argp``
    Pointer to struct :c:type:`dtv_properties`.

Description
===========

All Digital TV frontend devices support the ``FE_SET_PROPERTY`` and
``FE_GET_PROPERTY`` ioctls. The supported properties and statistics
depends on the delivery system and on the device:

-  ``FE_SET_PROPERTY:``

   -  This ioctl is used to set one or more frontend properties.

   -  This is the basic command to request the frontend to tune into
      some frequency and to start decoding the digital TV signal.

   -  This call requires read/write access to the device.

.. note::

   At return, the values aren't updated to reflect the actual
   parameters used. If the actual parameters are needed, an explicit
   call to ``FE_GET_PROPERTY`` is needed.

-  ``FE_GET_PROPERTY:``

   -  This ioctl is used to get properties and statistics from the
      frontend.

   -  No properties are changed, and statistics aren't reset.

   -  This call only requires read-only access to the device.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_READ_BER:

***********
FE_READ_BER
***********

Name
====

FE_READ_BER

.. attention:: This ioctl is deprecated.

Synopsis
========

.. c:macro:: FE_READ_BER

``int ioctl(int fd, FE_READ_BER, uint32_t *ber)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``ber``
    The bit error rate is stored into \*ber.

Description
===========

This ioctl call returns the bit error rate for the signal currently
received/demodulated by the front-end. For this command, read-only
access to the device is sufficient.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_READ_SIGNAL_STRENGTH:

***********************
FE_READ_SIGNAL_STRENGTH
***********************

Name
====

FE_READ_SIGNAL_STRENGTH

.. attention:: This ioctl is deprecated.

Synopsis
========

.. c:macro:: FE_READ_SIGNAL_STRENGTH

``int ioctl(int fd, FE_READ_SIGNAL_STRENGTH, uint16_t *strength)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``strength``
    The signal strength value is stored into \*strength.

Description
===========

This ioctl call returns the signal strength value for the signal
currently received by the front-end. For this command, read-only access
to the device is sufficient.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_READ_SNR:

***********
FE_READ_SNR
***********

Name
====

FE_READ_SNR

.. attention:: This ioctl is deprecated.

Synopsis
========

.. c:macro:: FE_READ_SNR

``int ioctl(int fd, FE_READ_SNR, int16_t *snr)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``snr``
    The signal-to-noise ratio is stored into \*snr.

Description
===========

This ioctl call returns the signal-to-noise ratio for the signal
currently received by the front-end. For this command, read-only access
to the device is sufficient.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_READ_STATUS:

********************
ioctl FE_READ_STATUS
********************

Name
====

FE_READ_STATUS - Returns status information about the front-end. This call only requires - read-only access to the device

Synopsis
========

.. c:macro:: FE_READ_STATUS

``int ioctl(int fd, FE_READ_STATUS, unsigned int *status)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``status``
    pointer to a bitmask integer filled with the values defined by enum
    :c:type:`fe_status`.

Description
===========

All Digital TV frontend devices support the ``FE_READ_STATUS`` ioctl. It is
used to check about the locking status of the frontend after being
tuned. The ioctl takes a pointer to an integer where the status will be
written.

.. note::

   The size of status is actually sizeof(enum fe_status), with
   varies according with the architecture. This needs to be fixed in the
   future.

int fe_status
=============

The fe_status parameter is used to indicate the current state and/or
state changes of the frontend hardware. It is produced using the enum
:c:type:`fe_status` values on a bitmask

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_READ_UNCORRECTED_BLOCKS:

**************************
FE_READ_UNCORRECTED_BLOCKS
**************************

Name
====

FE_READ_UNCORRECTED_BLOCKS

.. attention:: This ioctl is deprecated.

Synopsis
========

.. c:macro:: FE_READ_UNCORRECTED_BLOCKS

``int ioctl(int fd, FE_READ_UNCORRECTED_BLOCKS, uint32_t *ublocks)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``ublocks``
    The total number of uncorrected blocks seen by the driver so far.

Description
===========

This ioctl call returns the number of uncorrected blocks detected by the
device driver during its lifetime. For meaningful measurements, the
increment in block count during a specific time interval should be
calculated. For this command, read-only access to the device is
sufficient.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_SET_FRONTEND_TUNE_MODE:

*******************************
ioctl FE_SET_FRONTEND_TUNE_MODE
*******************************

Name
====

FE_SET_FRONTEND_TUNE_MODE - Allow setting tuner mode flags to the frontend.

Synopsis
========

.. c:macro:: FE_SET_FRONTEND_TUNE_MODE

``int ioctl(int fd, FE_SET_FRONTEND_TUNE_MODE, unsigned int flags)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``flags``
    Valid flags:

    -  0 - normal tune mode

    -  ``FE_TUNE_MODE_ONESHOT`` - When set, this flag will disable any
       zigzagging or other "normal" tuning behaviour. Additionally,
       there will be no automatic monitoring of the lock status, and
       hence no frontend events will be generated. If a frontend device
       is closed, this flag will be automatically turned off when the
       device is reopened read-write.

Description
===========

Allow setting tuner mode flags to the frontend, between 0 (normal) or
``FE_TUNE_MODE_ONESHOT`` mode

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_SET_FRONTEND:

***************
FE_SET_FRONTEND
***************

.. attention:: This ioctl is deprecated.

Name
====

FE_SET_FRONTEND

Synopsis
========

.. c:macro:: FE_SET_FRONTEND

``int ioctl(int fd, FE_SET_FRONTEND, struct dvb_frontend_parameters *p)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``p``
    Points to parameters for tuning operation.

Description
===========

This ioctl call starts a tuning operation using specified parameters.
The result of this call will be successful if the parameters were valid
and the tuning could be initiated. The result of the tuning operation in
itself, however, will arrive asynchronously as an event (see
documentation for :ref:`FE_GET_EVENT` and
FrontendEvent.) If a new :ref:`FE_SET_FRONTEND`
operation is initiated before the previous one was completed, the
previous operation will be aborted in favor of the new one. This command
requires read/write access to the device.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|

.. flat-table::
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 16

    -  .. row 1

       -  ``EINVAL``

       -  Maximum supported symbol rate reached.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_SET_TONE:

*****************
ioctl FE_SET_TONE
*****************

Name
====

FE_SET_TONE - Sets/resets the generation of the continuous 22kHz tone.

Synopsis
========

.. c:macro:: FE_SET_TONE

``int ioctl(int fd, FE_SET_TONE, enum fe_sec_tone_mode tone)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``tone``
    an integer enumered value described at :c:type:`fe_sec_tone_mode`

Description
===========

This ioctl is used to set the generation of the continuous 22kHz tone.
This call requires read/write permissions.

Usually, satellite antenna subsystems require that the digital TV device
to send a 22kHz tone in order to select between high/low band on some
dual-band LNBf. It is also used to send signals to DiSEqC equipment, but
this is done using the DiSEqC ioctls.

.. attention:: If more than one device is connected to the same antenna,
   setting a tone may interfere on other devices, as they may lose the
   capability of selecting the band. So, it is recommended that applications
   would change to SEC_TONE_OFF when the device is not used.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _FE_SET_VOLTAGE:

********************
ioctl FE_SET_VOLTAGE
********************

Name
====

FE_SET_VOLTAGE - Allow setting the DC level sent to the antenna subsystem.

Synopsis
========

.. c:macro:: FE_SET_VOLTAGE

``int ioctl(int fd, FE_SET_VOLTAGE, enum fe_sec_voltage voltage)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``voltage``
    an integer enumered value described at :c:type:`fe_sec_voltage`

Description
===========

This ioctl allows to set the DC voltage level sent through the antenna
cable to 13V, 18V or off.

Usually, a satellite antenna subsystems require that the digital TV
device to send a DC voltage to feed power to the LNBf. Depending on the
LNBf type, the polarization or the intermediate frequency (IF) of the
LNBf can controlled by the voltage level. Other devices (for example,
the ones that implement DISEqC and multipoint LNBf's don't need to
control the voltage level, provided that either 13V or 18V is sent to
power up the LNBf.

.. attention:: if more than one device is connected to the same antenna,
   setting a voltage level may interfere on other devices, as they may lose
   the capability of setting polarization or IF. So, on those cases, setting
   the voltage to SEC_VOLTAGE_OFF while the device is not is used is
   recommended.

Return Value
============

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

*************
Frontend type
*************

For historical reasons, frontend types are named by the type of
modulation used in transmission. The fontend types are given by
fe_type_t type, defined as:

.. c:type:: fe_type

.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|

.. flat-table:: Frontend types
    :header-rows:  1
    :stub-columns: 0
    :widths:       3 1 4

    -  .. row 1

       -  fe_type

       -  Description

       -  :ref:`DTV_DELIVERY_SYSTEM <DTV-DELIVERY-SYSTEM>` equivalent
	  type

    -  .. row 2

       -  .. _FE-QPSK:

	  ``FE_QPSK``

       -  For DVB-S standard

       -  ``SYS_DVBS``

    -  .. row 3

       -  .. _FE-QAM:

	  ``FE_QAM``

       -  For DVB-C annex A standard

       -  ``SYS_DVBC_ANNEX_A``

    -  .. row 4

       -  .. _FE-OFDM:

	  ``FE_OFDM``

       -  For DVB-T standard

       -  ``SYS_DVBT``

    -  .. row 5

       -  .. _FE-ATSC:

	  ``FE_ATSC``

       -  For ATSC standard (terrestrial) or for DVB-C Annex B (cable) used
	  in US.

       -  ``SYS_ATSC`` (terrestrial) or ``SYS_DVBC_ANNEX_B`` (cable)

Newer formats like DVB-S2, ISDB-T, ISDB-S and DVB-T2 are not described
at the above, as they're supported via the new
:ref:`FE_GET_PROPERTY/FE_GET_SET_PROPERTY <FE_GET_PROPERTY>`
ioctl's, using the :ref:`DTV_DELIVERY_SYSTEM <DTV-DELIVERY-SYSTEM>`
parameter.

In the old days, struct :c:type:`dvb_frontend_info`
used to contain ``fe_type_t`` field to indicate the delivery systems,
filled with either ``FE_QPSK, FE_QAM, FE_OFDM`` or ``FE_ATSC``. While this
is still filled to keep backward compatibility, the usage of this field
is deprecated, as it can report just one delivery system, but some
devices support multiple delivery systems. Please use
:ref:`DTV_ENUM_DELSYS <DTV-ENUM-DELSYS>` instead.

On devices that support multiple delivery systems, struct
:c:type:`dvb_frontend_info`::``fe_type_t`` is
filled with the currently standard, as selected by the last call to
:ref:`FE_SET_PROPERTY <FE_GET_PROPERTY>` using the
:ref:`DTV_DELIVERY_SYSTEM <DTV-DELIVERY-SYSTEM>` property.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. _fe_property_parameters:

******************************
Digital TV property parameters
******************************

There are several different Digital TV parameters that can be used by
:ref:`FE_SET_PROPERTY and FE_GET_PROPERTY ioctls<FE_GET_PROPERTY>`.
This section describes each of them. Please notice, however, that only
a subset of them are needed to setup a frontend.

.. _DTV-UNDEFINED:

DTV_UNDEFINED
=============

Used internally. A GET/SET operation for it won't change or return
anything.

.. _DTV-TUNE:

DTV_TUNE
========

Interpret the cache of data, build either a traditional frontend
tunerequest so we can pass validation in the ``FE_SET_FRONTEND`` ioctl.

.. _DTV-CLEAR:

DTV_CLEAR
=========

Reset a cache of data specific to the frontend here. This does not
effect hardware.

.. _DTV-FREQUENCY:

DTV_FREQUENCY
=============

Frequency of the digital TV transponder/channel.

.. note::

  #. For satellite delivery systems, the frequency is in kHz.

  #. For cable and terrestrial delivery systems, the frequency is in
     Hz.

  #. On most delivery systems, the frequency is the center frequency
     of the transponder/channel. The exception is for ISDB-T, where
     the main carrier has a 1/7 offset from the center.

  #. For ISDB-T, the channels are usually transmitted with an offset of
     about 143kHz. E.g. a valid frequency could be 474,143 kHz. The
     stepping is  bound to the bandwidth of the channel which is
     typically 6MHz.

  #. In ISDB-Tsb, the channel consists of only one or three segments the
     frequency step is 429kHz, 3*429 respectively.

.. _DTV-MODULATION:

DTV_MODULATION
==============

Specifies the frontend modulation type for delivery systems that
supports more multiple modulations.

The modulation can be one of the types defined by enum :c:type:`fe_modulation`.

Most of the digital TV standards offers more than one possible
modulation type.

The table below presents a summary of the types of modulation types
supported by each delivery system, as currently defined by specs.

======================= =======================================================
Standard		Modulation types
======================= =======================================================
ATSC (version 1)	8-VSB and 16-VSB.
DMTB			4-QAM, 16-QAM, 32-QAM, 64-QAM and 4-QAM-NR.
DVB-C Annex A/C		16-QAM, 32-QAM, 64-QAM and 256-QAM.
DVB-C Annex B		64-QAM.
DVB-C2			QPSK, 16-QAM, 64-QAM, 256-QAM, 1024-QAM and 4096-QAM.
DVB-T			QPSK, 16-QAM and 64-QAM.
DVB-T2			QPSK, 16-QAM, 64-QAM and 256-QAM.
DVB-S			No need to set. It supports only QPSK.
DVB-S2			QPSK, 8-PSK, 16-APSK and 32-APSK.
DVB-S2X			8-APSK-L, 16-APSK-L, 32-APSK-L, 64-APSK and 64-APSK-L.
ISDB-T			QPSK, DQPSK, 16-QAM and 64-QAM.
ISDB-S			8-PSK, QPSK and BPSK.
======================= =======================================================

.. note::

   As DVB-S2X specifies extensions to the DVB-S2 standard, the same
   delivery system enum value is used (SYS_DVBS2).

   Please notice that some of the above modulation types may not be
   defined currently at the Kernel. The reason is simple: no driver
   needed such definition yet.

.. _DTV-BANDWIDTH-HZ:

DTV_BANDWIDTH_HZ
================

Bandwidth for the channel, in HZ.

Should be set only for terrestrial delivery systems.

Possible values: ``1712000``, ``5000000``, ``6000000``, ``7000000``,
``8000000``, ``10000000``.

======================= =======================================================
Terrestrial Standard	Possible values for bandwidth
======================= =======================================================
ATSC (version 1)	No need to set. It is always 6MHz.
DMTB			No need to set. It is always 8MHz.
DVB-T			6MHz, 7MHz and 8MHz.
DVB-T2			1.172 MHz, 5MHz, 6MHz, 7MHz, 8MHz and 10MHz
ISDB-T			5MHz, 6MHz, 7MHz and 8MHz, although most places
			use 6MHz.
======================= =======================================================

.. note::

  #. For ISDB-Tsb, the bandwidth can vary depending on the number of
     connected segments.

     It can be easily derived from other parameters
     (DTV_ISDBT_SB_SEGMENT_IDX, DTV_ISDBT_SB_SEGMENT_COUNT).

  #. On Satellite and Cable delivery systems, the bandwidth depends on
     the symbol rate. So, the Kernel will silently ignore any setting
     :ref:`DTV-BANDWIDTH-HZ`. I will however fill it back with a
     bandwidth estimation.

     Such bandwidth estimation takes into account the symbol rate set with
     :ref:`DTV-SYMBOL-RATE`, and the rolloff factor, with is fixed for
     DVB-C and DVB-S.

     For DVB-S2, the rolloff should also be set via :ref:`DTV-ROLLOFF`.

.. _DTV-INVERSION:

DTV_INVERSION
=============

Specifies if the frontend should do spectral inversion or not.

The acceptable values are defined by :c:type:`fe_spectral_inversion`.

.. _DTV-DISEQC-MASTER:

DTV_DISEQC_MASTER
=================

Currently not implemented.

.. _DTV-SYMBOL-RATE:

DTV_SYMBOL_RATE
===============

Used on cable and satellite delivery systems.

Digital TV symbol rate, in bauds (symbols/second).

.. _DTV-INNER-FEC:

DTV_INNER_FEC
=============

Used on cable and satellite delivery systems.

The acceptable values are defined by :c:type:`fe_code_rate`.

.. _DTV-VOLTAGE:

DTV_VOLTAGE
===========

Used on satellite delivery systems.

The voltage is usually used with non-DiSEqC capable LNBs to switch the
polarzation (horizontal/vertical). When using DiSEqC epuipment this
voltage has to be switched consistently to the DiSEqC commands as
described in the DiSEqC spec.

The acceptable values are defined by :c:type:`fe_sec_voltage`.

.. _DTV-TONE:

DTV_TONE
========

Currently not used.

.. _DTV-PILOT:

DTV_PILOT
=========

Used on DVB-S2.

Sets DVB-S2 pilot.

The acceptable values are defined by :c:type:`fe_pilot`.

.. _DTV-ROLLOFF:

DTV_ROLLOFF
===========

Used on DVB-S2.

Sets DVB-S2 rolloff.

The acceptable values are defined by :c:type:`fe_rolloff`.

.. _DTV-DISEQC-SLAVE-REPLY:

DTV_DISEQC_SLAVE_REPLY
======================

Currently not implemented.

.. _DTV-FE-CAPABILITY-COUNT:

DTV_FE_CAPABILITY_COUNT
=======================

Currently not implemented.

.. _DTV-FE-CAPABILITY:

DTV_FE_CAPABILITY
=================

Currently not implemented.

.. _DTV-DELIVERY-SYSTEM:

DTV_DELIVERY_SYSTEM
===================

Specifies the type of the delivery system.

The acceptable values are defined by :c:type:`fe_delivery_system`.

.. _DTV-ISDBT-PARTIAL-RECEPTION:

DTV_ISDBT_PARTIAL_RECEPTION
===========================

Used only on ISDB.

If ``DTV_ISDBT_SOUND_BROADCASTING`` is '0' this bit-field represents
whether the channel is in partial reception mode or not.

If '1' ``DTV_ISDBT_LAYERA_*`` values are assigned to the center segment
and ``DTV_ISDBT_LAYERA_SEGMENT_COUNT`` has to be '1'.

If in addition ``DTV_ISDBT_SOUND_BROADCASTING`` is '1'
``DTV_ISDBT_PARTIAL_RECEPTION`` represents whether this ISDB-Tsb channel
is consisting of one segment and layer or three segments and two layers.

Possible values: 0, 1, -1 (AUTO)

.. _DTV-ISDBT-SOUND-BROADCASTING:

DTV_ISDBT_SOUND_BROADCASTING
============================

Used only on ISDB.

This field represents whether the other DTV_ISDBT_*-parameters are
referring to an ISDB-T and an ISDB-Tsb channel. (See also
``DTV_ISDBT_PARTIAL_RECEPTION``).

Possible values: 0, 1, -1 (AUTO)

.. _DTV-ISDBT-SB-SUBCHANNEL-ID:

DTV_ISDBT_SB_SUBCHANNEL_ID
==========================

Used only on ISDB.

This field only applies if ``DTV_ISDBT_SOUND_BROADCASTING`` is '1'.

(Note of the author: This might not be the correct description of the
``SUBCHANNEL-ID`` in all details, but it is my understanding of the
technical background needed to program a device)

An ISDB-Tsb channel (1 or 3 segments) can be broadcasted alone or in a
set of connected ISDB-Tsb channels. In this set of channels every
channel can be received independently. The number of connected ISDB-Tsb
segment can vary, e.g. depending on the frequency spectrum bandwidth
available.

Example: Assume 8 ISDB-Tsb connected segments are broadcasted. The
broadcaster has several possibilities to put those channels in the air:
Assuming a normal 13-segment ISDB-T spectrum he can align the 8 segments
from position 1-8 to 5-13 or anything in between.

The underlying layer of segments are subchannels: each segment is
consisting of several subchannels with a predefined IDs. A sub-channel
is used to help the demodulator to synchronize on the channel.

An ISDB-T channel is always centered over all sub-channels. As for the
example above, in ISDB-Tsb it is no longer as simple as that.

``The DTV_ISDBT_SB_SUBCHANNEL_ID`` parameter is used to give the
sub-channel ID of the segment to be demodulated.

Possible values: 0 .. 41, -1 (AUTO)

.. _DTV-ISDBT-SB-SEGMENT-IDX:

DTV_ISDBT_SB_SEGMENT_IDX
========================

Used only on ISDB.

This field only applies if ``DTV_ISDBT_SOUND_BROADCASTING`` is '1'.

``DTV_ISDBT_SB_SEGMENT_IDX`` gives the index of the segment to be
demodulated for an ISDB-Tsb channel where several of them are
transmitted in the connected manner.

Possible values: 0 .. ``DTV_ISDBT_SB_SEGMENT_COUNT`` - 1

Note: This value cannot be determined by an automatic channel search.

.. _DTV-ISDBT-SB-SEGMENT-COUNT:

DTV_ISDBT_SB_SEGMENT_COUNT
==========================

Used only on ISDB.

This field only applies if ``DTV_ISDBT_SOUND_BROADCASTING`` is '1'.

``DTV_ISDBT_SB_SEGMENT_COUNT`` gives the total count of connected
ISDB-Tsb channels.

Possible values: 1 .. 13

Note: This value cannot be determined by an automatic channel search.

.. _isdb-hierq-layers:

DTV-ISDBT-LAYER[A-C] parameters
===============================

Used only on ISDB.

ISDB-T channels can be coded hierarchically. As opposed to DVB-T in
ISDB-T hierarchical layers can be decoded simultaneously. For that
reason a ISDB-T demodulator has 3 Viterbi and 3 Reed-Solomon decoders.

ISDB-T has 3 hierarchical layers which each can use a part of the
available segments. The total number of segments over all layers has to
13 in ISDB-T.

There are 3 parameter sets, for Layers A, B and C.

.. _DTV-ISDBT-LAYER-ENABLED:

DTV_ISDBT_LAYER_ENABLED
-----------------------

Used only on ISDB.

Hierarchical reception in ISDB-T is achieved by enabling or disabling
layers in the decoding process. Setting all bits of
``DTV_ISDBT_LAYER_ENABLED`` to '1' forces all layers (if applicable) to
be demodulated. This is the default.

If the channel is in the partial reception mode
(``DTV_ISDBT_PARTIAL_RECEPTION`` = 1) the central segment can be decoded
independently of the other 12 segments. In that mode layer A has to have
a ``SEGMENT_COUNT`` of 1.

In ISDB-Tsb only layer A is used, it can be 1 or 3 in ISDB-Tsb according
to ``DTV_ISDBT_PARTIAL_RECEPTION``. ``SEGMENT_COUNT`` must be filled
accordingly.

Only the values of the first 3 bits are used. Other bits will be silently ignored:

``DTV_ISDBT_LAYER_ENABLED`` bit 0: layer A enabled

``DTV_ISDBT_LAYER_ENABLED`` bit 1: layer B enabled

``DTV_ISDBT_LAYER_ENABLED`` bit 2: layer C enabled

``DTV_ISDBT_LAYER_ENABLED`` bits 3-31: unused

.. _DTV-ISDBT-LAYER-FEC:

DTV_ISDBT_LAYER[A-C]_FEC
------------------------

Used only on ISDB.

The Forward Error Correction mechanism used by a given ISDB Layer, as
defined by :c:type:`fe_code_rate`.

Possible values are: ``FEC_AUTO``, ``FEC_1_2``, ``FEC_2_3``, ``FEC_3_4``,
``FEC_5_6``, ``FEC_7_8``

.. _DTV-ISDBT-LAYER-MODULATION:

DTV_ISDBT_LAYER[A-C]_MODULATION
-------------------------------

Used only on ISDB.

The modulation used by a given ISDB Layer, as defined by
:c:type:`fe_modulation`.

Possible values are: ``QAM_AUTO``, ``QPSK``, ``QAM_16``, ``QAM_64``, ``DQPSK``

.. note::

   #. If layer C is ``DQPSK``, then layer B has to be ``DQPSK``.

   #. If layer B is ``DQPSK`` and ``DTV_ISDBT_PARTIAL_RECEPTION``\ = 0,
      then layer has to be ``DQPSK``.

.. _DTV-ISDBT-LAYER-SEGMENT-COUNT:

DTV_ISDBT_LAYER[A-C]_SEGMENT_COUNT
----------------------------------

Used only on ISDB.

Possible values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1 (AUTO)

Note: Truth table for ``DTV_ISDBT_SOUND_BROADCASTING`` and
``DTV_ISDBT_PARTIAL_RECEPTION`` and ``LAYER[A-C]_SEGMENT_COUNT``

.. _isdbt-layer_seg-cnt-table:

.. flat-table:: Truth table for ISDB-T Sound Broadcasting
    :header-rows:  1
    :stub-columns: 0

    -  .. row 1

       -  Partial Reception

       -  Sound Broadcasting

       -  Layer A width

       -  Layer B width

       -  Layer C width

       -  total width

    -  .. row 2

       -  0

       -  0

       -  1 .. 13

       -  1 .. 13

       -  1 .. 13

       -  13

    -  .. row 3

       -  1

       -  0

       -  1

       -  1 .. 13

       -  1 .. 13

       -  13

    -  .. row 4

       -  0

       -  1

       -  1

       -  0

       -  0

       -  1

    -  .. row 5

       -  1

       -  1

       -  1

       -  2

       -  0

       -  13

.. _DTV-ISDBT-LAYER-TIME-INTERLEAVING:

DTV_ISDBT_LAYER[A-C]_TIME_INTERLEAVING
--------------------------------------

Used only on ISDB.

Valid values: 0, 1, 2, 4, -1 (AUTO)

when DTV_ISDBT_SOUND_BROADCASTING is active, value 8 is also valid.

Note: The real time interleaving length depends on the mode (fft-size).
The values here are referring to what can be found in the
TMCC-structure, as shown in the table below.

.. c:type:: isdbt_layer_interleaving_table

.. flat-table:: ISDB-T time interleaving modes
    :header-rows:  1
    :stub-columns: 0

    -  .. row 1

       -  ``DTV_ISDBT_LAYER[A-C]_TIME_INTERLEAVING``

       -  Mode 1 (2K FFT)

       -  Mode 2 (4K FFT)

       -  Mode 3 (8K FFT)

    -  .. row 2

       -  0

       -  0

       -  0

       -  0

    -  .. row 3

       -  1

       -  4

       -  2

       -  1

    -  .. row 4

       -  2

       -  8

       -  4

       -  2

    -  .. row 5

       -  4

       -  16

       -  8

       -  4

.. _DTV-ATSCMH-FIC-VER:

DTV_ATSCMH_FIC_VER
------------------

Used only on ATSC-MH.

Version number of the FIC (Fast Information Channel) signaling data.

FIC is used for relaying information to allow rapid service acquisition
by the receiver.

Possible values: 0, 1, 2, 3, ..., 30, 31

.. _DTV-ATSCMH-PARADE-ID:

DTV_ATSCMH_PARADE_ID
--------------------

Used only on ATSC-MH.

Parade identification number

A parade is a collection of up to eight MH groups, conveying one or two
ensembles.

Possible values: 0, 1, 2, 3, ..., 126, 127

.. _DTV-ATSCMH-NOG:

DTV_ATSCMH_NOG
--------------

Used only on ATSC-MH.

Number of MH groups per MH subframe for a designated parade.

Possible values: 1, 2, 3, 4, 5, 6, 7, 8

.. _DTV-ATSCMH-TNOG:

DTV_ATSCMH_TNOG
---------------

Used only on ATSC-MH.

Total number of MH groups including all MH groups belonging to all MH
parades in one MH subframe.

Possible values: 0, 1, 2, 3, ..., 30, 31

.. _DTV-ATSCMH-SGN:

DTV_ATSCMH_SGN
--------------

Used only on ATSC-MH.

Start group number.

Possible values: 0, 1, 2, 3, ..., 14, 15

.. _DTV-ATSCMH-PRC:

DTV_ATSCMH_PRC
--------------

Used only on ATSC-MH.

Parade repetition cycle.

Possible values: 1, 2, 3, 4, 5, 6, 7, 8

.. _DTV-ATSCMH-RS-FRAME-MODE:

DTV_ATSCMH_RS_FRAME_MODE
------------------------

Used only on ATSC-MH.

Reed Solomon (RS) frame mode.

The acceptable values are defined by :c:type:`atscmh_rs_frame_mode`.

.. _DTV-ATSCMH-RS-FRAME-ENSEMBLE:

DTV_ATSCMH_RS_FRAME_ENSEMBLE
----------------------------

Used only on ATSC-MH.

Reed Solomon(RS) frame ensemble.

The acceptable values are defined by :c:type:`atscmh_rs_frame_ensemble`.

.. _DTV-ATSCMH-RS-CODE-MODE-PRI:

DTV_ATSCMH_RS_CODE_MODE_PRI
---------------------------

Used only on ATSC-MH.

Reed Solomon (RS) code mode (primary).

The acceptable values are defined by :c:type:`atscmh_rs_code_mode`.

.. _DTV-ATSCMH-RS-CODE-MODE-SEC:

DTV_ATSCMH_RS_CODE_MODE_SEC
---------------------------

Used only on ATSC-MH.

Reed Solomon (RS) code mode (secondary).

The acceptable values are defined by :c:type:`atscmh_rs_code_mode`.

.. _DTV-ATSCMH-SCCC-BLOCK-MODE:

DTV_ATSCMH_SCCC_BLOCK_MODE
--------------------------

Used only on ATSC-MH.

Series Concatenated Convolutional Code Block Mode.

The acceptable values are defined by :c:type:`atscmh_sccc_block_mode`.

.. _DTV-ATSCMH-SCCC-CODE-MODE-A:

DTV_ATSCMH_SCCC_CODE_MODE_A
---------------------------

Used only on ATSC-MH.

Series Concatenated Convolutional Code Rate.

The acceptable values are defined by :c:type:`atscmh_sccc_code_mode`.

.. _DTV-ATSCMH-SCCC-CODE-MODE-B:

DTV_ATSCMH_SCCC_CODE_MODE_B
---------------------------

Used only on ATSC-MH.

Series Concatenated Convolutional Code Rate.

Possible values are the same as documented on enum
:c:type:`atscmh_sccc_code_mode`.

.. _DTV-ATSCMH-SCCC-CODE-MODE-C:

DTV_ATSCMH_SCCC_CODE_MODE_C
---------------------------

Used only on ATSC-MH.

Series Concatenated Convolutional Code Rate.

Possible values are the same as documented on enum
:c:type:`atscmh_sccc_code_mode`.

.. _DTV-ATSCMH-SCCC-CODE-MODE-D:

DTV_ATSCMH_SCCC_CODE_MODE_D
---------------------------

Used only on ATSC-MH.

Series Concatenated Convolutional Code Rate.

Possible values are the same as documented on enum
:c:type:`atscmh_sccc_code_mode`.

.. _DTV-API-VERSION:

DTV_API_VERSION
===============

Returns the major/minor version of the Digital TV API

.. _DTV-CODE-RATE-HP:

DTV_CODE_RATE_HP
================

Used on terrestrial transmissions.

The acceptable values are defined by :c:type:`fe_transmit_mode`.

.. _DTV-CODE-RATE-LP:

DTV_CODE_RATE_LP
================

Used on terrestrial transmissions.

The acceptable values are defined by :c:type:`fe_transmit_mode`.

.. _DTV-GUARD-INTERVAL:

DTV_GUARD_INTERVAL
==================

The acceptable values are defined by :c:type:`fe_guard_interval`.

.. note::

   #. If ``DTV_GUARD_INTERVAL`` is set the ``GUARD_INTERVAL_AUTO`` the
      hardware will try to find the correct guard interval (if capable) and
      will use TMCC to fill in the missing parameters.
   #. Interval ``GUARD_INTERVAL_1_64`` is used only for DVB-C2.
   #. Interval ``GUARD_INTERVAL_1_128`` is used for both DVB-C2 and DVB_T2.
   #. Intervals ``GUARD_INTERVAL_19_128`` and ``GUARD_INTERVAL_19_256`` are
      used only for DVB-T2.
   #. Intervals ``GUARD_INTERVAL_PN420``, ``GUARD_INTERVAL_PN595`` and
      ``GUARD_INTERVAL_PN945`` are used only for DMTB at the present.
      On such standard, only those intervals and ``GUARD_INTERVAL_AUTO``
      are valid.

.. _DTV-TRANSMISSION-MODE:

DTV_TRANSMISSION_MODE
=====================

Used only on OFTM-based standards, e. g. DVB-T/T2, ISDB-T, DTMB.

Specifies the FFT size (with corresponds to the approximate number of
carriers) used by the standard.

The acceptable values are defined by :c:type:`fe_transmit_mode`.

.. note::

   #. ISDB-T supports three carrier/symbol-size: 8K, 4K, 2K. It is called
      **mode** on such standard, and are numbered from 1 to 3:

      ====	========	========================
      Mode	FFT size	Transmission mode
      ====	========	========================
      1		2K		``TRANSMISSION_MODE_2K``
      2		4K		``TRANSMISSION_MODE_4K``
      3		8K		``TRANSMISSION_MODE_8K``
      ====	========	========================

   #. If ``DTV_TRANSMISSION_MODE`` is set the ``TRANSMISSION_MODE_AUTO``
      the hardware will try to find the correct FFT-size (if capable) and
      will use TMCC to fill in the missing parameters.

   #. DVB-T specifies 2K and 8K as valid sizes.

   #. DVB-T2 specifies 1K, 2K, 4K, 8K, 16K and 32K.

   #. DTMB specifies C1 and C3780.

.. _DTV-HIERARCHY:

DTV_HIERARCHY
=============

Used only on DVB-T and DVB-T2.

Frontend hierarchy.

The acceptable values are defined by :c:type:`fe_hierarchy`.

.. _DTV-STREAM-ID:

DTV_STREAM_ID
=============

Used on DVB-C2, DVB-S2, DVB-T2 and ISDB-S.

DVB-C2, DVB-S2, DVB-T2 and ISDB-S support the transmission of several
streams on a single transport stream. This property enables the digital
TV driver to handle substream filtering, when supported by the hardware.
By default, substream filtering is disabled.

For DVB-C2, DVB-S2 and DVB-T2, the valid substream id range is from 0 to
255.

For ISDB, the valid substream id range is from 1 to 65535.

To disable it, you should use the special macro NO_STREAM_ID_FILTER.

Note: any value outside the id range also disables filtering.

.. _DTV-DVBT2-PLP-ID-LEGACY:

DTV_DVBT2_PLP_ID_LEGACY
=======================

Obsolete, replaced with DTV_STREAM_ID.

.. _DTV-ENUM-DELSYS:

DTV_ENUM_DELSYS
===============

A Multi standard frontend needs to advertise the delivery systems
provided. Applications need to enumerate the provided delivery systems,
before using any other operation with the frontend. Prior to it's
introduction, FE_GET_INFO was used to determine a frontend type. A
frontend which provides more than a single delivery system,
FE_GET_INFO doesn't help much. Applications which intends to use a
multistandard frontend must enumerate the delivery systems associated
with it, rather than trying to use FE_GET_INFO. In the case of a
legacy frontend, the result is just the same as with FE_GET_INFO, but
in a more structured format

The acceptable values are defined by :c:type:`fe_delivery_system`.

.. _DTV-INTERLEAVING:

DTV_INTERLEAVING
================

Time interleaving to be used.

The acceptable values are defined by :c:type:`fe_interleaving`.

.. _DTV-LNA:

DTV_LNA
=======

Low-noise amplifier.

Hardware might offer controllable LNA which can be set manually using
that parameter. Usually LNA could be found only from terrestrial devices
if at all.

Possible values: 0, 1, LNA_AUTO

0, LNA off

1, LNA on

use the special macro LNA_AUTO to set LNA auto

.. _DTV-SCRAMBLING-SEQUENCE-INDEX:

DTV_SCRAMBLING_SEQUENCE_INDEX
=============================

Used on DVB-S2.

This 18 bit field, when present, carries the index of the DVB-S2 physical
layer scrambling sequence as defined in clause 5.5.4 of EN 302 307.
There is no explicit signalling method to convey scrambling sequence index
to the receiver. If S2 satellite delivery system descriptor is available
it can be used to read the scrambling sequence index (EN 300 468 table 41).

By default, gold scrambling sequence index 0 is used.

The valid scrambling sequence index range is from 0 to 262142.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

Frontend uAPI data types
========================

.. kernel-doc:: include/uapi/linux/dvb/frontend.h


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. _frontend-property-cable-systems:

*****************************************
Properties used on cable delivery systems
*****************************************

.. _dvbc-params:

DVB-C delivery system
=====================

The DVB-C Annex-A is the widely used cable standard. Transmission uses
QAM modulation.

The DVB-C Annex-C is optimized for 6MHz, and is used in Japan. It
supports a subset of the Annex A modulation types, and a roll-off of
0.13, instead of 0.15

The following parameters are valid for DVB-C Annex A/C:

-  :ref:`DTV_API_VERSION <DTV-API-VERSION>`

-  :ref:`DTV_DELIVERY_SYSTEM <DTV-DELIVERY-SYSTEM>`

-  :ref:`DTV_TUNE <DTV-TUNE>`

-  :ref:`DTV_CLEAR <DTV-CLEAR>`

-  :ref:`DTV_FREQUENCY <DTV-FREQUENCY>`

-  :ref:`DTV_MODULATION <DTV-MODULATION>`

-  :ref:`DTV_INVERSION <DTV-INVERSION>`

-  :ref:`DTV_SYMBOL_RATE <DTV-SYMBOL-RATE>`

-  :ref:`DTV_INNER_FEC <DTV-INNER-FEC>`

-  :ref:`DTV_LNA <DTV-LNA>`

In addition, the :ref:`DTV QoS statistics <frontend-stat-properties>`
are also valid.

.. _dvbc-annex-b-params:

DVB-C Annex B delivery system
=============================

The DVB-C Annex-B is only used on a few Countries like the United
States.

The following parameters are valid for DVB-C Annex B:

-  :ref:`DTV_API_VERSION <DTV-API-VERSION>`

-  :ref:`DTV_DELIVERY_SYSTEM <DTV-DELIVERY-SYSTEM>`

-  :ref:`DTV_TUNE <DTV-TUNE>`

-  :ref:`DTV_CLEAR <DTV-CLEAR>`

-  :ref:`DTV_FREQUENCY <DTV-FREQUENCY>`

-  :ref:`DTV_MODULATION <DTV-MODULATION>`

-  :ref:`DTV_INVERSION <DTV-INVERSION>`

-  :ref:`DTV_LNA <DTV-LNA>`

In addition, the :ref:`DTV QoS statistics <frontend-stat-properties>`
are also valid.


code:
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. _frontend-property-satellite-systems:

*********************************************
Properties used on satellite delivery systems
*********************************************

.. _dvbs-params:

DVB-S delivery system
=====================

The following parameters are valid for DVB-S:

-  :ref:`DTV_API_VERSION <DTV-API-VERSION>`

-  :ref:`DTV_DELIVERY_SYSTEM <DTV-DELIVERY-SYSTEM>`

-  :ref:`DTV_TUNE <DTV-TUNE>`

-  :ref:`DTV_CLEAR <DTV-CLEAR>`

-  :ref:`DTV_FREQUENCY <DTV-FREQUENCY>`

-  :ref:`DTV_INVERSION <DTV-INVERSION>`

-  :ref:`DTV_SYMBOL_RATE <DTV-SYMBOL-RATE>`

-  :ref:`DTV_INNER_FEC <DTV-INNER-FEC>`

-  :ref:`DTV_VOLTAGE <DTV-VOLTAGE>`

-  :ref:`DTV_TONE <DTV-TONE>`

In addition, the :ref:`DTV QoS statistics <frontend-stat-properties>`
are also valid.

Future implementations might add those two missing parameters:

-  :ref:`DTV_DISEQC_MASTER <DTV-DISEQC-MASTER>`

-  :ref:`DTV_DISEQC_SLAVE_REPLY <DTV-DISEQC-SLAVE-REPLY>`

.. _dvbs2-params:

DVB-S2 delivery system
======================

In addition to all parameters valid for DVB-S, DVB-S2 supports the
following parameters:

-  :ref:`DTV_MODULATION <DTV-MODULATION>`

-  :ref:`DTV_PILOT <DTV-PILOT>`

-  :ref:`DTV_ROLLOFF <DTV-ROLLOFF>`

-  :ref:`DTV_STREAM_ID <DTV-STREAM-ID>`

-  :ref:`DTV_SCRAMBLING_SEQUENCE_INDEX <DTV-SCRAMBLING-SEQUENCE-INDEX>`

In addition, the :ref:`DTV QoS statistics <frontend-stat-properties>`
are also valid.

.. _turbo-params:

Turbo code delivery system
==========================

In addition to all parameters valid for DVB-S, turbo code supports the
following parameters:

-  :ref:`DTV_MODULATION <DTV-MODULATION>`

.. _isdbs-params:

ISDB-S delivery system
======================

The following parameters are valid for ISDB-S:

-  :ref:`DTV_API_VERSION <DTV-API-VERSION>`

-  :ref:`DTV_DELIVERY_SYSTEM <DTV-DELIVERY-SYSTEM>`

-  :ref:`DTV_TUNE <DTV-TUNE>`

-  :ref:`DTV_CLEAR <DTV-CLEAR>`

-  :ref:`DTV_FREQUENCY <DTV-FREQUENCY>`

-  :ref:`DTV_INVERSION <DTV-INVERSION>`

-  :ref:`DTV_SYMBOL_RATE <DTV-SYMBOL-RATE>`

-  :ref:`DTV_INNER_FEC <DTV-INNER-FEC>`

-  :ref:`DTV_VOLTAGE <DTV-VOLTAGE>`

-  :ref:`DTV_STREAM_ID <DTV-STREAM-ID>`