cec-ioc-adap-g-log-addrs.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: CEC
  3. .. _CEC_ADAP_LOG_ADDRS:
  4. .. _CEC_ADAP_G_LOG_ADDRS:
  5. .. _CEC_ADAP_S_LOG_ADDRS:
  6. ****************************************************
  7. ioctls CEC_ADAP_G_LOG_ADDRS and CEC_ADAP_S_LOG_ADDRS
  8. ****************************************************
  9. Name
  10. ====
  11. CEC_ADAP_G_LOG_ADDRS, CEC_ADAP_S_LOG_ADDRS - Get or set the logical addresses
  12. Synopsis
  13. ========
  14. .. c:macro:: CEC_ADAP_G_LOG_ADDRS
  15. ``int ioctl(int fd, CEC_ADAP_G_LOG_ADDRS, struct cec_log_addrs *argp)``
  16. .. c:macro:: CEC_ADAP_S_LOG_ADDRS
  17. ``int ioctl(int fd, CEC_ADAP_S_LOG_ADDRS, struct cec_log_addrs *argp)``
  18. Arguments
  19. =========
  20. ``fd``
  21. File descriptor returned by :c:func:`open()`.
  22. ``argp``
  23. Pointer to struct :c:type:`cec_log_addrs`.
  24. Description
  25. ===========
  26. To query the current CEC logical addresses, applications call
  27. :ref:`ioctl CEC_ADAP_G_LOG_ADDRS <CEC_ADAP_G_LOG_ADDRS>` with a pointer to a
  28. struct :c:type:`cec_log_addrs` where the driver stores the logical addresses.
  29. To set new logical addresses, applications fill in
  30. struct :c:type:`cec_log_addrs` and call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`
  31. with a pointer to this struct. The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`
  32. is only available if ``CEC_CAP_LOG_ADDRS`` is set (the ``ENOTTY`` error code is
  33. returned otherwise). The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`
  34. can only be called by a file descriptor in initiator mode (see :ref:`CEC_S_MODE`), if not
  35. the ``EBUSY`` error code will be returned.
  36. To clear existing logical addresses set ``num_log_addrs`` to 0. All other fields
  37. will be ignored in that case. The adapter will go to the unconfigured state and the
  38. ``cec_version``, ``vendor_id`` and ``osd_name`` fields are all reset to their default
  39. values (CEC version 2.0, no vendor ID and an empty OSD name).
  40. If the physical address is valid (see :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>`),
  41. then this ioctl will block until all requested logical
  42. addresses have been claimed. If the file descriptor is in non-blocking mode then it will
  43. not wait for the logical addresses to be claimed, instead it just returns 0.
  44. A :ref:`CEC_EVENT_STATE_CHANGE <CEC-EVENT-STATE-CHANGE>` event is sent when the
  45. logical addresses are claimed or cleared.
  46. Attempting to call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>` when
  47. logical address types are already defined will return with error ``EBUSY``.
  48. .. c:type:: cec_log_addrs
  49. .. tabularcolumns:: |p{1.0cm}|p{8.0cm}|p{8.0cm}|
  50. .. cssclass:: longtable
  51. .. flat-table:: struct cec_log_addrs
  52. :header-rows: 0
  53. :stub-columns: 0
  54. :widths: 1 1 16
  55. * - __u8
  56. - ``log_addr[CEC_MAX_LOG_ADDRS]``
  57. - The actual logical addresses that were claimed. This is set by the
  58. driver. If no logical address could be claimed, then it is set to
  59. ``CEC_LOG_ADDR_INVALID``. If this adapter is Unregistered, then
  60. ``log_addr[0]`` is set to 0xf and all others to
  61. ``CEC_LOG_ADDR_INVALID``.
  62. * - __u16
  63. - ``log_addr_mask``
  64. - The bitmask of all logical addresses this adapter has claimed. If
  65. this adapter is Unregistered then ``log_addr_mask`` sets bit 15
  66. and clears all other bits. If this adapter is not configured at
  67. all, then ``log_addr_mask`` is set to 0. Set by the driver.
  68. * - __u8
  69. - ``cec_version``
  70. - The CEC version that this adapter shall use. See
  71. :ref:`cec-versions`. Used to implement the
  72. ``CEC_MSG_CEC_VERSION`` and ``CEC_MSG_REPORT_FEATURES`` messages.
  73. Note that :ref:`CEC_OP_CEC_VERSION_1_3A <CEC-OP-CEC-VERSION-1-3A>` is not allowed by the CEC
  74. framework.
  75. * - __u8
  76. - ``num_log_addrs``
  77. - Number of logical addresses to set up. Must be ≤
  78. ``available_log_addrs`` as returned by
  79. :ref:`CEC_ADAP_G_CAPS`. All arrays in
  80. this structure are only filled up to index
  81. ``available_log_addrs``-1. The remaining array elements will be
  82. ignored. Note that the CEC 2.0 standard allows for a maximum of 2
  83. logical addresses, although some hardware has support for more.
  84. ``CEC_MAX_LOG_ADDRS`` is 4. The driver will return the actual
  85. number of logical addresses it could claim, which may be less than
  86. what was requested. If this field is set to 0, then the CEC
  87. adapter shall clear all claimed logical addresses and all other
  88. fields will be ignored.
  89. * - __u32
  90. - ``vendor_id``
  91. - The vendor ID is a 24-bit number that identifies the specific
  92. vendor or entity. Based on this ID vendor specific commands may be
  93. defined. If you do not want a vendor ID then set it to
  94. ``CEC_VENDOR_ID_NONE``.
  95. * - __u32
  96. - ``flags``
  97. - Flags. See :ref:`cec-log-addrs-flags` for a list of available flags.
  98. * - char
  99. - ``osd_name[15]``
  100. - The On-Screen Display name as is returned by the
  101. ``CEC_MSG_SET_OSD_NAME`` message.
  102. * - __u8
  103. - ``primary_device_type[CEC_MAX_LOG_ADDRS]``
  104. - Primary device type for each logical address. See
  105. :ref:`cec-prim-dev-types` for possible types.
  106. * - __u8
  107. - ``log_addr_type[CEC_MAX_LOG_ADDRS]``
  108. - Logical address types. See :ref:`cec-log-addr-types` for
  109. possible types. The driver will update this with the actual
  110. logical address type that it claimed (e.g. it may have to fallback
  111. to :ref:`CEC_LOG_ADDR_TYPE_UNREGISTERED <CEC-LOG-ADDR-TYPE-UNREGISTERED>`).
  112. * - __u8
  113. - ``all_device_types[CEC_MAX_LOG_ADDRS]``
  114. - CEC 2.0 specific: the bit mask of all device types. See
  115. :ref:`cec-all-dev-types-flags`. It is used in the CEC 2.0
  116. ``CEC_MSG_REPORT_FEATURES`` message. For CEC 1.4 you can either leave
  117. this field to 0, or fill it in according to the CEC 2.0 guidelines to
  118. give the CEC framework more information about the device type, even
  119. though the framework won't use it directly in the CEC message.
  120. * - __u8
  121. - ``features[CEC_MAX_LOG_ADDRS][12]``
  122. - Features for each logical address. It is used in the CEC 2.0
  123. ``CEC_MSG_REPORT_FEATURES`` message. The 12 bytes include both the
  124. RC Profile and the Device Features. For CEC 1.4 you can either leave
  125. this field to all 0, or fill it in according to the CEC 2.0 guidelines to
  126. give the CEC framework more information about the device type, even
  127. though the framework won't use it directly in the CEC message.
  128. .. tabularcolumns:: |p{7.8cm}|p{1.0cm}|p{8.5cm}|
  129. .. _cec-log-addrs-flags:
  130. .. flat-table:: Flags for struct cec_log_addrs
  131. :header-rows: 0
  132. :stub-columns: 0
  133. :widths: 3 1 4
  134. * .. _`CEC-LOG-ADDRS-FL-ALLOW-UNREG-FALLBACK`:
  135. - ``CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK``
  136. - 1
  137. - By default if no logical address of the requested type can be claimed, then
  138. it will go back to the unconfigured state. If this flag is set, then it will
  139. fallback to the Unregistered logical address. Note that if the Unregistered
  140. logical address was explicitly requested, then this flag has no effect.
  141. * .. _`CEC-LOG-ADDRS-FL-ALLOW-RC-PASSTHRU`:
  142. - ``CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU``
  143. - 2
  144. - By default the ``CEC_MSG_USER_CONTROL_PRESSED`` and ``CEC_MSG_USER_CONTROL_RELEASED``
  145. messages are only passed on to the follower(s), if any. If this flag is set,
  146. then these messages are also passed on to the remote control input subsystem
  147. and will appear as keystrokes. This features needs to be enabled explicitly.
  148. If CEC is used to enter e.g. passwords, then you may not want to enable this
  149. to avoid trivial snooping of the keystrokes.
  150. * .. _`CEC-LOG-ADDRS-FL-CDC-ONLY`:
  151. - ``CEC_LOG_ADDRS_FL_CDC_ONLY``
  152. - 4
  153. - If this flag is set, then the device is CDC-Only. CDC-Only CEC devices
  154. are CEC devices that can only handle CDC messages.
  155. All other messages are ignored.
  156. .. tabularcolumns:: |p{7.8cm}|p{1.0cm}|p{8.5cm}|
  157. .. _cec-versions:
  158. .. flat-table:: CEC Versions
  159. :header-rows: 0
  160. :stub-columns: 0
  161. :widths: 3 1 4
  162. * .. _`CEC-OP-CEC-VERSION-1-3A`:
  163. - ``CEC_OP_CEC_VERSION_1_3A``
  164. - 4
  165. - CEC version according to the HDMI 1.3a standard.
  166. * .. _`CEC-OP-CEC-VERSION-1-4B`:
  167. - ``CEC_OP_CEC_VERSION_1_4B``
  168. - 5
  169. - CEC version according to the HDMI 1.4b standard.
  170. * .. _`CEC-OP-CEC-VERSION-2-0`:
  171. - ``CEC_OP_CEC_VERSION_2_0``
  172. - 6
  173. - CEC version according to the HDMI 2.0 standard.
  174. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|
  175. .. _cec-prim-dev-types:
  176. .. flat-table:: CEC Primary Device Types
  177. :header-rows: 0
  178. :stub-columns: 0
  179. :widths: 3 1 4
  180. * .. _`CEC-OP-PRIM-DEVTYPE-TV`:
  181. - ``CEC_OP_PRIM_DEVTYPE_TV``
  182. - 0
  183. - Use for a TV.
  184. * .. _`CEC-OP-PRIM-DEVTYPE-RECORD`:
  185. - ``CEC_OP_PRIM_DEVTYPE_RECORD``
  186. - 1
  187. - Use for a recording device.
  188. * .. _`CEC-OP-PRIM-DEVTYPE-TUNER`:
  189. - ``CEC_OP_PRIM_DEVTYPE_TUNER``
  190. - 3
  191. - Use for a device with a tuner.
  192. * .. _`CEC-OP-PRIM-DEVTYPE-PLAYBACK`:
  193. - ``CEC_OP_PRIM_DEVTYPE_PLAYBACK``
  194. - 4
  195. - Use for a playback device.
  196. * .. _`CEC-OP-PRIM-DEVTYPE-AUDIOSYSTEM`:
  197. - ``CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM``
  198. - 5
  199. - Use for an audio system (e.g. an audio/video receiver).
  200. * .. _`CEC-OP-PRIM-DEVTYPE-SWITCH`:
  201. - ``CEC_OP_PRIM_DEVTYPE_SWITCH``
  202. - 6
  203. - Use for a CEC switch.
  204. * .. _`CEC-OP-PRIM-DEVTYPE-VIDEOPROC`:
  205. - ``CEC_OP_PRIM_DEVTYPE_VIDEOPROC``
  206. - 7
  207. - Use for a video processor device.
  208. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|
  209. .. _cec-log-addr-types:
  210. .. flat-table:: CEC Logical Address Types
  211. :header-rows: 0
  212. :stub-columns: 0
  213. :widths: 3 1 16
  214. * .. _`CEC-LOG-ADDR-TYPE-TV`:
  215. - ``CEC_LOG_ADDR_TYPE_TV``
  216. - 0
  217. - Use for a TV.
  218. * .. _`CEC-LOG-ADDR-TYPE-RECORD`:
  219. - ``CEC_LOG_ADDR_TYPE_RECORD``
  220. - 1
  221. - Use for a recording device.
  222. * .. _`CEC-LOG-ADDR-TYPE-TUNER`:
  223. - ``CEC_LOG_ADDR_TYPE_TUNER``
  224. - 2
  225. - Use for a tuner device.
  226. * .. _`CEC-LOG-ADDR-TYPE-PLAYBACK`:
  227. - ``CEC_LOG_ADDR_TYPE_PLAYBACK``
  228. - 3
  229. - Use for a playback device.
  230. * .. _`CEC-LOG-ADDR-TYPE-AUDIOSYSTEM`:
  231. - ``CEC_LOG_ADDR_TYPE_AUDIOSYSTEM``
  232. - 4
  233. - Use for an audio system device.
  234. * .. _`CEC-LOG-ADDR-TYPE-SPECIFIC`:
  235. - ``CEC_LOG_ADDR_TYPE_SPECIFIC``
  236. - 5
  237. - Use for a second TV or for a video processor device.
  238. * .. _`CEC-LOG-ADDR-TYPE-UNREGISTERED`:
  239. - ``CEC_LOG_ADDR_TYPE_UNREGISTERED``
  240. - 6
  241. - Use this if you just want to remain unregistered. Used for pure
  242. CEC switches or CDC-only devices (CDC: Capability Discovery and
  243. Control).
  244. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|
  245. .. _cec-all-dev-types-flags:
  246. .. flat-table:: CEC All Device Types Flags
  247. :header-rows: 0
  248. :stub-columns: 0
  249. :widths: 3 1 4
  250. * .. _`CEC-OP-ALL-DEVTYPE-TV`:
  251. - ``CEC_OP_ALL_DEVTYPE_TV``
  252. - 0x80
  253. - This supports the TV type.
  254. * .. _`CEC-OP-ALL-DEVTYPE-RECORD`:
  255. - ``CEC_OP_ALL_DEVTYPE_RECORD``
  256. - 0x40
  257. - This supports the Recording type.
  258. * .. _`CEC-OP-ALL-DEVTYPE-TUNER`:
  259. - ``CEC_OP_ALL_DEVTYPE_TUNER``
  260. - 0x20
  261. - This supports the Tuner type.
  262. * .. _`CEC-OP-ALL-DEVTYPE-PLAYBACK`:
  263. - ``CEC_OP_ALL_DEVTYPE_PLAYBACK``
  264. - 0x10
  265. - This supports the Playback type.
  266. * .. _`CEC-OP-ALL-DEVTYPE-AUDIOSYSTEM`:
  267. - ``CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM``
  268. - 0x08
  269. - This supports the Audio System type.
  270. * .. _`CEC-OP-ALL-DEVTYPE-SWITCH`:
  271. - ``CEC_OP_ALL_DEVTYPE_SWITCH``
  272. - 0x04
  273. - This supports the CEC Switch or Video Processing type.
  274. Return Value
  275. ============
  276. On success 0 is returned, on error -1 and the ``errno`` variable is set
  277. appropriately. The generic error codes are described at the
  278. :ref:`Generic Error Codes <gen-errors>` chapter.
  279. The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>` can return the following
  280. error codes:
  281. ENOTTY
  282. The ``CEC_CAP_LOG_ADDRS`` capability wasn't set, so this ioctl is not supported.
  283. EBUSY
  284. The CEC adapter is currently configuring itself, or it is already configured and
  285. ``num_log_addrs`` is non-zero, or another filehandle is in exclusive follower or
  286. initiator mode, or the filehandle is in mode ``CEC_MODE_NO_INITIATOR``.
  287. EINVAL
  288. The contents of struct :c:type:`cec_log_addrs` is invalid.