Commit | Line | Data |
---|---|---|
e2460b1d MH |
1 | .. -*- coding: utf-8; mode: rst -*- |
2 | ||
21c62694 MH |
3 | .. _CEC_ADAP_LOG_ADDRS: |
4 | .. _CEC_ADAP_G_LOG_ADDRS: | |
5 | .. _CEC_ADAP_S_LOG_ADDRS: | |
e2460b1d | 6 | |
1267c60a HV |
7 | **************************************************** |
8 | ioctls CEC_ADAP_G_LOG_ADDRS and CEC_ADAP_S_LOG_ADDRS | |
9 | **************************************************** | |
e2460b1d | 10 | |
21c62694 MH |
11 | Name |
12 | ==== | |
e2460b1d | 13 | |
21c62694 | 14 | CEC_ADAP_G_LOG_ADDRS, CEC_ADAP_S_LOG_ADDRS - Get or set the logical addresses |
e2460b1d MH |
15 | |
16 | ||
17 | Synopsis | |
18 | ======== | |
19 | ||
99547836 MCC |
20 | .. c:function:: int ioctl( int fd, CEC_ADAP_G_LOG_ADDRS, struct cec_log_addrs *argp ) |
21 | :name: CEC_ADAP_G_LOG_ADDRS | |
21c62694 | 22 | |
99547836 MCC |
23 | .. c:function:: int ioctl( int fd, CEC_ADAP_S_LOG_ADDRS, struct cec_log_addrs *argp ) |
24 | :name: CEC_ADAP_S_LOG_ADDRS | |
e2460b1d MH |
25 | |
26 | Arguments | |
27 | ========= | |
28 | ||
29 | ``fd`` | |
99547836 | 30 | File descriptor returned by :c:func:`open() <cec-open>`. |
e2460b1d MH |
31 | |
32 | ``argp`` | |
2606eee4 | 33 | Pointer to struct :c:type:`cec_log_addrs`. |
e2460b1d MH |
34 | |
35 | Description | |
36 | =========== | |
37 | ||
b6b6e678 MCC |
38 | .. note:: |
39 | ||
40 | This documents the proposed CEC API. This API is not yet finalized | |
706f8a99 | 41 | and is currently only available as a staging kernel module. |
e2460b1d | 42 | |
1267c60a HV |
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 | |
2606eee4 | 45 | struct :c:type:`cec_log_addrs` where the driver stores the logical addresses. |
e2460b1d | 46 | |
1267c60a | 47 | To set new logical addresses, applications fill in |
2606eee4 | 48 | struct :c:type:`cec_log_addrs` and call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>` |
1267c60a | 49 | with a pointer to this struct. The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>` |
e5208ed2 HV |
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. | |
54 | ||
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. | |
57 | ||
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. | |
62 | ||
63 | A :ref:`CEC_EVENT_STATE_CHANGE <CEC-EVENT-STATE-CHANGE>` event is sent when the | |
64 | logical addresses are claimed or cleared. | |
65 | ||
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``. | |
e2460b1d | 68 | |
e8be7e97 | 69 | .. c:type:: cec_log_addrs |
e2460b1d | 70 | |
2606eee4 MCC |
71 | .. tabularcolumns:: |p{1.0cm}|p{7.5cm}|p{8.0cm}| |
72 | ||
0d6821ec | 73 | .. cssclass:: longtable |
e2460b1d MH |
74 | |
75 | .. flat-table:: struct cec_log_addrs | |
76 | :header-rows: 0 | |
77 | :stub-columns: 0 | |
b2a58436 | 78 | :widths: 1 1 16 |
e2460b1d MH |
79 | |
80 | ||
81 | - .. row 1 | |
82 | ||
83 | - __u8 | |
84 | ||
e5208ed2 | 85 | - ``log_addr[CEC_MAX_LOG_ADDRS]`` |
e2460b1d MH |
86 | |
87 | - The actual logical addresses that were claimed. This is set by the | |
706f8a99 MCC |
88 | driver. If no logical address could be claimed, then it is set to |
89 | ``CEC_LOG_ADDR_INVALID``. If this adapter is Unregistered, then | |
8968da9b | 90 | ``log_addr[0]`` is set to 0xf and all others to |
706f8a99 | 91 | ``CEC_LOG_ADDR_INVALID``. |
e2460b1d MH |
92 | |
93 | - .. row 2 | |
94 | ||
95 | - __u16 | |
96 | ||
97 | - ``log_addr_mask`` | |
98 | ||
99 | - The bitmask of all logical addresses this adapter has claimed. If | |
706f8a99 MCC |
100 | this adapter is Unregistered then ``log_addr_mask`` sets bit 15 |
101 | and clears all other bits. If this adapter is not configured at | |
102 | all, then ``log_addr_mask`` is set to 0. Set by the driver. | |
e2460b1d MH |
103 | |
104 | - .. row 3 | |
105 | ||
106 | - __u8 | |
107 | ||
108 | - ``cec_version`` | |
109 | ||
110 | - The CEC version that this adapter shall use. See | |
706f8a99 MCC |
111 | :ref:`cec-versions`. Used to implement the |
112 | ``CEC_MSG_CEC_VERSION`` and ``CEC_MSG_REPORT_FEATURES`` messages. | |
113 | Note that :ref:`CEC_OP_CEC_VERSION_1_3A <CEC-OP-CEC-VERSION-1-3A>` is not allowed by the CEC | |
114 | framework. | |
e2460b1d MH |
115 | |
116 | - .. row 4 | |
117 | ||
118 | - __u8 | |
119 | ||
120 | - ``num_log_addrs`` | |
121 | ||
122 | - Number of logical addresses to set up. Must be ≤ | |
706f8a99 MCC |
123 | ``available_log_addrs`` as returned by |
124 | :ref:`CEC_ADAP_G_CAPS`. All arrays in | |
125 | this structure are only filled up to index | |
126 | ``available_log_addrs``-1. The remaining array elements will be | |
127 | ignored. Note that the CEC 2.0 standard allows for a maximum of 2 | |
128 | logical addresses, although some hardware has support for more. | |
129 | ``CEC_MAX_LOG_ADDRS`` is 4. The driver will return the actual | |
130 | number of logical addresses it could claim, which may be less than | |
131 | what was requested. If this field is set to 0, then the CEC | |
132 | adapter shall clear all claimed logical addresses and all other | |
133 | fields will be ignored. | |
e2460b1d MH |
134 | |
135 | - .. row 5 | |
136 | ||
137 | - __u32 | |
138 | ||
139 | - ``vendor_id`` | |
140 | ||
141 | - The vendor ID is a 24-bit number that identifies the specific | |
706f8a99 MCC |
142 | vendor or entity. Based on this ID vendor specific commands may be |
143 | defined. If you do not want a vendor ID then set it to | |
144 | ``CEC_VENDOR_ID_NONE``. | |
e2460b1d MH |
145 | |
146 | - .. row 6 | |
147 | ||
148 | - __u32 | |
149 | ||
150 | - ``flags`` | |
151 | ||
dcceb1ea | 152 | - Flags. See :ref:`cec-log-addrs-flags` for a list of available flags. |
e2460b1d MH |
153 | |
154 | - .. row 7 | |
155 | ||
156 | - char | |
157 | ||
e5208ed2 | 158 | - ``osd_name[15]`` |
e2460b1d MH |
159 | |
160 | - The On-Screen Display name as is returned by the | |
706f8a99 | 161 | ``CEC_MSG_SET_OSD_NAME`` message. |
e2460b1d MH |
162 | |
163 | - .. row 8 | |
164 | ||
165 | - __u8 | |
166 | ||
e5208ed2 | 167 | - ``primary_device_type[CEC_MAX_LOG_ADDRS]`` |
e2460b1d MH |
168 | |
169 | - Primary device type for each logical address. See | |
706f8a99 | 170 | :ref:`cec-prim-dev-types` for possible types. |
e2460b1d MH |
171 | |
172 | - .. row 9 | |
173 | ||
174 | - __u8 | |
175 | ||
e5208ed2 | 176 | - ``log_addr_type[CEC_MAX_LOG_ADDRS]`` |
e2460b1d MH |
177 | |
178 | - Logical address types. See :ref:`cec-log-addr-types` for | |
706f8a99 MCC |
179 | possible types. The driver will update this with the actual |
180 | logical address type that it claimed (e.g. it may have to fallback | |
181 | to :ref:`CEC_LOG_ADDR_TYPE_UNREGISTERED <CEC-LOG-ADDR-TYPE-UNREGISTERED>`). | |
e2460b1d MH |
182 | |
183 | - .. row 10 | |
184 | ||
185 | - __u8 | |
186 | ||
e5208ed2 | 187 | - ``all_device_types[CEC_MAX_LOG_ADDRS]`` |
e2460b1d | 188 | |
e5208ed2 HV |
189 | - CEC 2.0 specific: the bit mask of all device types. See |
190 | :ref:`cec-all-dev-types-flags`. It is used in the CEC 2.0 | |
191 | ``CEC_MSG_REPORT_FEATURES`` message. For CEC 1.4 you can either leave | |
192 | this field to 0, or fill it in according to the CEC 2.0 guidelines to | |
193 | give the CEC framework more information about the device type, even | |
194 | though the framework won't use it directly in the CEC message. | |
e2460b1d MH |
195 | |
196 | - .. row 11 | |
197 | ||
198 | - __u8 | |
199 | ||
e5208ed2 | 200 | - ``features[CEC_MAX_LOG_ADDRS][12]`` |
e2460b1d | 201 | |
e5208ed2 | 202 | - Features for each logical address. It is used in the CEC 2.0 |
706f8a99 | 203 | ``CEC_MSG_REPORT_FEATURES`` message. The 12 bytes include both the |
e5208ed2 HV |
204 | RC Profile and the Device Features. For CEC 1.4 you can either leave |
205 | this field to all 0, or fill it in according to the CEC 2.0 guidelines to | |
206 | give the CEC framework more information about the device type, even | |
207 | though the framework won't use it directly in the CEC message. | |
e2460b1d | 208 | |
dcceb1ea HV |
209 | .. _cec-log-addrs-flags: |
210 | ||
211 | .. flat-table:: Flags for struct cec_log_addrs | |
212 | :header-rows: 0 | |
213 | :stub-columns: 0 | |
214 | :widths: 3 1 4 | |
215 | ||
216 | ||
217 | - .. _`CEC-LOG-ADDRS-FL-ALLOW-UNREG-FALLBACK`: | |
218 | ||
219 | - ``CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK`` | |
220 | ||
221 | - 1 | |
222 | ||
223 | - By default if no logical address of the requested type can be claimed, then | |
224 | it will go back to the unconfigured state. If this flag is set, then it will | |
225 | fallback to the Unregistered logical address. Note that if the Unregistered | |
226 | logical address was explicitly requested, then this flag has no effect. | |
227 | ||
5bd4bb78 MCC |
228 | .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| |
229 | ||
e2460b1d MH |
230 | .. _cec-versions: |
231 | ||
232 | .. flat-table:: CEC Versions | |
233 | :header-rows: 0 | |
234 | :stub-columns: 0 | |
235 | :widths: 3 1 4 | |
236 | ||
237 | ||
96f69e0e | 238 | - .. _`CEC-OP-CEC-VERSION-1-3A`: |
e2460b1d MH |
239 | |
240 | - ``CEC_OP_CEC_VERSION_1_3A`` | |
241 | ||
242 | - 4 | |
243 | ||
244 | - CEC version according to the HDMI 1.3a standard. | |
245 | ||
96f69e0e | 246 | - .. _`CEC-OP-CEC-VERSION-1-4B`: |
e2460b1d MH |
247 | |
248 | - ``CEC_OP_CEC_VERSION_1_4B`` | |
249 | ||
250 | - 5 | |
251 | ||
252 | - CEC version according to the HDMI 1.4b standard. | |
253 | ||
96f69e0e | 254 | - .. _`CEC-OP-CEC-VERSION-2-0`: |
e2460b1d MH |
255 | |
256 | - ``CEC_OP_CEC_VERSION_2_0`` | |
257 | ||
258 | - 6 | |
259 | ||
260 | - CEC version according to the HDMI 2.0 standard. | |
261 | ||
262 | ||
fa92b04d | 263 | .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| |
e2460b1d MH |
264 | |
265 | .. _cec-prim-dev-types: | |
266 | ||
267 | .. flat-table:: CEC Primary Device Types | |
268 | :header-rows: 0 | |
269 | :stub-columns: 0 | |
270 | :widths: 3 1 4 | |
271 | ||
272 | ||
96f69e0e | 273 | - .. _`CEC-OP-PRIM-DEVTYPE-TV`: |
e2460b1d MH |
274 | |
275 | - ``CEC_OP_PRIM_DEVTYPE_TV`` | |
276 | ||
277 | - 0 | |
278 | ||
279 | - Use for a TV. | |
280 | ||
96f69e0e | 281 | - .. _`CEC-OP-PRIM-DEVTYPE-RECORD`: |
e2460b1d MH |
282 | |
283 | - ``CEC_OP_PRIM_DEVTYPE_RECORD`` | |
284 | ||
285 | - 1 | |
286 | ||
287 | - Use for a recording device. | |
288 | ||
96f69e0e | 289 | - .. _`CEC-OP-PRIM-DEVTYPE-TUNER`: |
e2460b1d MH |
290 | |
291 | - ``CEC_OP_PRIM_DEVTYPE_TUNER`` | |
292 | ||
293 | - 3 | |
294 | ||
295 | - Use for a device with a tuner. | |
296 | ||
96f69e0e | 297 | - .. _`CEC-OP-PRIM-DEVTYPE-PLAYBACK`: |
e2460b1d MH |
298 | |
299 | - ``CEC_OP_PRIM_DEVTYPE_PLAYBACK`` | |
300 | ||
301 | - 4 | |
302 | ||
303 | - Use for a playback device. | |
304 | ||
96f69e0e | 305 | - .. _`CEC-OP-PRIM-DEVTYPE-AUDIOSYSTEM`: |
e2460b1d MH |
306 | |
307 | - ``CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM`` | |
308 | ||
309 | - 5 | |
310 | ||
311 | - Use for an audio system (e.g. an audio/video receiver). | |
312 | ||
96f69e0e | 313 | - .. _`CEC-OP-PRIM-DEVTYPE-SWITCH`: |
e2460b1d MH |
314 | |
315 | - ``CEC_OP_PRIM_DEVTYPE_SWITCH`` | |
316 | ||
317 | - 6 | |
318 | ||
319 | - Use for a CEC switch. | |
320 | ||
96f69e0e | 321 | - .. _`CEC-OP-PRIM-DEVTYPE-VIDEOPROC`: |
e2460b1d MH |
322 | |
323 | - ``CEC_OP_PRIM_DEVTYPE_VIDEOPROC`` | |
324 | ||
325 | - 7 | |
326 | ||
327 | - Use for a video processor device. | |
328 | ||
329 | ||
fa92b04d | 330 | .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| |
e2460b1d MH |
331 | |
332 | .. _cec-log-addr-types: | |
333 | ||
334 | .. flat-table:: CEC Logical Address Types | |
335 | :header-rows: 0 | |
336 | :stub-columns: 0 | |
b2a58436 | 337 | :widths: 3 1 16 |
e2460b1d MH |
338 | |
339 | ||
96f69e0e | 340 | - .. _`CEC-LOG-ADDR-TYPE-TV`: |
e2460b1d MH |
341 | |
342 | - ``CEC_LOG_ADDR_TYPE_TV`` | |
343 | ||
344 | - 0 | |
345 | ||
346 | - Use for a TV. | |
347 | ||
96f69e0e | 348 | - .. _`CEC-LOG-ADDR-TYPE-RECORD`: |
e2460b1d MH |
349 | |
350 | - ``CEC_LOG_ADDR_TYPE_RECORD`` | |
351 | ||
352 | - 1 | |
353 | ||
354 | - Use for a recording device. | |
355 | ||
96f69e0e | 356 | - .. _`CEC-LOG-ADDR-TYPE-TUNER`: |
e2460b1d MH |
357 | |
358 | - ``CEC_LOG_ADDR_TYPE_TUNER`` | |
359 | ||
360 | - 2 | |
361 | ||
362 | - Use for a tuner device. | |
363 | ||
96f69e0e | 364 | - .. _`CEC-LOG-ADDR-TYPE-PLAYBACK`: |
e2460b1d MH |
365 | |
366 | - ``CEC_LOG_ADDR_TYPE_PLAYBACK`` | |
367 | ||
368 | - 3 | |
369 | ||
370 | - Use for a playback device. | |
371 | ||
96f69e0e | 372 | - .. _`CEC-LOG-ADDR-TYPE-AUDIOSYSTEM`: |
e2460b1d MH |
373 | |
374 | - ``CEC_LOG_ADDR_TYPE_AUDIOSYSTEM`` | |
375 | ||
376 | - 4 | |
377 | ||
378 | - Use for an audio system device. | |
379 | ||
96f69e0e | 380 | - .. _`CEC-LOG-ADDR-TYPE-SPECIFIC`: |
e2460b1d MH |
381 | |
382 | - ``CEC_LOG_ADDR_TYPE_SPECIFIC`` | |
383 | ||
384 | - 5 | |
385 | ||
386 | - Use for a second TV or for a video processor device. | |
387 | ||
96f69e0e | 388 | - .. _`CEC-LOG-ADDR-TYPE-UNREGISTERED`: |
e2460b1d MH |
389 | |
390 | - ``CEC_LOG_ADDR_TYPE_UNREGISTERED`` | |
391 | ||
392 | - 6 | |
393 | ||
394 | - Use this if you just want to remain unregistered. Used for pure | |
706f8a99 MCC |
395 | CEC switches or CDC-only devices (CDC: Capability Discovery and |
396 | Control). | |
e2460b1d MH |
397 | |
398 | ||
399 | ||
5bd4bb78 MCC |
400 | .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| |
401 | ||
e2460b1d MH |
402 | .. _cec-all-dev-types-flags: |
403 | ||
404 | .. flat-table:: CEC All Device Types Flags | |
405 | :header-rows: 0 | |
406 | :stub-columns: 0 | |
407 | :widths: 3 1 4 | |
408 | ||
409 | ||
96f69e0e | 410 | - .. _`CEC-OP-ALL-DEVTYPE-TV`: |
e2460b1d MH |
411 | |
412 | - ``CEC_OP_ALL_DEVTYPE_TV`` | |
413 | ||
414 | - 0x80 | |
415 | ||
416 | - This supports the TV type. | |
417 | ||
96f69e0e | 418 | - .. _`CEC-OP-ALL-DEVTYPE-RECORD`: |
e2460b1d MH |
419 | |
420 | - ``CEC_OP_ALL_DEVTYPE_RECORD`` | |
421 | ||
422 | - 0x40 | |
423 | ||
424 | - This supports the Recording type. | |
425 | ||
96f69e0e | 426 | - .. _`CEC-OP-ALL-DEVTYPE-TUNER`: |
e2460b1d MH |
427 | |
428 | - ``CEC_OP_ALL_DEVTYPE_TUNER`` | |
429 | ||
430 | - 0x20 | |
431 | ||
432 | - This supports the Tuner type. | |
433 | ||
96f69e0e | 434 | - .. _`CEC-OP-ALL-DEVTYPE-PLAYBACK`: |
e2460b1d MH |
435 | |
436 | - ``CEC_OP_ALL_DEVTYPE_PLAYBACK`` | |
437 | ||
438 | - 0x10 | |
439 | ||
440 | - This supports the Playback type. | |
441 | ||
96f69e0e | 442 | - .. _`CEC-OP-ALL-DEVTYPE-AUDIOSYSTEM`: |
e2460b1d MH |
443 | |
444 | - ``CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM`` | |
445 | ||
446 | - 0x08 | |
447 | ||
448 | - This supports the Audio System type. | |
449 | ||
96f69e0e | 450 | - .. _`CEC-OP-ALL-DEVTYPE-SWITCH`: |
e2460b1d MH |
451 | |
452 | - ``CEC_OP_ALL_DEVTYPE_SWITCH`` | |
453 | ||
454 | - 0x04 | |
455 | ||
456 | - This supports the CEC Switch or Video Processing type. | |
457 | ||
458 | ||
459 | ||
460 | Return Value | |
461 | ============ | |
462 | ||
463 | On success 0 is returned, on error -1 and the ``errno`` variable is set | |
464 | appropriately. The generic error codes are described at the | |
465 | :ref:`Generic Error Codes <gen-errors>` chapter. | |
466 |