2020-08-26 15:03:09 +08:00
|
|
|
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
|
2020-09-24 22:56:00 +08:00
|
|
|
.. c:namespace:: DTV.fe
|
2018-08-30 22:15:26 +08:00
|
|
|
|
2016-06-30 21:18:56 +08:00
|
|
|
.. _frontend_f_open:
|
|
|
|
|
2017-09-02 00:28:16 +08:00
|
|
|
***************************
|
|
|
|
Digital TV frontend open()
|
|
|
|
***************************
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Name
|
2016-07-05 18:58:48 +08:00
|
|
|
====
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 18:58:48 +08:00
|
|
|
fe-open - Open a frontend device
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Synopsis
|
2016-06-30 21:18:56 +08:00
|
|
|
========
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
2016-08-19 23:00:43 +08:00
|
|
|
.. c:function:: int open( const char *device_name, int flags )
|
2016-07-05 18:58:48 +08:00
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Arguments
|
2016-06-30 21:18:56 +08:00
|
|
|
=========
|
|
|
|
|
|
|
|
``device_name``
|
|
|
|
Device to be opened.
|
|
|
|
|
|
|
|
``flags``
|
|
|
|
Open flags. Access can either be ``O_RDWR`` or ``O_RDONLY``.
|
|
|
|
|
|
|
|
Multiple opens are allowed with ``O_RDONLY``. In this mode, only
|
|
|
|
query and read ioctls are allowed.
|
|
|
|
|
|
|
|
Only one open is allowed in ``O_RDWR``. In this mode, all ioctls are
|
|
|
|
allowed.
|
|
|
|
|
|
|
|
When the ``O_NONBLOCK`` flag is given, the system calls may return
|
2016-07-03 22:53:09 +08:00
|
|
|
``EAGAIN`` error code when no data is available or when the device
|
2016-06-30 21:18:56 +08:00
|
|
|
driver is temporarily busy.
|
|
|
|
|
|
|
|
Other flags have no effect.
|
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Description
|
2016-06-30 21:18:56 +08:00
|
|
|
===========
|
|
|
|
|
|
|
|
This system call opens a named frontend device
|
|
|
|
(``/dev/dvb/adapter?/frontend?``) for subsequent use. Usually the first
|
|
|
|
thing to do after a successful open is to find out the frontend type
|
2016-07-02 00:58:44 +08:00
|
|
|
with :ref:`FE_GET_INFO`.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
The device can be opened in read-only mode, which only allows monitoring
|
|
|
|
of device status and statistics, or read/write mode, which allows any
|
|
|
|
kind of use (e.g. performing tuning operations.)
|
|
|
|
|
|
|
|
In a system with multiple front-ends, it is usually the case that
|
|
|
|
multiple devices cannot be open in read/write mode simultaneously. As
|
|
|
|
long as a front-end device is opened in read/write mode, other open()
|
|
|
|
calls in read/write mode will either fail or block, depending on whether
|
|
|
|
non-blocking or blocking mode was specified. A front-end device opened
|
|
|
|
in blocking mode can later be put into non-blocking mode (and vice
|
|
|
|
versa) using the F_SETFL command of the fcntl system call. This is a
|
|
|
|
standard system call, documented in the Linux manual page for fcntl.
|
|
|
|
When an open() call has succeeded, the device will be ready for use in
|
|
|
|
the specified mode. This implies that the corresponding hardware is
|
|
|
|
powered up, and that other front-ends may have been powered down to make
|
|
|
|
that possible.
|
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Return Value
|
2016-06-30 21:18:56 +08:00
|
|
|
============
|
|
|
|
|
2020-09-24 22:56:00 +08:00
|
|
|
On success :c:func:`open()` returns the new file descriptor.
|
2016-07-04 23:56:17 +08:00
|
|
|
On error, -1 is returned, and the ``errno`` variable is set appropriately.
|
|
|
|
|
2016-06-30 21:18:56 +08:00
|
|
|
Possible error codes are:
|
|
|
|
|
2017-09-02 00:15:43 +08:00
|
|
|
On success 0 is returned, and :c:type:`ca_slot_info` is filled.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2017-09-02 00:15:43 +08:00
|
|
|
On error -1 is returned, and the ``errno`` variable is set
|
|
|
|
appropriately.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2017-09-02 00:15:43 +08:00
|
|
|
.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2017-09-02 00:15:43 +08:00
|
|
|
.. flat-table::
|
|
|
|
:header-rows: 0
|
|
|
|
:stub-columns: 0
|
|
|
|
:widths: 1 16
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2017-09-02 00:15:43 +08:00
|
|
|
- - ``EPERM``
|
|
|
|
- The caller has no permission to access the device.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2017-09-02 00:15:43 +08:00
|
|
|
- - ``EBUSY``
|
|
|
|
- The the device driver is already in use.
|
|
|
|
|
|
|
|
- - ``EMFILE``
|
|
|
|
- The process already has the maximum number of files open.
|
|
|
|
|
|
|
|
- - ``ENFILE``
|
|
|
|
- The limit on the total number of files open on the system has been
|
|
|
|
reached.
|
|
|
|
|
|
|
|
The generic error codes are described at the
|
|
|
|
:ref:`Generic Error Codes <gen-errors>` chapter.
|