ioctl CEC_G_MODE, CEC_S_MODE
&manvol;
CEC_G_MODECEC_S_MODEGet or set exclusive use of the CEC adapterint ioctlint fdint request__u32 *argpArgumentsfdFile descriptor returned by
open().requestCEC_G_MODE, CEC_S_MODEargpDescription
Note: this documents the proposed CEC API. This API is not yet finalized and
is currently only available as a staging kernel module.
By default any filehandle can use &CEC-TRANSMIT; and &CEC-RECEIVE;, but
in order to prevent applications from stepping on each others toes it must be possible
to obtain exclusive access to the CEC adapter. This ioctl sets the filehandle
to initiator and/or follower mode which can be exclusive depending on the chosen
mode. The initiator is the filehandle that is used
to initiate messages, i.e. it commands other CEC devices. The follower is the filehandle
that receives messages sent to the CEC adapter and processes them. The same filehandle
can be both initiator and follower, or this role can be taken by two different
filehandles.When a CEC message is received, then the CEC framework will decide how
it will be processed. If the message is a reply to an earlier transmitted message,
then the reply is sent back to the filehandle that is waiting for it. In addition
the CEC framework will process it.If the message is not a reply, then the CEC framework will process it
first. If there is no follower, then the message is just discarded and a feature
abort is sent back to the initiator if the framework couldn't process it. If there
is a follower, then the message is passed on to the follower who will use
&CEC-RECEIVE; to dequeue the new message. The framework expects the follower to
make the right decisions.The CEC framework will process core messages unless requested otherwise
by the follower. The follower can enable the passthrough mode. In that case, the
CEC framework will pass on most core messages without processing them and
the follower will have to implement those messages. There are some messages
that the core will always process, regardless of the passthrough mode. See
for details.If there is no initiator, then any CEC filehandle can use &CEC-TRANSMIT;.
If there is an exclusive initiator then only that initiator can call &CEC-TRANSMIT;.
The follower can of course always call &CEC-TRANSMIT;.Available initiator modes are:
Initiator Modes
&cs-def;
CEC_MODE_NO_INITIATOR0x0This is not an initiator, i.e. it cannot transmit CEC messages
or make any other changes to the CEC adapter.CEC_MODE_INITIATOR0x1This is an initiator (the default when the device is opened) and it
can transmit CEC messages and make changes to the CEC adapter, unless there
is an exclusive initiator.CEC_MODE_EXCL_INITIATOR0x2This is an exclusive initiator and this file descriptor is the only one
that can transmit CEC messages and make changes to the CEC adapter. If someone
else is already the exclusive initiator then an attempt to become one will return
the &EBUSY; error.
Available follower modes are:
Follower Modes
&cs-def;
CEC_MODE_NO_FOLLOWER0x00This is not a follower (the default when the device is opened).CEC_MODE_FOLLOWER0x10This is a follower and it will receive CEC messages unless there is
an exclusive follower. You cannot become a follower if CEC_CAP_TRANSMIT
is not set or if CEC_MODE_NO_INITIATOR was specified,
&EINVAL; is returned in that case.CEC_MODE_EXCL_FOLLOWER0x20This is an exclusive follower and only this file descriptor will receive
CEC messages for processing. If someone else is already the exclusive follower
then an attempt to become one will return the &EBUSY; error. You cannot become
a follower if CEC_CAP_TRANSMIT is not set or if
CEC_MODE_NO_INITIATOR was specified, &EINVAL; is returned
in that case.CEC_MODE_EXCL_FOLLOWER_PASSTHRU0x30This is an exclusive follower and only this file descriptor will receive
CEC messages for processing. In addition it will put the CEC device into
passthrough mode, allowing the exclusive follower to handle most core messages
instead of relying on the CEC framework for that. If someone else is already the
exclusive follower then an attempt to become one will return the &EBUSY; error.
You cannot become a follower if CEC_CAP_TRANSMIT
is not set or if CEC_MODE_NO_INITIATOR was specified,
&EINVAL; is returned in that case.CEC_MODE_MONITOR0xe0Put the file descriptor into monitor mode. Can only be used in combination
with CEC_MODE_NO_INITIATOR, otherwise &EINVAL; will be
returned. In monitor mode all messages this CEC device transmits and all messages
it receives (both broadcast messages and directed messages for one its logical
addresses) will be reported. This is very useful for debugging. This is only
allowed if the process has the CAP_NET_ADMIN
capability. If that is not set, then &EPERM; is returned.CEC_MODE_MONITOR_ALL0xf0Put the file descriptor into 'monitor all' mode. Can only be used in combination
with CEC_MODE_NO_INITIATOR, otherwise &EINVAL; will be
returned. In 'monitor all' mode all messages this CEC device transmits and all messages
it receives, including directed messages for other CEC devices will be reported. This
is very useful for debugging, but not all devices support this. This mode requires that
the CEC_CAP_MONITOR_ALL capability is set, otherwise &EINVAL; is
returned. This is only allowed if the process has the CAP_NET_ADMIN
capability. If that is not set, then &EPERM; is returned.
Core message processing details:
Core Message Processing
&cs-def;
CEC_MSG_GET_CEC_VERSIONWhen in passthrough mode this message has to be handled by userspace,
otherwise the core will return the CEC version that was set with &CEC-ADAP-S-LOG-ADDRS;.CEC_MSG_GIVE_DEVICE_VENDOR_IDWhen in passthrough mode this message has to be handled by userspace,
otherwise the core will return the vendor ID that was set with &CEC-ADAP-S-LOG-ADDRS;.CEC_MSG_ABORTWhen in passthrough mode this message has to be handled by userspace,
otherwise the core will return a feature refused message as per the specification.CEC_MSG_GIVE_PHYSICAL_ADDRWhen in passthrough mode this message has to be handled by userspace,
otherwise the core will report the current physical address.CEC_MSG_GIVE_OSD_NAMEWhen in passthrough mode this message has to be handled by userspace,
otherwise the core will report the current OSD name as was set with
&CEC-ADAP-S-LOG-ADDRS;.CEC_MSG_GIVE_FEATURESWhen in passthrough mode this message has to be handled by userspace,
otherwise the core will report the current features as was set with
&CEC-ADAP-S-LOG-ADDRS; or the message is ignore if the CEC version was
older than 2.0.CEC_MSG_USER_CONTROL_PRESSEDIf CEC_CAP_RC is set, then generate a remote control
key press. This message is always passed on to userspace.CEC_MSG_USER_CONTROL_RELEASEDIf CEC_CAP_RC is set, then generate a remote control
key release. This message is always passed on to userspace.CEC_MSG_REPORT_PHYSICAL_ADDRThe CEC framework will make note of the reported physical address
and then just pass the message on to userspace.