• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. -*- coding: utf-8; mode: rst -*-
2
3.. _media_ioc_enum_entities:
4
5*****************************
6ioctl MEDIA_IOC_ENUM_ENTITIES
7*****************************
8
9Name
10====
11
12MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties
13
14
15Synopsis
16========
17
18.. c:function:: int ioctl( int fd, MEDIA_IOC_ENUM_ENTITIES, struct media_entity_desc *argp )
19    :name: MEDIA_IOC_ENUM_ENTITIES
20
21
22Arguments
23=========
24
25``fd``
26    File descriptor returned by :ref:`open() <media-func-open>`.
27
28``argp``
29
30
31Description
32===========
33
34To query the attributes of an entity, applications set the id field of a
35struct :c:type:`media_entity_desc` structure and
36call the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this
37structure. The driver fills the rest of the structure or returns an
38EINVAL error code when the id is invalid.
39
40.. _media-ent-id-flag-next:
41
42Entities can be enumerated by or'ing the id with the
43``MEDIA_ENT_ID_FLAG_NEXT`` flag. The driver will return information
44about the entity with the smallest id strictly larger than the requested
45one ('next entity'), or the ``EINVAL`` error code if there is none.
46
47Entity IDs can be non-contiguous. Applications must *not* try to
48enumerate entities by calling MEDIA_IOC_ENUM_ENTITIES with increasing
49id's until they get an error.
50
51
52.. c:type:: media_entity_desc
53
54.. tabularcolumns:: |p{1.5cm}|p{1.7cm}|p{1.6cm}|p{1.5cm}|p{11.2cm}|
55
56.. flat-table:: struct media_entity_desc
57    :header-rows:  0
58    :stub-columns: 0
59    :widths: 1 1 1 1 8
60
61
62    -  .. row 1
63
64       -  __u32
65
66       -  ``id``
67
68       -
69       -
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.
73
74    -  .. row 2
75
76       -  char
77
78       -  ``name``\ [32]
79
80       -
81       -
82       -  Entity name as an UTF-8 NULL-terminated string.
83
84    -  .. row 3
85
86       -  __u32
87
88       -  ``type``
89
90       -
91       -
92       -  Entity type, see :ref:`media-entity-type` for details.
93
94    -  .. row 4
95
96       -  __u32
97
98       -  ``revision``
99
100       -
101       -
102       -  Entity revision. Always zero (obsolete)
103
104    -  .. row 5
105
106       -  __u32
107
108       -  ``flags``
109
110       -
111       -
112       -  Entity flags, see :ref:`media-entity-flag` for details.
113
114    -  .. row 6
115
116       -  __u32
117
118       -  ``group_id``
119
120       -
121       -
122       -  Entity group ID. Always zero (obsolete)
123
124    -  .. row 7
125
126       -  __u16
127
128       -  ``pads``
129
130       -
131       -
132       -  Number of pads
133
134    -  .. row 8
135
136       -  __u16
137
138       -  ``links``
139
140       -
141       -
142       -  Total number of outbound links. Inbound links are not counted in
143	  this field.
144
145    -  .. row 9
146
147       -  union
148
149    -  .. row 10
150
151       -
152       -  struct
153
154       -  ``dev``
155
156       -
157       -  Valid for (sub-)devices that create a single device node.
158
159    -  .. row 11
160
161       -
162       -
163       -  __u32
164
165       -  ``major``
166
167       -  Device node major number.
168
169    -  .. row 12
170
171       -
172       -
173       -  __u32
174
175       -  ``minor``
176
177       -  Device node minor number.
178
179    -  .. row 13
180
181       -
182       -  __u8
183
184       -  ``raw``\ [184]
185
186       -
187       -
188
189
190Return Value
191============
192
193On success 0 is returned, on error -1 and the ``errno`` variable is set
194appropriately. The generic error codes are described at the
195:ref:`Generic Error Codes <gen-errors>` chapter.
196
197EINVAL
198    The struct :c:type:`media_entity_desc` ``id``
199    references a non-existing entity.
200