media-ioc-enum-entities.rst 3.3 KB
Newer Older
1 2 3 4 5 6 7 8
.. -*- coding: utf-8; mode: rst -*-

.. _media-ioc-enum-entities:

*****************************
ioctl MEDIA_IOC_ENUM_ENTITIES
*****************************

9
Name
10
====
11

12
MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties
13

14 15

Synopsis
16 17
========

18
.. cpp:function:: int ioctl( int fd, int request, struct media_entity_desc *argp )
19

20

21
Arguments
22 23 24 25 26 27 28 29 30 31 32
=========

``fd``
    File descriptor returned by :ref:`open() <media-func-open>`.

``request``
    MEDIA_IOC_ENUM_ENTITIES

``argp``


33
Description
34 35 36 37 38 39 40 41 42 43 44
===========

To query the attributes of an entity, applications set the id field of a
struct :ref:`media_entity_desc <media-entity-desc>` structure and
call the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this
structure. The driver fills the rest of the structure or returns an
EINVAL error code when the id is invalid.

Entities can be enumerated by or'ing the id with the
``MEDIA_ENT_ID_FLAG_NEXT`` flag. The driver will return information
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.
46 47 48 49 50 51 52 53 54 55 56

Entity IDs can be non-contiguous. Applications must *not* try to
enumerate entities by calling MEDIA_IOC_ENUM_ENTITIES with increasing
id's until they get an error.


.. _media-entity-desc:

.. flat-table:: struct media_entity_desc
    :header-rows:  0
    :stub-columns: 0
57
    :widths: 1 1 1 1 8
58 59 60 61 62 63 64 65


    -  .. row 1

       -  __u32

       -  ``id``

66 67
       -
       -
68
       -  Entity id, set by the application. When the id is or'ed with
69 70
	  ``MEDIA_ENT_ID_FLAG_NEXT``, the driver clears the flag and returns
	  the first entity with a larger id.
71 72 73 74 75 76 77

    -  .. row 2

       -  char

       -  ``name``\ [32]

78 79
       -
       -
80 81 82 83 84 85 86 87
       -  Entity name as an UTF-8 NULL-terminated string.

    -  .. row 3

       -  __u32

       -  ``type``

88 89
       -
       -
90 91 92 93 94 95 96 97
       -  Entity type, see :ref:`media-entity-type` for details.

    -  .. row 4

       -  __u32

       -  ``revision``

98 99
       -
       -
100 101 102 103 104 105 106 107
       -  Entity revision. Always zero (obsolete)

    -  .. row 5

       -  __u32

       -  ``flags``

108 109
       -
       -
110 111 112 113 114 115 116 117
       -  Entity flags, see :ref:`media-entity-flag` for details.

    -  .. row 6

       -  __u32

       -  ``group_id``

118 119
       -
       -
120 121 122 123 124 125 126 127
       -  Entity group ID. Always zero (obsolete)

    -  .. row 7

       -  __u16

       -  ``pads``

128 129
       -
       -
130 131 132 133 134 135 136 137
       -  Number of pads

    -  .. row 8

       -  __u16

       -  ``links``

138 139
       -
       -
140
       -  Total number of outbound links. Inbound links are not counted in
141
	  this field.
142 143 144 145 146 147 148

    -  .. row 9

       -  union

    -  .. row 10

149
       -
150 151 152 153
       -  struct

       -  ``dev``

154
       -
155 156 157 158
       -  Valid for (sub-)devices that create a single device node.

    -  .. row 11

159 160
       -
       -
161 162 163 164 165 166 167 168
       -  __u32

       -  ``major``

       -  Device node major number.

    -  .. row 12

169 170
       -
       -
171 172 173 174 175 176 177 178
       -  __u32

       -  ``minor``

       -  Device node minor number.

    -  .. row 13

179
       -
180 181 182 183
       -  __u8

       -  ``raw``\ [184]

184 185
       -
       -
186 187


188
Return Value
189 190 191 192 193 194 195 196 197
============

On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.

EINVAL
    The struct :ref:`media_entity_desc <media-entity-desc>` ``id``
    references a non-existing entity.