media-ioc-enum-entities.rst 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: MC
  3. .. _media_ioc_enum_entities:
  4. *****************************
  5. ioctl MEDIA_IOC_ENUM_ENTITIES
  6. *****************************
  7. Name
  8. ====
  9. MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties
  10. Synopsis
  11. ========
  12. .. c:macro:: MEDIA_IOC_ENUM_ENTITIES
  13. ``int ioctl(int fd, MEDIA_IOC_ENUM_ENTITIES, struct media_entity_desc *argp)``
  14. Arguments
  15. =========
  16. ``fd``
  17. File descriptor returned by :c:func:`open()`.
  18. ``argp``
  19. Pointer to struct :c:type:`media_entity_desc`.
  20. Description
  21. ===========
  22. To query the attributes of an entity, applications set the id field of a
  23. struct :c:type:`media_entity_desc` structure and
  24. call the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this
  25. structure. The driver fills the rest of the structure or returns an
  26. EINVAL error code when the id is invalid.
  27. .. _media-ent-id-flag-next:
  28. Entities can be enumerated by or'ing the id with the
  29. ``MEDIA_ENT_ID_FLAG_NEXT`` flag. The driver will return information
  30. about the entity with the smallest id strictly larger than the requested
  31. one ('next entity'), or the ``EINVAL`` error code if there is none.
  32. Entity IDs can be non-contiguous. Applications must *not* try to
  33. enumerate entities by calling MEDIA_IOC_ENUM_ENTITIES with increasing
  34. id's until they get an error.
  35. .. c:type:: media_entity_desc
  36. .. tabularcolumns:: |p{1.5cm}|p{1.7cm}|p{1.6cm}|p{1.5cm}|p{10.6cm}|
  37. .. flat-table:: struct media_entity_desc
  38. :header-rows: 0
  39. :stub-columns: 0
  40. :widths: 2 2 1 8
  41. * - __u32
  42. - ``id``
  43. -
  44. - Entity ID, set by the application. When the ID is or'ed with
  45. ``MEDIA_ENT_ID_FLAG_NEXT``, the driver clears the flag and returns
  46. the first entity with a larger ID. Do not expect that the ID will
  47. always be the same for each instance of the device. In other words,
  48. do not hardcode entity IDs in an application.
  49. * - char
  50. - ``name``\ [32]
  51. -
  52. - Entity name as an UTF-8 NULL-terminated string. This name must be unique
  53. within the media topology.
  54. * - __u32
  55. - ``type``
  56. -
  57. - Entity type, see :ref:`media-entity-functions` for details.
  58. * - __u32
  59. - ``revision``
  60. -
  61. - Entity revision. Always zero (obsolete)
  62. * - __u32
  63. - ``flags``
  64. -
  65. - Entity flags, see :ref:`media-entity-flag` for details.
  66. * - __u32
  67. - ``group_id``
  68. -
  69. - Entity group ID. Always zero (obsolete)
  70. * - __u16
  71. - ``pads``
  72. -
  73. - Number of pads
  74. * - __u16
  75. - ``links``
  76. -
  77. - Total number of outbound links. Inbound links are not counted in
  78. this field.
  79. * - __u32
  80. - ``reserved[4]``
  81. -
  82. - Reserved for future extensions. Drivers and applications must set
  83. the array to zero.
  84. * - union {
  85. - (anonymous)
  86. * - struct
  87. - ``dev``
  88. -
  89. - Valid for (sub-)devices that create a single device node.
  90. * -
  91. - __u32
  92. - ``major``
  93. - Device node major number.
  94. * -
  95. - __u32
  96. - ``minor``
  97. - Device node minor number.
  98. * - __u8
  99. - ``raw``\ [184]
  100. -
  101. -
  102. * - }
  103. -
  104. Return Value
  105. ============
  106. On success 0 is returned, on error -1 and the ``errno`` variable is set
  107. appropriately. The generic error codes are described at the
  108. :ref:`Generic Error Codes <gen-errors>` chapter.
  109. EINVAL
  110. The struct :c:type:`media_entity_desc` ``id``
  111. references a non-existing entity.