147 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2.. c:namespace:: MC3 4.. _media_ioc_enum_entities:5 6*****************************7ioctl MEDIA_IOC_ENUM_ENTITIES8*****************************9 10Name11====12 13MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties14 15Synopsis16========17 18.. c:macro:: MEDIA_IOC_ENUM_ENTITIES19 20``int ioctl(int fd, MEDIA_IOC_ENUM_ENTITIES, struct media_entity_desc *argp)``21 22Arguments23=========24 25``fd``26 File descriptor returned by :c:func:`open()`.27 28``argp``29 Pointer to struct :c:type:`media_entity_desc`.30 31Description32===========33 34To query the attributes of an entity, applications set the id field of a35struct :c:type:`media_entity_desc` structure and36call the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this37structure. The driver fills the rest of the structure or returns an38EINVAL 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 the43``MEDIA_ENT_ID_FLAG_NEXT`` flag. The driver will return information44about the entity with the smallest id strictly larger than the requested45one ('next entity'), or the ``EINVAL`` error code if there is none.46 47Entity IDs can be non-contiguous. Applications must *not* try to48enumerate entities by calling MEDIA_IOC_ENUM_ENTITIES with increasing49id's until they get an error.50 51.. c:type:: media_entity_desc52 53.. tabularcolumns:: |p{1.5cm}|p{1.7cm}|p{1.6cm}|p{1.5cm}|p{10.6cm}|54 55.. flat-table:: struct media_entity_desc56 :header-rows: 057 :stub-columns: 058 :widths: 2 2 1 859 60 * - __u3261 - ``id``62 -63 - Entity ID, set by the application. When the ID is or'ed with64 ``MEDIA_ENT_ID_FLAG_NEXT``, the driver clears the flag and returns65 the first entity with a larger ID. Do not expect that the ID will66 always be the same for each instance of the device. In other words,67 do not hardcode entity IDs in an application.68 69 * - char70 - ``name``\ [32]71 -72 - Entity name as an UTF-8 NULL-terminated string. This name must be unique73 within the media topology.74 75 * - __u3276 - ``type``77 -78 - Entity type, see :ref:`media-entity-functions` for details.79 80 * - __u3281 - ``revision``82 -83 - Entity revision. Always zero (obsolete)84 85 * - __u3286 - ``flags``87 -88 - Entity flags, see :ref:`media-entity-flag` for details.89 90 * - __u3291 - ``group_id``92 -93 - Entity group ID. Always zero (obsolete)94 95 * - __u1696 - ``pads``97 -98 - Number of pads99 100 * - __u16101 - ``links``102 -103 - Total number of outbound links. Inbound links are not counted in104 this field.105 106 * - __u32107 - ``reserved[4]``108 -109 - Reserved for future extensions. Drivers and applications must set110 the array to zero.111 112 * - union {113 - (anonymous)114 115 * - struct116 - ``dev``117 -118 - Valid for (sub-)devices that create a single device node.119 120 * -121 - __u32122 - ``major``123 - Device node major number.124 125 * -126 - __u32127 - ``minor``128 - Device node minor number.129 130 * - __u8131 - ``raw``\ [184]132 -133 -134 * - }135 -136 137Return Value138============139 140On success 0 is returned, on error -1 and the ``errno`` variable is set141appropriately. The generic error codes are described at the142:ref:`Generic Error Codes <gen-errors>` chapter.143 144EINVAL145 The struct :c:type:`media_entity_desc` ``id``146 references a non-existing entity.147