18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci.. c:namespace:: MC 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci.. _media_ioc_enum_entities: 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci***************************** 78c2ecf20Sopenharmony_ciioctl MEDIA_IOC_ENUM_ENTITIES 88c2ecf20Sopenharmony_ci***************************** 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciName 118c2ecf20Sopenharmony_ci==== 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciMEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciSynopsis 168c2ecf20Sopenharmony_ci======== 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci.. c:macro:: MEDIA_IOC_ENUM_ENTITIES 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci``int ioctl(int fd, MEDIA_IOC_ENUM_ENTITIES, struct media_entity_desc *argp)`` 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciArguments 238c2ecf20Sopenharmony_ci========= 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci``fd`` 268c2ecf20Sopenharmony_ci File descriptor returned by :c:func:`open()`. 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci``argp`` 298c2ecf20Sopenharmony_ci Pointer to struct :c:type:`media_entity_desc`. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciDescription 328c2ecf20Sopenharmony_ci=========== 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciTo query the attributes of an entity, applications set the id field of a 358c2ecf20Sopenharmony_cistruct :c:type:`media_entity_desc` structure and 368c2ecf20Sopenharmony_cicall the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this 378c2ecf20Sopenharmony_cistructure. The driver fills the rest of the structure or returns an 388c2ecf20Sopenharmony_ciEINVAL error code when the id is invalid. 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci.. _media-ent-id-flag-next: 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciEntities can be enumerated by or'ing the id with the 438c2ecf20Sopenharmony_ci``MEDIA_ENT_ID_FLAG_NEXT`` flag. The driver will return information 448c2ecf20Sopenharmony_ciabout the entity with the smallest id strictly larger than the requested 458c2ecf20Sopenharmony_cione ('next entity'), or the ``EINVAL`` error code if there is none. 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciEntity IDs can be non-contiguous. Applications must *not* try to 488c2ecf20Sopenharmony_cienumerate entities by calling MEDIA_IOC_ENUM_ENTITIES with increasing 498c2ecf20Sopenharmony_ciid's until they get an error. 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci.. c:type:: media_entity_desc 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{1.5cm}|p{1.7cm}|p{1.6cm}|p{1.5cm}|p{11.2cm}| 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci.. flat-table:: struct media_entity_desc 568c2ecf20Sopenharmony_ci :header-rows: 0 578c2ecf20Sopenharmony_ci :stub-columns: 0 588c2ecf20Sopenharmony_ci :widths: 2 2 1 8 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci * - __u32 618c2ecf20Sopenharmony_ci - ``id`` 628c2ecf20Sopenharmony_ci - 638c2ecf20Sopenharmony_ci - Entity ID, set by the application. When the ID is or'ed with 648c2ecf20Sopenharmony_ci ``MEDIA_ENT_ID_FLAG_NEXT``, the driver clears the flag and returns 658c2ecf20Sopenharmony_ci the first entity with a larger ID. Do not expect that the ID will 668c2ecf20Sopenharmony_ci always be the same for each instance of the device. In other words, 678c2ecf20Sopenharmony_ci do not hardcode entity IDs in an application. 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci * - char 708c2ecf20Sopenharmony_ci - ``name``\ [32] 718c2ecf20Sopenharmony_ci - 728c2ecf20Sopenharmony_ci - Entity name as an UTF-8 NULL-terminated string. This name must be unique 738c2ecf20Sopenharmony_ci within the media topology. 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci * - __u32 768c2ecf20Sopenharmony_ci - ``type`` 778c2ecf20Sopenharmony_ci - 788c2ecf20Sopenharmony_ci - Entity type, see :ref:`media-entity-functions` for details. 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci * - __u32 818c2ecf20Sopenharmony_ci - ``revision`` 828c2ecf20Sopenharmony_ci - 838c2ecf20Sopenharmony_ci - Entity revision. Always zero (obsolete) 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci * - __u32 868c2ecf20Sopenharmony_ci - ``flags`` 878c2ecf20Sopenharmony_ci - 888c2ecf20Sopenharmony_ci - Entity flags, see :ref:`media-entity-flag` for details. 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci * - __u32 918c2ecf20Sopenharmony_ci - ``group_id`` 928c2ecf20Sopenharmony_ci - 938c2ecf20Sopenharmony_ci - Entity group ID. Always zero (obsolete) 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci * - __u16 968c2ecf20Sopenharmony_ci - ``pads`` 978c2ecf20Sopenharmony_ci - 988c2ecf20Sopenharmony_ci - Number of pads 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci * - __u16 1018c2ecf20Sopenharmony_ci - ``links`` 1028c2ecf20Sopenharmony_ci - 1038c2ecf20Sopenharmony_ci - Total number of outbound links. Inbound links are not counted in 1048c2ecf20Sopenharmony_ci this field. 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci * - __u32 1078c2ecf20Sopenharmony_ci - ``reserved[4]`` 1088c2ecf20Sopenharmony_ci - 1098c2ecf20Sopenharmony_ci - Reserved for future extensions. Drivers and applications must set 1108c2ecf20Sopenharmony_ci the array to zero. 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci * - union { 1138c2ecf20Sopenharmony_ci - (anonymous) 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci * - struct 1168c2ecf20Sopenharmony_ci - ``dev`` 1178c2ecf20Sopenharmony_ci - 1188c2ecf20Sopenharmony_ci - Valid for (sub-)devices that create a single device node. 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci * - 1218c2ecf20Sopenharmony_ci - __u32 1228c2ecf20Sopenharmony_ci - ``major`` 1238c2ecf20Sopenharmony_ci - Device node major number. 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci * - 1268c2ecf20Sopenharmony_ci - __u32 1278c2ecf20Sopenharmony_ci - ``minor`` 1288c2ecf20Sopenharmony_ci - Device node minor number. 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci * - __u8 1318c2ecf20Sopenharmony_ci - ``raw``\ [184] 1328c2ecf20Sopenharmony_ci - 1338c2ecf20Sopenharmony_ci - 1348c2ecf20Sopenharmony_ci * - } 1358c2ecf20Sopenharmony_ci - 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ciReturn Value 1388c2ecf20Sopenharmony_ci============ 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 1418c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the 1428c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ciEINVAL 1458c2ecf20Sopenharmony_ci The struct :c:type:`media_entity_desc` ``id`` 1468c2ecf20Sopenharmony_ci references a non-existing entity. 147