1 .. -*- coding: utf-8; mode: rst -*-
3 .. _CEC_ADAP_LOG_ADDRS:
4 .. _CEC_ADAP_G_LOG_ADDRS:
5 .. _CEC_ADAP_S_LOG_ADDRS:
7 ****************************************************
8 ioctls CEC_ADAP_G_LOG_ADDRS and CEC_ADAP_S_LOG_ADDRS
9 ****************************************************
14 CEC_ADAP_G_LOG_ADDRS, CEC_ADAP_S_LOG_ADDRS - Get or set the logical addresses
20 .. c:function:: int ioctl( int fd, CEC_ADAP_G_LOG_ADDRS, struct cec_log_addrs *argp )
21 :name: CEC_ADAP_G_LOG_ADDRS
23 .. c:function:: int ioctl( int fd, CEC_ADAP_S_LOG_ADDRS, struct cec_log_addrs *argp )
24 :name: CEC_ADAP_S_LOG_ADDRS
30 File descriptor returned by :c:func:`open() <cec-open>`.
33 Pointer to struct :c:type:`cec_log_addrs`.
40 This documents the proposed CEC API. This API is not yet finalized
41 and is currently only available as a staging kernel module.
43 To query the current CEC logical addresses, applications call
44 :ref:`ioctl CEC_ADAP_G_LOG_ADDRS <CEC_ADAP_G_LOG_ADDRS>` with a pointer to a
45 struct :c:type:`cec_log_addrs` where the driver stores the logical addresses.
47 To set new logical addresses, applications fill in
48 struct :c:type:`cec_log_addrs` and call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`
49 with a pointer to this struct. The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`
50 is only available if ``CEC_CAP_LOG_ADDRS`` is set (the ``ENOTTY`` error code is
51 returned otherwise). The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`
52 can only be called by a file descriptor in initiator mode (see :ref:`CEC_S_MODE`), if not
53 the ``EBUSY`` error code will be returned.
55 To clear existing logical addresses set ``num_log_addrs`` to 0. All other fields
56 will be ignored in that case. The adapter will go to the unconfigured state.
58 If the physical address is valid (see :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>`),
59 then this ioctl will block until all requested logical
60 addresses have been claimed. If the file descriptor is in non-blocking mode then it will
61 not wait for the logical addresses to be claimed, instead it just returns 0.
63 A :ref:`CEC_EVENT_STATE_CHANGE <CEC-EVENT-STATE-CHANGE>` event is sent when the
64 logical addresses are claimed or cleared.
66 Attempting to call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>` when
67 logical address types are already defined will return with error ``EBUSY``.
69 .. c:type:: cec_log_addrs
71 .. tabularcolumns:: |p{1.0cm}|p{7.5cm}|p{8.0cm}|
73 .. cssclass:: longtable
75 .. flat-table:: struct cec_log_addrs
81 - ``log_addr[CEC_MAX_LOG_ADDRS]``
82 - The actual logical addresses that were claimed. This is set by the
83 driver. If no logical address could be claimed, then it is set to
84 ``CEC_LOG_ADDR_INVALID``. If this adapter is Unregistered, then
85 ``log_addr[0]`` is set to 0xf and all others to
86 ``CEC_LOG_ADDR_INVALID``.
89 - The bitmask of all logical addresses this adapter has claimed. If
90 this adapter is Unregistered then ``log_addr_mask`` sets bit 15
91 and clears all other bits. If this adapter is not configured at
92 all, then ``log_addr_mask`` is set to 0. Set by the driver.
95 - The CEC version that this adapter shall use. See
96 :ref:`cec-versions`. Used to implement the
97 ``CEC_MSG_CEC_VERSION`` and ``CEC_MSG_REPORT_FEATURES`` messages.
98 Note that :ref:`CEC_OP_CEC_VERSION_1_3A <CEC-OP-CEC-VERSION-1-3A>` is not allowed by the CEC
102 - Number of logical addresses to set up. Must be ≤
103 ``available_log_addrs`` as returned by
104 :ref:`CEC_ADAP_G_CAPS`. All arrays in
105 this structure are only filled up to index
106 ``available_log_addrs``-1. The remaining array elements will be
107 ignored. Note that the CEC 2.0 standard allows for a maximum of 2
108 logical addresses, although some hardware has support for more.
109 ``CEC_MAX_LOG_ADDRS`` is 4. The driver will return the actual
110 number of logical addresses it could claim, which may be less than
111 what was requested. If this field is set to 0, then the CEC
112 adapter shall clear all claimed logical addresses and all other
113 fields will be ignored.
116 - The vendor ID is a 24-bit number that identifies the specific
117 vendor or entity. Based on this ID vendor specific commands may be
118 defined. If you do not want a vendor ID then set it to
119 ``CEC_VENDOR_ID_NONE``.
122 - Flags. See :ref:`cec-log-addrs-flags` for a list of available flags.
125 - The On-Screen Display name as is returned by the
126 ``CEC_MSG_SET_OSD_NAME`` message.
128 - ``primary_device_type[CEC_MAX_LOG_ADDRS]``
129 - Primary device type for each logical address. See
130 :ref:`cec-prim-dev-types` for possible types.
132 - ``log_addr_type[CEC_MAX_LOG_ADDRS]``
133 - Logical address types. See :ref:`cec-log-addr-types` for
134 possible types. The driver will update this with the actual
135 logical address type that it claimed (e.g. it may have to fallback
136 to :ref:`CEC_LOG_ADDR_TYPE_UNREGISTERED <CEC-LOG-ADDR-TYPE-UNREGISTERED>`).
138 - ``all_device_types[CEC_MAX_LOG_ADDRS]``
139 - CEC 2.0 specific: the bit mask of all device types. See
140 :ref:`cec-all-dev-types-flags`. It is used in the CEC 2.0
141 ``CEC_MSG_REPORT_FEATURES`` message. For CEC 1.4 you can either leave
142 this field to 0, or fill it in according to the CEC 2.0 guidelines to
143 give the CEC framework more information about the device type, even
144 though the framework won't use it directly in the CEC message.
146 - ``features[CEC_MAX_LOG_ADDRS][12]``
147 - Features for each logical address. It is used in the CEC 2.0
148 ``CEC_MSG_REPORT_FEATURES`` message. The 12 bytes include both the
149 RC Profile and the Device Features. For CEC 1.4 you can either leave
150 this field to all 0, or fill it in according to the CEC 2.0 guidelines to
151 give the CEC framework more information about the device type, even
152 though the framework won't use it directly in the CEC message.
154 .. _cec-log-addrs-flags:
156 .. flat-table:: Flags for struct cec_log_addrs
161 * .. _`CEC-LOG-ADDRS-FL-ALLOW-UNREG-FALLBACK`:
163 - ``CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK``
165 - By default if no logical address of the requested type can be claimed, then
166 it will go back to the unconfigured state. If this flag is set, then it will
167 fallback to the Unregistered logical address. Note that if the Unregistered
168 logical address was explicitly requested, then this flag has no effect.
169 * .. _`CEC-LOG-ADDRS-FL-ALLOW-RC-PASSTHRU`:
171 - ``CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU``
173 - By default the ``CEC_MSG_USER_CONTROL_PRESSED`` and ``CEC_MSG_USER_CONTROL_RELEASED``
174 messages are only passed on to the follower(s), if any. If this flag is set,
175 then these messages are also passed on to the remote control input subsystem
176 and will appear as keystrokes. This features needs to be enabled explicitly.
177 If CEC is used to enter e.g. passwords, then you may not want to enable this
178 to avoid trivial snooping of the keystrokes.
179 * .. _`CEC-LOG-ADDRS-FL-CDC-ONLY`:
181 - `CEC_LOG_ADDRS_FL_CDC_ONLY`
183 - If this flag is set, then the device is CDC-Only. CDC-Only CEC devices
184 are CEC devices that can only handle CDC messages.
186 All other messages are ignored.
189 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|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.
215 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
217 .. _cec-prim-dev-types:
219 .. flat-table:: CEC Primary Device Types
224 * .. _`CEC-OP-PRIM-DEVTYPE-TV`:
226 - ``CEC_OP_PRIM_DEVTYPE_TV``
229 * .. _`CEC-OP-PRIM-DEVTYPE-RECORD`:
231 - ``CEC_OP_PRIM_DEVTYPE_RECORD``
233 - Use for a recording device.
234 * .. _`CEC-OP-PRIM-DEVTYPE-TUNER`:
236 - ``CEC_OP_PRIM_DEVTYPE_TUNER``
238 - Use for a device with a tuner.
239 * .. _`CEC-OP-PRIM-DEVTYPE-PLAYBACK`:
241 - ``CEC_OP_PRIM_DEVTYPE_PLAYBACK``
243 - Use for a playback device.
244 * .. _`CEC-OP-PRIM-DEVTYPE-AUDIOSYSTEM`:
246 - ``CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM``
248 - Use for an audio system (e.g. an audio/video receiver).
249 * .. _`CEC-OP-PRIM-DEVTYPE-SWITCH`:
251 - ``CEC_OP_PRIM_DEVTYPE_SWITCH``
253 - Use for a CEC switch.
254 * .. _`CEC-OP-PRIM-DEVTYPE-VIDEOPROC`:
256 - ``CEC_OP_PRIM_DEVTYPE_VIDEOPROC``
258 - Use for a video processor device.
261 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
263 .. _cec-log-addr-types:
265 .. flat-table:: CEC Logical Address Types
270 * .. _`CEC-LOG-ADDR-TYPE-TV`:
272 - ``CEC_LOG_ADDR_TYPE_TV``
275 * .. _`CEC-LOG-ADDR-TYPE-RECORD`:
277 - ``CEC_LOG_ADDR_TYPE_RECORD``
279 - Use for a recording device.
280 * .. _`CEC-LOG-ADDR-TYPE-TUNER`:
282 - ``CEC_LOG_ADDR_TYPE_TUNER``
284 - Use for a tuner device.
285 * .. _`CEC-LOG-ADDR-TYPE-PLAYBACK`:
287 - ``CEC_LOG_ADDR_TYPE_PLAYBACK``
289 - Use for a playback device.
290 * .. _`CEC-LOG-ADDR-TYPE-AUDIOSYSTEM`:
292 - ``CEC_LOG_ADDR_TYPE_AUDIOSYSTEM``
294 - Use for an audio system device.
295 * .. _`CEC-LOG-ADDR-TYPE-SPECIFIC`:
297 - ``CEC_LOG_ADDR_TYPE_SPECIFIC``
299 - Use for a second TV or for a video processor device.
300 * .. _`CEC-LOG-ADDR-TYPE-UNREGISTERED`:
302 - ``CEC_LOG_ADDR_TYPE_UNREGISTERED``
304 - Use this if you just want to remain unregistered. Used for pure
305 CEC switches or CDC-only devices (CDC: Capability Discovery and
310 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
312 .. _cec-all-dev-types-flags:
314 .. flat-table:: CEC All Device Types Flags
319 * .. _`CEC-OP-ALL-DEVTYPE-TV`:
321 - ``CEC_OP_ALL_DEVTYPE_TV``
323 - This supports the TV type.
324 * .. _`CEC-OP-ALL-DEVTYPE-RECORD`:
326 - ``CEC_OP_ALL_DEVTYPE_RECORD``
328 - This supports the Recording type.
329 * .. _`CEC-OP-ALL-DEVTYPE-TUNER`:
331 - ``CEC_OP_ALL_DEVTYPE_TUNER``
333 - This supports the Tuner type.
334 * .. _`CEC-OP-ALL-DEVTYPE-PLAYBACK`:
336 - ``CEC_OP_ALL_DEVTYPE_PLAYBACK``
338 - This supports the Playback type.
339 * .. _`CEC-OP-ALL-DEVTYPE-AUDIOSYSTEM`:
341 - ``CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM``
343 - This supports the Audio System type.
344 * .. _`CEC-OP-ALL-DEVTYPE-SWITCH`:
346 - ``CEC_OP_ALL_DEVTYPE_SWITCH``
348 - This supports the CEC Switch or Video Processing type.
355 On success 0 is returned, on error -1 and the ``errno`` variable is set
356 appropriately. The generic error codes are described at the
357 :ref:`Generic Error Codes <gen-errors>` chapter.