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

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