convergence.de
 cryptolabs.org
 directfb.org
 linuxtv.org
 
 linuxtv
 projects
 developer
   DVB
    API
   DVD
   Mbone
   CVS
 download
 contact
 

DVB SEC API

The DVB SEC device controls the Satellite Equipment Control of the DVB hardware, i.e. DiSEqC and V-SEC. It is accessed through /dev/ost/sec.

The function calls defined in the include file sec.h aredescribed in detail below:

SEC API IO control calls


int open(const char *deviceName, int flags);

    DESCRIPTION

	This system call opens a named SEC device for subsequent use.
        If the device is opened in read-only mode, only status and statistics 
	monitoring is allowed. If the device is opened in read/write mode, all
	types of operations can be performed.
	Any number of applications can have simultaneous access to the device.

    PARAMETERS

	const char *deviceName	I Name of the SEC device.

        int flags		I Valid values are:
                                  O_RDONLY             read-only access
                                  O_RDWR               read/write access

	The optional flag O_NONBLOCK is not supported. If O_NONBLOCK is set, 
	open() and most other subsequent calls to the device will return ­1 and 
	set errno to EWOULDBLOCK.
	The communication with the peripheral devices is sequential by nature, 
	so it is probably preferable to use the device in synchronous mode. 
	This is the motivation for not going through the extra effort of 
	implementing asynchronous operation of the device.

    RETURNS

	ENODEV			Device not loaded/available
        EFAULT                  deviceName does not refer to a valid memory area.
        EINVAL                  Invalid argument




int close(int fd);

    DESCRIPTION

	This system call closes a previously opened SEC device.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

    RETURNS
    
	EBADF			fd is not a valid file descriptor.




int ioctl(int fd, int request = SEC_GET_STATUS, struct secStatus* status);

    DESCRIPTION

	This call gets the status of the device.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

        int request           I Equals SEC_GET_STATUS for this command.

        struct secStatus* status   O The status of the device.

    RETURNS

	ENODEV			Device driver not loaded/available

        EFAULT                  status is an invalid pointer

        EBUSY                   Device or resource busy

        EINVAL                  Invalid argument

        EPERM                   File not opened with read permissions

        EINTERNAL               Internal error in the device driver




int ioctl(int fd, int request = SEC_RESET_OVERLOAD);

    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.


    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

        int request           I Equals SEC_RESET_OVERLOAD for this command.

    RETURNS

	EBADF                   fd is not a valid file descriptor.

        EPERM                   Permission denied (needs read/write access)

        EINTERNAL               Internal error in the device driver




int ioctl(int fd, int request = SEC_SEND_SEQUENCE, struct secCmdSequence *seq);

    DESCRIPTION

	This ioctl call is used to send a sequence of DiSEqCTM and/or V-SEC 
	commands. The first version of the SEC device does not support V-SEC 
	signalling and it aborts the operation with an error code if a V-SEC 
	command is detected in the input data.

        !  The call will fail with errno set to EBUSOVERLOAD if the bus is 
	   overloaded. If the bus is overloaded, SEC_RESET_OVERLOAD can be 
           called and the operation can be retried.

        !  If seq.numCommands equals 0 and seq.miniCommand equals SEC_MINI_NONE,
	   the bus voltage will be switched and the continuous 22kHz tone 
	   generation enabled/disabled immediately.
 
        This operation is atomic. If several processes calls this ioctl 
	simultaneously, the operations will be serialised so a complete sequence
	is sent at a time.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

        int request           I Equals  SEC_SEND_SEQUENCE for this command.

        struct secCmdSequence *seq    I Pointer to the command sequence to be transmitted.

    RETURNS
    
	EBADF			Fd is not a valid file descriptor.
        
	EFAULT                  Seq points to an invalid address.
        
        EINVAL                  The data structure referred to by seq is invalid in
                                some way.

        EPERM                   Permission denied (needs read/write access)

        EINTERNAL               Internal error in the device driver


        EBUSMODE                The device is not prepared for transmission 
				(e.g. it might be manually powered off).

        EBUSOVERLOAD                  Bus overload has occurred.




int ioctl(int fd, int request = SEC_SET_TONE, secToneMode tone);

    DESCRIPTION

	This call is used to set the generation of the continuous 22kHz tone. 
	The possibility to just change the tone mode is already provided by 
	ioctl SEC_SEND_SEQUENCE, but SEC_SET_TONE is an easier to use interface.
        To keep the transmission of a command sequence (see section 4.4.5 ) as 
	an atomic operation, SEC_SET_TONE will block if a transmission is in 
	progress. This call requires read/write permissions.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

        int request           I Equals SEC_SET_TONE for this command.

        secToneMode tone      I The requested tone generation mode (on/off).

    RETURNS

	ENODEV			Device driver not loaded/available

        EBUSY                   Device or resource busy

        EINVAL                  Invalid argument

        EPERM                   File not opened with read permissions

        EINTERNAL               Internal error in the device driver




int ioctl(int fd, int request = SEC_SET_VOLTAGE, secVoltage voltage);

    DESCRIPTION
    
	This call is used to set the bus voltage. The possibility to just change
	the bus voltage is already provided by ioctl SEC_SEND_SEQUENCE, but 
	SEC_SET_VOLTAGE is an easier to use interface.
        To keep the transmission of a command sequence (see section 4.4.5 ) as
	an atomic operation, SEC_SET_VOLTAGE will block if a transmission is in 
	progress.
	This call requires read/write permissions.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

        int request           I Equals SEC_SET_VOLTAGE for this command.

        secVoltage voltage    I The requested bus voltage.

    RETURNS

	ENODEV			Device driver not loaded/available
        
	EBUSY                   Device or resource busy
        
	EINVAL                  Invalid argument
        
	EPERM                   File not opened with read permissions

	EINTERNAL               Internal error in the device driver