1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
4 .. _media_ioc_enum_entities:
6 *****************************
7 ioctl MEDIA_IOC_ENUM_ENTITIES
8 *****************************
13 MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties
18 .. c:macro:: MEDIA_IOC_ENUM_ENTITIES
20 ``int ioctl(int fd, MEDIA_IOC_ENUM_ENTITIES, struct media_entity_desc *argp)``
26 File descriptor returned by :c:func:`open()`.
29 Pointer to struct :c:type:`media_entity_desc`.
34 To query the attributes of an entity, applications set the id field of a
35 struct :c:type:`media_entity_desc` structure and
36 call the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this
37 structure. The driver fills the rest of the structure or returns an
38 EINVAL error code when the id is invalid.
40 .. _media-ent-id-flag-next:
42 Entities can be enumerated by or'ing the id with the
43 ``MEDIA_ENT_ID_FLAG_NEXT`` flag. The driver will return information
44 about the entity with the smallest id strictly larger than the requested
45 one ('next entity'), or the ``EINVAL`` error code if there is none.
47 Entity IDs can be non-contiguous. Applications must *not* try to
48 enumerate entities by calling MEDIA_IOC_ENUM_ENTITIES with increasing
49 id's until they get an error.
51 .. c:type:: media_entity_desc
53 .. tabularcolumns:: |p{1.5cm}|p{1.7cm}|p{1.6cm}|p{1.5cm}|p{10.6cm}|
55 .. flat-table:: struct media_entity_desc
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.
72 - Entity name as an UTF-8 NULL-terminated string. This name must be unique
73 within the media topology.
78 - Entity type, see :ref:`media-entity-functions` for details.
83 - Entity revision. Always zero (obsolete)
88 - Entity flags, see :ref:`media-entity-flag` for details.
93 - Entity group ID. Always zero (obsolete)
103 - Total number of outbound links. Inbound links are not counted in
109 - Reserved for future extensions. Drivers and applications must set
118 - Valid for (sub-)devices that create a single device node.
123 - Device node major number.
128 - Device node minor number.
140 On success 0 is returned, on error -1 and the ``errno`` variable is set
141 appropriately. The generic error codes are described at the
142 :ref:`Generic Error Codes <gen-errors>` chapter.
145 The struct :c:type:`media_entity_desc` ``id``
146 references a non-existing entity.