doc-rst: cec: update documentation
Subsystems (2)
PATCH v3 1/1 doc-rst: cec: update documentation
Update and expand the CEC documentation. Especially w.r.t. non-blocking mode.
Signed-off-by Hans Verkuil <[email protected]>
---
This depends on https://patchwork.linuxtv.org/patch/35614/.
Changes since v2: better document the timestamp fields
Changes since v1: update the documentation of the all_device_types and features fields due to changes in the CEC API (these were ignored for CEC 1.4, but after the pull request above they are no longer ignored).
---
Documentation/media/uapi/cec/cec-func-open.rst +4 -4
@@ -32,12 +32,12 @@ Arguments Open flags. Access mode must be ``O_RDWR``. When the ``O_NONBLOCK`` flag is given, the - :ref:`CEC_RECEIVE <CEC_RECEIVE>` ioctl will return the EAGAIN - error code when no message is available, and ioctls - :ref:`CEC_TRANSMIT <CEC_TRANSMIT>`, + :ref:`CEC_RECEIVE <CEC_RECEIVE>` and :ref:`CEC_DQEVENT <CEC_DQEVENT>` ioctls + will return the ``EAGAIN`` error code when no message or event is available, and + ioctls :ref:`CEC_TRANSMIT <CEC_TRANSMIT>`, :ref:`CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` and :ref:`CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>` - all act in non-blocking mode. + all return 0. Other flags have no effect.
Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +35 -19
98 lines not on this page · raw message
Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst +15 -4
@@ -44,10 +44,21 @@ driver stores the physical address. To set a new physical address applications store the physical address in a __u16 and call :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` with a pointer to this integer. The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` is only available if -``CEC_CAP_PHYS_ADDR`` is set (ENOTTY error code will be returned -otherwise). The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` can only be called by a file handle -in initiator mode (see :ref:`CEC_S_MODE`), if not -EBUSY error code will be returned. +``CEC_CAP_PHYS_ADDR`` is set (the ``ENOTTY`` error code will be returned +otherwise). The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` can only be called +by a file descriptor in initiator mode (see :ref:`CEC_S_MODE`), if not +the ``EBUSY`` error code will be returned. + +To clear an existing physical address use ``CEC_PHYS_ADDR_INVALID``. +The adapter will go to the unconfigured state. + +If logical address types have been defined (see :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`), +then this ioctl will block until all +requested logical addresses have been claimed. If the file descriptor is in non-blocking mode +then it will not wait for the logical addresses to be claimed, instead it just returns 0. + +A :ref:`CEC_EVENT_STATE_CHANGE <CEC-EVENT-STATE-CHANGE>` event is sent when the physical address +changes. The physical address is a 16-bit number where each group of 4 bits represent a digit of the physical address a.b.c.d where the most
Documentation/media/uapi/cec/cec-ioc-dqevent.rst +3 -1
@@ -38,7 +38,7 @@ Description CEC devices can send asynchronous events. These can be retrieved by calling :ref:`ioctl CEC_DQEVENT <CEC_DQEVENT>`. If the file descriptor is in non-blocking mode and no event is pending, then it will return -1 and -set errno to the EAGAIN error code. +set errno to the ``EAGAIN`` error code. The internal event queues are per-filehandle and per-event type. If there is no more room in a queue then the last event is overwritten with
@@ -117,6 +117,8 @@ it is guaranteed that the state did change in between the two events. - ``ts`` - Timestamp of the event in ns. + The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access + the same clock from userspace use :c:func:`clock_gettime(2)`. -
Documentation/media/uapi/cec/cec-ioc-g-mode.rst +13 -13
@@ -108,7 +108,7 @@ Available initiator modes are: - This 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 code + then an attempt to become one will return the ``EBUSY`` error code error.
@@ -140,7 +140,7 @@ Available follower modes are: - This is a follower and it will receive CEC messages unless there is an exclusive follower. You cannot become a follower if :ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>` is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>` - was specified, EINVAL error code is returned in that case. + was specified, the ``EINVAL`` error code is returned in that case. - .. _`CEC-MODE-EXCL-FOLLOWER`:
@@ -151,9 +151,9 @@ Available follower modes are: - This 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 code error. You cannot become a follower if + the ``EBUSY`` error code. You cannot become a follower if :ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>` is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>` - was specified, EINVAL error code is returned in that case. + was specified, the ``EINVAL`` error code is returned in that case. - .. _`CEC-MODE-EXCL-FOLLOWER-PASSTHRU`:
@@ -166,10 +166,10 @@ Available follower modes are: 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 - code error. You cannot become a follower if :ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>` - is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>` was specified, EINVAL - error code is returned in that case. + follower then an attempt to become one will return the ``EBUSY`` error + code. You cannot become a follower if :ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>` + is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>` was specified, + the ``EINVAL`` error code is returned in that case. - .. _`CEC-MODE-MONITOR`:
@@ -184,7 +184,7 @@ Available follower modes are: 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 error code is returned. + that is not set, then the ``EPERM`` error code is returned. - .. _`CEC-MODE-MONITOR-ALL`:
@@ -193,15 +193,15 @@ Available follower modes are: - 0xf0 - Put the file descriptor into 'monitor all' mode. Can only be used - in combination with :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`, otherwise EINVAL - error code will be returned. In 'monitor all' mode all messages + in combination with :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`, otherwise + the ``EINVAL`` error code 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 :ref:`CEC_CAP_MONITOR_ALL <CEC-CAP-MONITOR-ALL>` capability is set, - otherwise EINVAL error code is returned. This is only allowed if + otherwise the ``EINVAL`` error code is returned. This is only allowed if the process has the ``CAP_NET_ADMIN`` capability. If that is not - set, then EPERM error code is returned. + set, then the ``EPERM`` error code is returned. Core message processing details:
Documentation/media/uapi/cec/cec-ioc-receive.rst +40 -17
102 lines not on this page · raw message