^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) .. c:namespace:: MC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) .. _media_ioc_enum_entities:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *****************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) ioctl MEDIA_IOC_ENUM_ENTITIES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *****************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Synopsis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) .. c:macro:: MEDIA_IOC_ENUM_ENTITIES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ``int ioctl(int fd, MEDIA_IOC_ENUM_ENTITIES, struct media_entity_desc *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) Arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) ``fd``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) File descriptor returned by :c:func:`open()`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) ``argp``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) Pointer to struct :c:type:`media_entity_desc`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) To query the attributes of an entity, applications set the id field of a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct :c:type:`media_entity_desc` structure and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) call the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) structure. The driver fills the rest of the structure or returns an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) EINVAL error code when the id is invalid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) .. _media-ent-id-flag-next:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) Entities can be enumerated by or'ing the id with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) ``MEDIA_ENT_ID_FLAG_NEXT`` flag. The driver will return information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) about the entity with the smallest id strictly larger than the requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) one ('next entity'), or the ``EINVAL`` error code if there is none.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) Entity IDs can be non-contiguous. Applications must *not* try to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) enumerate entities by calling MEDIA_IOC_ENUM_ENTITIES with increasing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) id's until they get an error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) .. c:type:: media_entity_desc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) .. tabularcolumns:: |p{1.5cm}|p{1.7cm}|p{1.6cm}|p{1.5cm}|p{11.2cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) .. flat-table:: struct media_entity_desc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) :widths: 2 2 1 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) - ``id``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) - Entity ID, set by the application. When the ID is or'ed with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) ``MEDIA_ENT_ID_FLAG_NEXT``, the driver clears the flag and returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) the first entity with a larger ID. Do not expect that the ID will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) always be the same for each instance of the device. In other words,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) do not hardcode entity IDs in an application.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * - char
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) - ``name``\ [32]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) - Entity name as an UTF-8 NULL-terminated string. This name must be unique
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) within the media topology.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) - ``type``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) - Entity type, see :ref:`media-entity-functions` for details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) - ``revision``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) - Entity revision. Always zero (obsolete)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) - ``flags``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) - Entity flags, see :ref:`media-entity-flag` for details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) - ``group_id``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) - Entity group ID. Always zero (obsolete)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * - __u16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) - ``pads``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) - Number of pads
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * - __u16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) - ``links``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) - Total number of outbound links. Inbound links are not counted in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) this field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) - ``reserved[4]``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) - Reserved for future extensions. Drivers and applications must set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) the array to zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * - union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) - (anonymous)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * - struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) - ``dev``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) - Valid for (sub-)devices that create a single device node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) - ``major``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) - Device node major number.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) - ``minor``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) - Device node minor number.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * - __u8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) - ``raw``\ [184]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * - }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) Return Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) On success 0 is returned, on error -1 and the ``errno`` variable is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) appropriately. The generic error codes are described at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) :ref:`Generic Error Codes <gen-errors>` chapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) EINVAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) The struct :c:type:`media_entity_desc` ``id``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) references a non-existing entity.