18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: CEC
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _CEC_MODE:
58c2ecf20Sopenharmony_ci.. _CEC_G_MODE:
68c2ecf20Sopenharmony_ci.. _CEC_S_MODE:
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci********************************
98c2ecf20Sopenharmony_ciioctls CEC_G_MODE and CEC_S_MODE
108c2ecf20Sopenharmony_ci********************************
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciCEC_G_MODE, CEC_S_MODE - Get or set exclusive use of the CEC adapter
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciSynopsis
158c2ecf20Sopenharmony_ci========
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci.. c:macro:: CEC_G_MODE
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci``int ioctl(int fd, CEC_G_MODE, __u32 *argp)``
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci.. c:macro:: CEC_S_MODE
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci``int ioctl(int fd, CEC_S_MODE, __u32 *argp)``
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciArguments
268c2ecf20Sopenharmony_ci=========
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci``fd``
298c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci``argp``
328c2ecf20Sopenharmony_ci    Pointer to CEC mode.
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciDescription
358c2ecf20Sopenharmony_ci===========
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciBy default any filehandle can use :ref:`CEC_TRANSMIT`, but in order to prevent
388c2ecf20Sopenharmony_ciapplications from stepping on each others toes it must be possible to
398c2ecf20Sopenharmony_ciobtain exclusive access to the CEC adapter. This ioctl sets the
408c2ecf20Sopenharmony_cifilehandle to initiator and/or follower mode which can be exclusive
418c2ecf20Sopenharmony_cidepending on the chosen mode. The initiator is the filehandle that is
428c2ecf20Sopenharmony_ciused to initiate messages, i.e. it commands other CEC devices. The
438c2ecf20Sopenharmony_cifollower is the filehandle that receives messages sent to the CEC
448c2ecf20Sopenharmony_ciadapter and processes them. The same filehandle can be both initiator
458c2ecf20Sopenharmony_ciand follower, or this role can be taken by two different filehandles.
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciWhen a CEC message is received, then the CEC framework will decide how
488c2ecf20Sopenharmony_ciit will be processed. If the message is a reply to an earlier
498c2ecf20Sopenharmony_citransmitted message, then the reply is sent back to the filehandle that
508c2ecf20Sopenharmony_ciis waiting for it. In addition the CEC framework will process it.
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ciIf the message is not a reply, then the CEC framework will process it
538c2ecf20Sopenharmony_cifirst. If there is no follower, then the message is just discarded and a
548c2ecf20Sopenharmony_cifeature abort is sent back to the initiator if the framework couldn't
558c2ecf20Sopenharmony_ciprocess it. If there is a follower, then the message is passed on to the
568c2ecf20Sopenharmony_cifollower who will use :ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>` to dequeue
578c2ecf20Sopenharmony_cithe new message. The framework expects the follower to make the right
588c2ecf20Sopenharmony_cidecisions.
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciThe CEC framework will process core messages unless requested otherwise
618c2ecf20Sopenharmony_ciby the follower. The follower can enable the passthrough mode. In that
628c2ecf20Sopenharmony_cicase, the CEC framework will pass on most core messages without
638c2ecf20Sopenharmony_ciprocessing them and the follower will have to implement those messages.
648c2ecf20Sopenharmony_ciThere are some messages that the core will always process, regardless of
658c2ecf20Sopenharmony_cithe passthrough mode. See :ref:`cec-core-processing` for details.
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ciIf there is no initiator, then any CEC filehandle can use
688c2ecf20Sopenharmony_ci:ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>`. If there is an exclusive
698c2ecf20Sopenharmony_ciinitiator then only that initiator can call
708c2ecf20Sopenharmony_ci:ref:`CEC_TRANSMIT`. The follower can of course
718c2ecf20Sopenharmony_cialways call :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>`.
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ciAvailable initiator modes are:
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}|
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci.. _cec-mode-initiator_e:
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci.. flat-table:: Initiator Modes
808c2ecf20Sopenharmony_ci    :header-rows:  0
818c2ecf20Sopenharmony_ci    :stub-columns: 0
828c2ecf20Sopenharmony_ci    :widths:       3 1 16
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci    * .. _`CEC-MODE-NO-INITIATOR`:
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci      - ``CEC_MODE_NO_INITIATOR``
878c2ecf20Sopenharmony_ci      - 0x0
888c2ecf20Sopenharmony_ci      - This is not an initiator, i.e. it cannot transmit CEC messages or
898c2ecf20Sopenharmony_ci	make any other changes to the CEC adapter.
908c2ecf20Sopenharmony_ci    * .. _`CEC-MODE-INITIATOR`:
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci      - ``CEC_MODE_INITIATOR``
938c2ecf20Sopenharmony_ci      - 0x1
948c2ecf20Sopenharmony_ci      - This is an initiator (the default when the device is opened) and
958c2ecf20Sopenharmony_ci	it can transmit CEC messages and make changes to the CEC adapter,
968c2ecf20Sopenharmony_ci	unless there is an exclusive initiator.
978c2ecf20Sopenharmony_ci    * .. _`CEC-MODE-EXCL-INITIATOR`:
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci      - ``CEC_MODE_EXCL_INITIATOR``
1008c2ecf20Sopenharmony_ci      - 0x2
1018c2ecf20Sopenharmony_ci      - This is an exclusive initiator and this file descriptor is the
1028c2ecf20Sopenharmony_ci	only one that can transmit CEC messages and make changes to the
1038c2ecf20Sopenharmony_ci	CEC adapter. If someone else is already the exclusive initiator
1048c2ecf20Sopenharmony_ci	then an attempt to become one will return the ``EBUSY`` error code
1058c2ecf20Sopenharmony_ci	error.
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ciAvailable follower modes are:
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{0.9cm}|p{10.0cm}|
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci.. _cec-mode-follower_e:
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci.. cssclass:: longtable
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci.. flat-table:: Follower Modes
1168c2ecf20Sopenharmony_ci    :header-rows:  0
1178c2ecf20Sopenharmony_ci    :stub-columns: 0
1188c2ecf20Sopenharmony_ci    :widths:       3 1 16
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci    * .. _`CEC-MODE-NO-FOLLOWER`:
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci      - ``CEC_MODE_NO_FOLLOWER``
1238c2ecf20Sopenharmony_ci      - 0x00
1248c2ecf20Sopenharmony_ci      - This is not a follower (the default when the device is opened).
1258c2ecf20Sopenharmony_ci    * .. _`CEC-MODE-FOLLOWER`:
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci      - ``CEC_MODE_FOLLOWER``
1288c2ecf20Sopenharmony_ci      - 0x10
1298c2ecf20Sopenharmony_ci      - This is a follower and it will receive CEC messages unless there
1308c2ecf20Sopenharmony_ci	is an exclusive follower. You cannot become a follower if
1318c2ecf20Sopenharmony_ci	:ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>` is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`
1328c2ecf20Sopenharmony_ci	was specified, the ``EINVAL`` error code is returned in that case.
1338c2ecf20Sopenharmony_ci    * .. _`CEC-MODE-EXCL-FOLLOWER`:
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci      - ``CEC_MODE_EXCL_FOLLOWER``
1368c2ecf20Sopenharmony_ci      - 0x20
1378c2ecf20Sopenharmony_ci      - This is an exclusive follower and only this file descriptor will
1388c2ecf20Sopenharmony_ci	receive CEC messages for processing. If someone else is already
1398c2ecf20Sopenharmony_ci	the exclusive follower then an attempt to become one will return
1408c2ecf20Sopenharmony_ci	the ``EBUSY`` error code. You cannot become a follower if
1418c2ecf20Sopenharmony_ci	:ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>` is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`
1428c2ecf20Sopenharmony_ci	was specified, the ``EINVAL`` error code is returned in that case.
1438c2ecf20Sopenharmony_ci    * .. _`CEC-MODE-EXCL-FOLLOWER-PASSTHRU`:
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci      - ``CEC_MODE_EXCL_FOLLOWER_PASSTHRU``
1468c2ecf20Sopenharmony_ci      - 0x30
1478c2ecf20Sopenharmony_ci      - This is an exclusive follower and only this file descriptor will
1488c2ecf20Sopenharmony_ci	receive CEC messages for processing. In addition it will put the
1498c2ecf20Sopenharmony_ci	CEC device into passthrough mode, allowing the exclusive follower
1508c2ecf20Sopenharmony_ci	to handle most core messages instead of relying on the CEC
1518c2ecf20Sopenharmony_ci	framework for that. If someone else is already the exclusive
1528c2ecf20Sopenharmony_ci	follower then an attempt to become one will return the ``EBUSY`` error
1538c2ecf20Sopenharmony_ci	code. You cannot become a follower if :ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>`
1548c2ecf20Sopenharmony_ci	is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>` was specified,
1558c2ecf20Sopenharmony_ci	the ``EINVAL`` error code is returned in that case.
1568c2ecf20Sopenharmony_ci    * .. _`CEC-MODE-MONITOR-PIN`:
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci      - ``CEC_MODE_MONITOR_PIN``
1598c2ecf20Sopenharmony_ci      - 0xd0
1608c2ecf20Sopenharmony_ci      - Put the file descriptor into pin monitoring mode. Can only be used in
1618c2ecf20Sopenharmony_ci	combination with :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`,
1628c2ecf20Sopenharmony_ci	otherwise the ``EINVAL`` error code will be returned.
1638c2ecf20Sopenharmony_ci	This mode requires that the :ref:`CEC_CAP_MONITOR_PIN <CEC-CAP-MONITOR-PIN>`
1648c2ecf20Sopenharmony_ci	capability is set, otherwise the ``EINVAL`` error code is returned.
1658c2ecf20Sopenharmony_ci	While in pin monitoring mode this file descriptor can receive the
1668c2ecf20Sopenharmony_ci	``CEC_EVENT_PIN_CEC_LOW`` and ``CEC_EVENT_PIN_CEC_HIGH`` events to see the
1678c2ecf20Sopenharmony_ci	low-level CEC pin transitions. This is very useful for debugging.
1688c2ecf20Sopenharmony_ci	This mode is only allowed if the process has the ``CAP_NET_ADMIN``
1698c2ecf20Sopenharmony_ci	capability. If that is not set, then the ``EPERM`` error code is returned.
1708c2ecf20Sopenharmony_ci    * .. _`CEC-MODE-MONITOR`:
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci      - ``CEC_MODE_MONITOR``
1738c2ecf20Sopenharmony_ci      - 0xe0
1748c2ecf20Sopenharmony_ci      - Put the file descriptor into monitor mode. Can only be used in
1758c2ecf20Sopenharmony_ci	combination with :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`,
1768c2ecf20Sopenharmony_ci	otherwise the ``EINVAL`` error code will be returned.
1778c2ecf20Sopenharmony_ci	In monitor mode all messages this CEC
1788c2ecf20Sopenharmony_ci	device transmits and all messages it receives (both broadcast
1798c2ecf20Sopenharmony_ci	messages and directed messages for one its logical addresses) will
1808c2ecf20Sopenharmony_ci	be reported. This is very useful for debugging. This is only
1818c2ecf20Sopenharmony_ci	allowed if the process has the ``CAP_NET_ADMIN`` capability. If
1828c2ecf20Sopenharmony_ci	that is not set, then the ``EPERM`` error code is returned.
1838c2ecf20Sopenharmony_ci    * .. _`CEC-MODE-MONITOR-ALL`:
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci      - ``CEC_MODE_MONITOR_ALL``
1868c2ecf20Sopenharmony_ci      - 0xf0
1878c2ecf20Sopenharmony_ci      - Put the file descriptor into 'monitor all' mode. Can only be used
1888c2ecf20Sopenharmony_ci	in combination with :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`, otherwise
1898c2ecf20Sopenharmony_ci	the ``EINVAL`` error code will be returned. In 'monitor all' mode all messages
1908c2ecf20Sopenharmony_ci	this CEC device transmits and all messages it receives, including
1918c2ecf20Sopenharmony_ci	directed messages for other CEC devices will be reported. This is
1928c2ecf20Sopenharmony_ci	very useful for debugging, but not all devices support this. This
1938c2ecf20Sopenharmony_ci	mode requires that the :ref:`CEC_CAP_MONITOR_ALL <CEC-CAP-MONITOR-ALL>` capability is set,
1948c2ecf20Sopenharmony_ci	otherwise the ``EINVAL`` error code is returned. This is only allowed if
1958c2ecf20Sopenharmony_ci	the process has the ``CAP_NET_ADMIN`` capability. If that is not
1968c2ecf20Sopenharmony_ci	set, then the ``EPERM`` error code is returned.
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ciCore message processing details:
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{10.9cm}|
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci.. _cec-core-processing:
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci.. flat-table:: Core Message Processing
2058c2ecf20Sopenharmony_ci    :header-rows:  0
2068c2ecf20Sopenharmony_ci    :stub-columns: 0
2078c2ecf20Sopenharmony_ci    :widths: 1 8
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci    * .. _`CEC-MSG-GET-CEC-VERSION`:
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci      - ``CEC_MSG_GET_CEC_VERSION``
2128c2ecf20Sopenharmony_ci      - The core will return the CEC version that was set with
2138c2ecf20Sopenharmony_ci	:ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`,
2148c2ecf20Sopenharmony_ci	except when in passthrough mode. In passthrough mode the core
2158c2ecf20Sopenharmony_ci	does nothing and this message has to be handled by a follower
2168c2ecf20Sopenharmony_ci	instead.
2178c2ecf20Sopenharmony_ci    * .. _`CEC-MSG-GIVE-DEVICE-VENDOR-ID`:
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci      - ``CEC_MSG_GIVE_DEVICE_VENDOR_ID``
2208c2ecf20Sopenharmony_ci      - The core will return the vendor ID that was set with
2218c2ecf20Sopenharmony_ci	:ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`,
2228c2ecf20Sopenharmony_ci	except when in passthrough mode. In passthrough mode the core
2238c2ecf20Sopenharmony_ci	does nothing and this message has to be handled by a follower
2248c2ecf20Sopenharmony_ci	instead.
2258c2ecf20Sopenharmony_ci    * .. _`CEC-MSG-ABORT`:
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci      - ``CEC_MSG_ABORT``
2288c2ecf20Sopenharmony_ci      - The core will return a Feature Abort message with reason
2298c2ecf20Sopenharmony_ci        'Feature Refused' as per the specification, except when in
2308c2ecf20Sopenharmony_ci	passthrough mode. In passthrough mode the core does nothing
2318c2ecf20Sopenharmony_ci	and this message has to be handled by a follower instead.
2328c2ecf20Sopenharmony_ci    * .. _`CEC-MSG-GIVE-PHYSICAL-ADDR`:
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci      - ``CEC_MSG_GIVE_PHYSICAL_ADDR``
2358c2ecf20Sopenharmony_ci      - The core will report the current physical address, except when
2368c2ecf20Sopenharmony_ci        in passthrough mode. In passthrough mode the core does nothing
2378c2ecf20Sopenharmony_ci	and this message has to be handled by a follower instead.
2388c2ecf20Sopenharmony_ci    * .. _`CEC-MSG-GIVE-OSD-NAME`:
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci      - ``CEC_MSG_GIVE_OSD_NAME``
2418c2ecf20Sopenharmony_ci      - The core will report the current OSD name that was set with
2428c2ecf20Sopenharmony_ci	:ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`,
2438c2ecf20Sopenharmony_ci	except when in passthrough mode. In passthrough mode the core
2448c2ecf20Sopenharmony_ci	does nothing and this message has to be handled by a follower
2458c2ecf20Sopenharmony_ci	instead.
2468c2ecf20Sopenharmony_ci    * .. _`CEC-MSG-GIVE-FEATURES`:
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci      - ``CEC_MSG_GIVE_FEATURES``
2498c2ecf20Sopenharmony_ci      - The core will do nothing if the CEC version is older than 2.0,
2508c2ecf20Sopenharmony_ci        otherwise it will report the current features that were set with
2518c2ecf20Sopenharmony_ci	:ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`,
2528c2ecf20Sopenharmony_ci	except when in passthrough mode. In passthrough mode the core
2538c2ecf20Sopenharmony_ci	does nothing (for any CEC version) and this message has to be handled
2548c2ecf20Sopenharmony_ci	by a follower instead.
2558c2ecf20Sopenharmony_ci    * .. _`CEC-MSG-USER-CONTROL-PRESSED`:
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci      - ``CEC_MSG_USER_CONTROL_PRESSED``
2588c2ecf20Sopenharmony_ci      - If :ref:`CEC_CAP_RC <CEC-CAP-RC>` is set and if
2598c2ecf20Sopenharmony_ci        :ref:`CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU <CEC-LOG-ADDRS-FL-ALLOW-RC-PASSTHRU>`
2608c2ecf20Sopenharmony_ci	is set, then generate a remote control key
2618c2ecf20Sopenharmony_ci	press. This message is always passed on to the follower(s).
2628c2ecf20Sopenharmony_ci    * .. _`CEC-MSG-USER-CONTROL-RELEASED`:
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci      - ``CEC_MSG_USER_CONTROL_RELEASED``
2658c2ecf20Sopenharmony_ci      - If :ref:`CEC_CAP_RC <CEC-CAP-RC>` is set and if
2668c2ecf20Sopenharmony_ci        :ref:`CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU <CEC-LOG-ADDRS-FL-ALLOW-RC-PASSTHRU>`
2678c2ecf20Sopenharmony_ci        is set, then generate a remote control key
2688c2ecf20Sopenharmony_ci	release. This message is always passed on to the follower(s).
2698c2ecf20Sopenharmony_ci    * .. _`CEC-MSG-REPORT-PHYSICAL-ADDR`:
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci      - ``CEC_MSG_REPORT_PHYSICAL_ADDR``
2728c2ecf20Sopenharmony_ci      - The CEC framework will make note of the reported physical address
2738c2ecf20Sopenharmony_ci	and then just pass the message on to the follower(s).
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ciReturn Value
2778c2ecf20Sopenharmony_ci============
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
2808c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
2818c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ciThe :ref:`ioctl CEC_S_MODE <CEC_S_MODE>` can return the following
2848c2ecf20Sopenharmony_cierror codes:
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ciEINVAL
2878c2ecf20Sopenharmony_ci    The requested mode is invalid.
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ciEPERM
2908c2ecf20Sopenharmony_ci    Monitor mode is requested, but the process does have the ``CAP_NET_ADMIN``
2918c2ecf20Sopenharmony_ci    capability.
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ciEBUSY
2948c2ecf20Sopenharmony_ci    Someone else is already an exclusive follower or initiator.
295