1.. -*- coding: utf-8; mode: rst -*- 2 3.. _media_ioc_enum_entities: 4 5***************************** 6ioctl MEDIA_IOC_ENUM_ENTITIES 7***************************** 8 9Name 10==== 11 12MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties 13 14 15Synopsis 16======== 17 18.. c:function:: int ioctl( int fd, MEDIA_IOC_ENUM_ENTITIES, struct media_entity_desc *argp ) 19 :name: MEDIA_IOC_ENUM_ENTITIES 20 21 22Arguments 23========= 24 25``fd`` 26 File descriptor returned by :ref:`open() <media-func-open>`. 27 28``argp`` 29 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 52.. c:type:: media_entity_desc 53 54.. tabularcolumns:: |p{1.5cm}|p{1.7cm}|p{1.6cm}|p{1.5cm}|p{11.2cm}| 55 56.. flat-table:: struct media_entity_desc 57 :header-rows: 0 58 :stub-columns: 0 59 :widths: 1 1 1 1 8 60 61 * - __u32 62 - ``id`` 63 - 64 - 65 - Entity ID, set by the application. When the ID is or'ed with 66 ``MEDIA_ENT_ID_FLAG_NEXT``, the driver clears the flag and returns 67 the first entity with a larger ID. Do not expect that the ID will 68 always be the same for each instance of the device. In other words, 69 do not hardcode entity IDs in an application. 70 71 * - char 72 - ``name``\ [32] 73 - 74 - 75 - Entity name as an UTF-8 NULL-terminated string. This name must be unique 76 within the media topology. 77 78 * - __u32 79 - ``type`` 80 - 81 - 82 - Entity type, see :ref:`media-entity-functions` for details. 83 84 * - __u32 85 - ``revision`` 86 - 87 - 88 - Entity revision. Always zero (obsolete) 89 90 * - __u32 91 - ``flags`` 92 - 93 - 94 - Entity flags, see :ref:`media-entity-flag` for details. 95 96 * - __u32 97 - ``group_id`` 98 - 99 - 100 - Entity group ID. Always zero (obsolete) 101 102 * - __u16 103 - ``pads`` 104 - 105 - 106 - Number of pads 107 108 * - __u16 109 - ``links`` 110 - 111 - 112 - Total number of outbound links. Inbound links are not counted in 113 this field. 114 115 * - __u32 116 - ``reserved[4]`` 117 - 118 - 119 - Reserved for future extensions. Drivers and applications must set 120 the array to zero. 121 122 * - union 123 124 * - 125 - struct 126 - ``dev`` 127 - 128 - Valid for (sub-)devices that create a single device node. 129 130 * - 131 - 132 - __u32 133 - ``major`` 134 - Device node major number. 135 136 * - 137 - 138 - __u32 139 - ``minor`` 140 - Device node minor number. 141 142 * - 143 - __u8 144 - ``raw``\ [184] 145 - 146 - 147 148 149Return Value 150============ 151 152On success 0 is returned, on error -1 and the ``errno`` variable is set 153appropriately. The generic error codes are described at the 154:ref:`Generic Error Codes <gen-errors>` chapter. 155 156EINVAL 157 The struct :c:type:`media_entity_desc` ``id`` 158 references a non-existing entity. 159