2.4.1. Digital TV frontend open()¶
fe-open - Open a frontend device
int open(const char *device_name, int flags)¶
Device to be opened.
Open flags. Access can either be
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.
O_NONBLOCKflag is given, the system calls may return
EAGAINerror code when no data is available or when the device driver is temporarily busy.
Other flags have no effect.
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
with ioctl FE_GET_INFO.
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
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.
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
22.214.171.124. Return Value¶
open() returns the new file descriptor.
On error, -1 is returned, and the
errno variable is set appropriately.
Possible error codes are:
On success 0 is returned, and
ca_slot_info is filled.
On error -1 is returned, and the
errno variable is set
The caller has no permission to access the device.
The the device driver is already in use.
The process already has the maximum number of files open.
The limit on the total number of files open on the system has been reached.
The generic error codes are described at the Generic Error Codes chapter.