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