1 .. -*- coding: utf-8; mode: rst -*-
3 .. _media_ioc_enum_entities:
5 *****************************
6 ioctl MEDIA_IOC_ENUM_ENTITIES
7 *****************************
12 MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties
18 .. cpp:function:: int ioctl( int fd, int request, struct media_entity_desc *argp )
25 File descriptor returned by :ref:`open() <media-func-open>`.
28 MEDIA_IOC_ENUM_ENTITIES
36 To query the attributes of an entity, applications set the id field of a
37 struct :ref:`media_entity_desc <media-entity-desc>` structure and
38 call the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this
39 structure. The driver fills the rest of the structure or returns an
40 EINVAL error code when the id is invalid.
42 .. _media-ent-id-flag-next:
44 Entities can be enumerated by or'ing the id with the
45 ``MEDIA_ENT_ID_FLAG_NEXT`` flag. The driver will return information
46 about the entity with the smallest id strictly larger than the requested
47 one ('next entity'), or the ``EINVAL`` error code if there is none.
49 Entity IDs can be non-contiguous. Applications must *not* try to
50 enumerate entities by calling MEDIA_IOC_ENUM_ENTITIES with increasing
51 id's until they get an error.
54 .. _media-entity-desc:
56 .. flat-table:: struct media_entity_desc
70 - Entity id, set by the application. When the id is or'ed with
71 ``MEDIA_ENT_ID_FLAG_NEXT``, the driver clears the flag and returns
72 the first entity with a larger id.
82 - Entity name as an UTF-8 NULL-terminated string.
92 - Entity type, see :ref:`media-entity-type` for details.
102 - Entity revision. Always zero (obsolete)
112 - Entity flags, see :ref:`media-entity-flag` for details.
122 - Entity group ID. Always zero (obsolete)
142 - Total number of outbound links. Inbound links are not counted in
157 - Valid for (sub-)devices that create a single device node.
167 - Device node major number.
177 - Device node minor number.
193 On success 0 is returned, on error -1 and the ``errno`` variable is set
194 appropriately. The generic error codes are described at the
195 :ref:`Generic Error Codes <gen-errors>` chapter.
198 The struct :ref:`media_entity_desc <media-entity-desc>` ``id``
199 references a non-existing entity.