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

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