1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
4 .. _CEC_ADAP_LOG_ADDRS:
5 .. _CEC_ADAP_G_LOG_ADDRS:
6 .. _CEC_ADAP_S_LOG_ADDRS:
8 ****************************************************
9 ioctls CEC_ADAP_G_LOG_ADDRS and CEC_ADAP_S_LOG_ADDRS
10 ****************************************************
15 CEC_ADAP_G_LOG_ADDRS, CEC_ADAP_S_LOG_ADDRS - Get or set the logical addresses
20 .. c:macro:: CEC_ADAP_G_LOG_ADDRS
22 ``int ioctl(int fd, CEC_ADAP_G_LOG_ADDRS, struct cec_log_addrs *argp)``
24 .. c:macro:: CEC_ADAP_S_LOG_ADDRS
26 ``int ioctl(int fd, CEC_ADAP_S_LOG_ADDRS, struct cec_log_addrs *argp)``
32 File descriptor returned by :c:func:`open()`.
35 Pointer to struct :c:type:`cec_log_addrs`.
40 To query the current CEC logical addresses, applications call
41 :ref:`ioctl CEC_ADAP_G_LOG_ADDRS <CEC_ADAP_G_LOG_ADDRS>` with a pointer to a
42 struct :c:type:`cec_log_addrs` where the driver stores the logical addresses.
44 To set new logical addresses, applications fill in
45 struct :c:type:`cec_log_addrs` and call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`
46 with a pointer to this struct. The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`
47 is only available if ``CEC_CAP_LOG_ADDRS`` is set (the ``ENOTTY`` error code is
48 returned otherwise). The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`
49 can only be called by a file descriptor in initiator mode (see :ref:`CEC_S_MODE`), if not
50 the ``EBUSY`` error code will be returned.
52 To clear existing logical addresses set ``num_log_addrs`` to 0. All other fields
53 will be ignored in that case. The adapter will go to the unconfigured state and the
54 ``cec_version``, ``vendor_id`` and ``osd_name`` fields are all reset to their default
55 values (CEC version 2.0, no vendor ID and an empty OSD name).
57 If the physical address is valid (see :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>`),
58 then this ioctl will block until all requested logical
59 addresses have been claimed. If the file descriptor is in non-blocking mode then it will
60 not wait for the logical addresses to be claimed, instead it just returns 0.
62 A :ref:`CEC_EVENT_STATE_CHANGE <CEC-EVENT-STATE-CHANGE>` event is sent when the
63 logical addresses are claimed or cleared.
65 Attempting to call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>` when
66 logical address types are already defined will return with error ``EBUSY``.
68 .. c:type:: cec_log_addrs
70 .. tabularcolumns:: |p{1.0cm}|p{8.0cm}|p{7.5cm}|
72 .. cssclass:: longtable
74 .. flat-table:: struct cec_log_addrs
80 - ``log_addr[CEC_MAX_LOG_ADDRS]``
81 - The actual logical addresses that were claimed. This is set by the
82 driver. If no logical address could be claimed, then it is set to
83 ``CEC_LOG_ADDR_INVALID``. If this adapter is Unregistered, then
84 ``log_addr[0]`` is set to 0xf and all others to
85 ``CEC_LOG_ADDR_INVALID``.
88 - The bitmask of all logical addresses this adapter has claimed. If
89 this adapter is Unregistered then ``log_addr_mask`` sets bit 15
90 and clears all other bits. If this adapter is not configured at
91 all, then ``log_addr_mask`` is set to 0. Set by the driver.
94 - The CEC version that this adapter shall use. See
95 :ref:`cec-versions`. Used to implement the
96 ``CEC_MSG_CEC_VERSION`` and ``CEC_MSG_REPORT_FEATURES`` messages.
97 Note that :ref:`CEC_OP_CEC_VERSION_1_3A <CEC-OP-CEC-VERSION-1-3A>` is not allowed by the CEC
101 - Number of logical addresses to set up. Must be ≤
102 ``available_log_addrs`` as returned by
103 :ref:`CEC_ADAP_G_CAPS`. All arrays in
104 this structure are only filled up to index
105 ``available_log_addrs``-1. The remaining array elements will be
106 ignored. Note that the CEC 2.0 standard allows for a maximum of 2
107 logical addresses, although some hardware has support for more.
108 ``CEC_MAX_LOG_ADDRS`` is 4. The driver will return the actual
109 number of logical addresses it could claim, which may be less than
110 what was requested. If this field is set to 0, then the CEC
111 adapter shall clear all claimed logical addresses and all other
112 fields will be ignored.
115 - The vendor ID is a 24-bit number that identifies the specific
116 vendor or entity. Based on this ID vendor specific commands may be
117 defined. If you do not want a vendor ID then set it to
118 ``CEC_VENDOR_ID_NONE``.
121 - Flags. See :ref:`cec-log-addrs-flags` for a list of available flags.
124 - The On-Screen Display name as is returned by the
125 ``CEC_MSG_SET_OSD_NAME`` message.
127 - ``primary_device_type[CEC_MAX_LOG_ADDRS]``
128 - Primary device type for each logical address. See
129 :ref:`cec-prim-dev-types` for possible types.
131 - ``log_addr_type[CEC_MAX_LOG_ADDRS]``
132 - Logical address types. See :ref:`cec-log-addr-types` for
133 possible types. The driver will update this with the actual
134 logical address type that it claimed (e.g. it may have to fallback
135 to :ref:`CEC_LOG_ADDR_TYPE_UNREGISTERED <CEC-LOG-ADDR-TYPE-UNREGISTERED>`).
137 - ``all_device_types[CEC_MAX_LOG_ADDRS]``
138 - CEC 2.0 specific: the bit mask of all device types. See
139 :ref:`cec-all-dev-types-flags`. It is used in the CEC 2.0
140 ``CEC_MSG_REPORT_FEATURES`` message. For CEC 1.4 you can either leave
141 this field to 0, or fill it in according to the CEC 2.0 guidelines to
142 give the CEC framework more information about the device type, even
143 though the framework won't use it directly in the CEC message.
145 - ``features[CEC_MAX_LOG_ADDRS][12]``
146 - Features for each logical address. It is used in the CEC 2.0
147 ``CEC_MSG_REPORT_FEATURES`` message. The 12 bytes include both the
148 RC Profile and the Device Features. For CEC 1.4 you can either leave
149 this field to all 0, or fill it in according to the CEC 2.0 guidelines to
150 give the CEC framework more information about the device type, even
151 though the framework won't use it directly in the CEC message.
153 .. tabularcolumns:: |p{7.8cm}|p{1.0cm}|p{8.7cm}|
155 .. _cec-log-addrs-flags:
157 .. flat-table:: Flags for struct cec_log_addrs
162 * .. _`CEC-LOG-ADDRS-FL-ALLOW-UNREG-FALLBACK`:
164 - ``CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK``
166 - By default if no logical address of the requested type can be claimed, then
167 it will go back to the unconfigured state. If this flag is set, then it will
168 fallback to the Unregistered logical address. Note that if the Unregistered
169 logical address was explicitly requested, then this flag has no effect.
170 * .. _`CEC-LOG-ADDRS-FL-ALLOW-RC-PASSTHRU`:
172 - ``CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU``
174 - By default the ``CEC_MSG_USER_CONTROL_PRESSED`` and ``CEC_MSG_USER_CONTROL_RELEASED``
175 messages are only passed on to the follower(s), if any. If this flag is set,
176 then these messages are also passed on to the remote control input subsystem
177 and will appear as keystrokes. This features needs to be enabled explicitly.
178 If CEC is used to enter e.g. passwords, then you may not want to enable this
179 to avoid trivial snooping of the keystrokes.
180 * .. _`CEC-LOG-ADDRS-FL-CDC-ONLY`:
182 - ``CEC_LOG_ADDRS_FL_CDC_ONLY``
184 - If this flag is set, then the device is CDC-Only. CDC-Only CEC devices
185 are CEC devices that can only handle CDC messages.
187 All other messages are ignored.
189 .. tabularcolumns:: |p{7.8cm}|p{1.0cm}|p{8.7cm}|
193 .. flat-table:: CEC Versions
198 * .. _`CEC-OP-CEC-VERSION-1-3A`:
200 - ``CEC_OP_CEC_VERSION_1_3A``
202 - CEC version according to the HDMI 1.3a standard.
203 * .. _`CEC-OP-CEC-VERSION-1-4B`:
205 - ``CEC_OP_CEC_VERSION_1_4B``
207 - CEC version according to the HDMI 1.4b standard.
208 * .. _`CEC-OP-CEC-VERSION-2-0`:
210 - ``CEC_OP_CEC_VERSION_2_0``
212 - CEC version according to the HDMI 2.0 standard.
214 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
216 .. _cec-prim-dev-types:
218 .. flat-table:: CEC Primary Device Types
223 * .. _`CEC-OP-PRIM-DEVTYPE-TV`:
225 - ``CEC_OP_PRIM_DEVTYPE_TV``
228 * .. _`CEC-OP-PRIM-DEVTYPE-RECORD`:
230 - ``CEC_OP_PRIM_DEVTYPE_RECORD``
232 - Use for a recording device.
233 * .. _`CEC-OP-PRIM-DEVTYPE-TUNER`:
235 - ``CEC_OP_PRIM_DEVTYPE_TUNER``
237 - Use for a device with a tuner.
238 * .. _`CEC-OP-PRIM-DEVTYPE-PLAYBACK`:
240 - ``CEC_OP_PRIM_DEVTYPE_PLAYBACK``
242 - Use for a playback device.
243 * .. _`CEC-OP-PRIM-DEVTYPE-AUDIOSYSTEM`:
245 - ``CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM``
247 - Use for an audio system (e.g. an audio/video receiver).
248 * .. _`CEC-OP-PRIM-DEVTYPE-SWITCH`:
250 - ``CEC_OP_PRIM_DEVTYPE_SWITCH``
252 - Use for a CEC switch.
253 * .. _`CEC-OP-PRIM-DEVTYPE-VIDEOPROC`:
255 - ``CEC_OP_PRIM_DEVTYPE_VIDEOPROC``
257 - Use for a video processor device.
259 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
261 .. _cec-log-addr-types:
263 .. flat-table:: CEC Logical Address Types
268 * .. _`CEC-LOG-ADDR-TYPE-TV`:
270 - ``CEC_LOG_ADDR_TYPE_TV``
273 * .. _`CEC-LOG-ADDR-TYPE-RECORD`:
275 - ``CEC_LOG_ADDR_TYPE_RECORD``
277 - Use for a recording device.
278 * .. _`CEC-LOG-ADDR-TYPE-TUNER`:
280 - ``CEC_LOG_ADDR_TYPE_TUNER``
282 - Use for a tuner device.
283 * .. _`CEC-LOG-ADDR-TYPE-PLAYBACK`:
285 - ``CEC_LOG_ADDR_TYPE_PLAYBACK``
287 - Use for a playback device.
288 * .. _`CEC-LOG-ADDR-TYPE-AUDIOSYSTEM`:
290 - ``CEC_LOG_ADDR_TYPE_AUDIOSYSTEM``
292 - Use for an audio system device.
293 * .. _`CEC-LOG-ADDR-TYPE-SPECIFIC`:
295 - ``CEC_LOG_ADDR_TYPE_SPECIFIC``
297 - Use for a second TV or for a video processor device.
298 * .. _`CEC-LOG-ADDR-TYPE-UNREGISTERED`:
300 - ``CEC_LOG_ADDR_TYPE_UNREGISTERED``
302 - Use this if you just want to remain unregistered. Used for pure
303 CEC switches or CDC-only devices (CDC: Capability Discovery and
307 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
309 .. _cec-all-dev-types-flags:
311 .. flat-table:: CEC All Device Types Flags
316 * .. _`CEC-OP-ALL-DEVTYPE-TV`:
318 - ``CEC_OP_ALL_DEVTYPE_TV``
320 - This supports the TV type.
321 * .. _`CEC-OP-ALL-DEVTYPE-RECORD`:
323 - ``CEC_OP_ALL_DEVTYPE_RECORD``
325 - This supports the Recording type.
326 * .. _`CEC-OP-ALL-DEVTYPE-TUNER`:
328 - ``CEC_OP_ALL_DEVTYPE_TUNER``
330 - This supports the Tuner type.
331 * .. _`CEC-OP-ALL-DEVTYPE-PLAYBACK`:
333 - ``CEC_OP_ALL_DEVTYPE_PLAYBACK``
335 - This supports the Playback type.
336 * .. _`CEC-OP-ALL-DEVTYPE-AUDIOSYSTEM`:
338 - ``CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM``
340 - This supports the Audio System type.
341 * .. _`CEC-OP-ALL-DEVTYPE-SWITCH`:
343 - ``CEC_OP_ALL_DEVTYPE_SWITCH``
345 - This supports the CEC Switch or Video Processing type.
351 On success 0 is returned, on error -1 and the ``errno`` variable is set
352 appropriately. The generic error codes are described at the
353 :ref:`Generic Error Codes <gen-errors>` chapter.
355 The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>` can return the following
359 The ``CEC_CAP_LOG_ADDRS`` capability wasn't set, so this ioctl is not supported.
362 The CEC adapter is currently configuring itself, or it is already configured and
363 ``num_log_addrs`` is non-zero, or another filehandle is in exclusive follower or
364 initiator mode, or the filehandle is in mode ``CEC_MODE_NO_INITIATOR``.
367 The contents of struct :c:type:`cec_log_addrs` is invalid.