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

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