1<refentry id="media-ioc-enum-entities">
2  <refmeta>
3    <refentrytitle>ioctl MEDIA_IOC_ENUM_ENTITIES</refentrytitle>
4    &manvol;
5  </refmeta>
6
7  <refnamediv>
8    <refname>MEDIA_IOC_ENUM_ENTITIES</refname>
9    <refpurpose>Enumerate entities and their properties</refpurpose>
10  </refnamediv>
11
12  <refsynopsisdiv>
13    <funcsynopsis>
14      <funcprototype>
15	<funcdef>int <function>ioctl</function></funcdef>
16	<paramdef>int <parameter>fd</parameter></paramdef>
17	<paramdef>int <parameter>request</parameter></paramdef>
18	<paramdef>struct media_entity_desc *<parameter>argp</parameter></paramdef>
19      </funcprototype>
20    </funcsynopsis>
21  </refsynopsisdiv>
22
23  <refsect1>
24    <title>Arguments</title>
25
26    <variablelist>
27      <varlistentry>
28	<term><parameter>fd</parameter></term>
29	<listitem>
30	  <para>File descriptor returned by
31	  <link linkend='media-func-open'><function>open()</function></link>.</para>
32	</listitem>
33      </varlistentry>
34      <varlistentry>
35	<term><parameter>request</parameter></term>
36	<listitem>
37	  <para>MEDIA_IOC_ENUM_ENTITIES</para>
38	</listitem>
39      </varlistentry>
40      <varlistentry>
41	<term><parameter>argp</parameter></term>
42	<listitem>
43	  <para></para>
44	</listitem>
45      </varlistentry>
46    </variablelist>
47  </refsect1>
48
49  <refsect1>
50    <title>Description</title>
51    <para>To query the attributes of an entity, applications set the id field
52    of a &media-entity-desc; structure and call the MEDIA_IOC_ENUM_ENTITIES
53    ioctl with a pointer to this structure. The driver fills the rest of the
54    structure or returns an &EINVAL; when the id is invalid.</para>
55    <para>Entities can be enumerated by or'ing the id with the
56    <constant>MEDIA_ENT_ID_FLAG_NEXT</constant> flag. The driver will return
57    information about the entity with the smallest id strictly larger than the
58    requested one ('next entity'), or the &EINVAL; if there is none.</para>
59    <para>Entity IDs can be non-contiguous. Applications must
60    <emphasis>not</emphasis> try to enumerate entities by calling
61    MEDIA_IOC_ENUM_ENTITIES with increasing id's until they get an error.</para>
62    <para>Two or more entities that share a common non-zero
63    <structfield>group_id</structfield> value are considered as logically
64    grouped. Groups are used to report
65    <itemizedlist>
66      <listitem><para>ALSA, VBI and video nodes that carry the same media
67      stream</para></listitem>
68      <listitem><para>lens and flash controllers associated with a sensor</para></listitem>
69    </itemizedlist>
70    </para>
71
72    <table pgwide="1" frame="none" id="media-entity-desc">
73      <title>struct <structname>media_entity_desc</structname></title>
74      <tgroup cols="5">
75	<colspec colname="c1" />
76	<colspec colname="c2" />
77	<colspec colname="c3" />
78	<colspec colname="c4" />
79	<colspec colname="c5" />
80	<tbody valign="top">
81	  <row>
82	    <entry>__u32</entry>
83	    <entry><structfield>id</structfield></entry>
84	    <entry></entry>
85	    <entry></entry>
86	    <entry>Entity id, set by the application. When the id is or'ed with
87	    <constant>MEDIA_ENT_ID_FLAG_NEXT</constant>, the driver clears the
88	    flag and returns the first entity with a larger id.</entry>
89	  </row>
90	  <row>
91	    <entry>char</entry>
92	    <entry><structfield>name</structfield>[32]</entry>
93	    <entry></entry>
94	    <entry></entry>
95	    <entry>Entity name as an UTF-8 NULL-terminated string.</entry>
96	  </row>
97	  <row>
98	    <entry>__u32</entry>
99	    <entry><structfield>type</structfield></entry>
100	    <entry></entry>
101	    <entry></entry>
102	    <entry>Entity type, see <xref linkend="media-entity-type" /> for details.</entry>
103	  </row>
104	  <row>
105	    <entry>__u32</entry>
106	    <entry><structfield>revision</structfield></entry>
107	    <entry></entry>
108	    <entry></entry>
109	    <entry>Entity revision in a driver/hardware specific format.</entry>
110	  </row>
111	  <row>
112	    <entry>__u32</entry>
113	    <entry><structfield>flags</structfield></entry>
114	    <entry></entry>
115	    <entry></entry>
116	    <entry>Entity flags, see <xref linkend="media-entity-flag" /> for details.</entry>
117	  </row>
118	  <row>
119	    <entry>__u32</entry>
120	    <entry><structfield>group_id</structfield></entry>
121	    <entry></entry>
122	    <entry></entry>
123	    <entry>Entity group ID</entry>
124	  </row>
125	  <row>
126	    <entry>__u16</entry>
127	    <entry><structfield>pads</structfield></entry>
128	    <entry></entry>
129	    <entry></entry>
130	    <entry>Number of pads</entry>
131	  </row>
132	  <row>
133	    <entry>__u16</entry>
134	    <entry><structfield>links</structfield></entry>
135	    <entry></entry>
136	    <entry></entry>
137	    <entry>Total number of outbound links. Inbound links are not counted
138	    in this field.</entry>
139	  </row>
140	  <row>
141	    <entry>union</entry>
142	  </row>
143	  <row>
144	    <entry></entry>
145	    <entry>struct</entry>
146	    <entry><structfield>dev</structfield></entry>
147	    <entry></entry>
148	    <entry>Valid for (sub-)devices that create a single device node.</entry>
149	  </row>
150	  <row>
151	    <entry></entry>
152	    <entry></entry>
153	    <entry>__u32</entry>
154	    <entry><structfield>major</structfield></entry>
155	    <entry>Device node major number.</entry>
156	  </row>
157	  <row>
158	    <entry></entry>
159	    <entry></entry>
160	    <entry>__u32</entry>
161	    <entry><structfield>minor</structfield></entry>
162	    <entry>Device node minor number.</entry>
163	  </row>
164	  <row>
165	    <entry></entry>
166	    <entry>__u8</entry>
167	    <entry><structfield>raw</structfield>[184]</entry>
168	    <entry></entry>
169	    <entry></entry>
170	  </row>
171	</tbody>
172      </tgroup>
173    </table>
174
175    <table frame="none" pgwide="1" id="media-entity-type">
176      <title>Media entity types</title>
177      <tgroup cols="2">
178        <colspec colname="c1"/>
179        <colspec colname="c2"/>
180	<tbody valign="top">
181	  <row>
182	    <entry><constant>MEDIA_ENT_T_DEVNODE</constant></entry>
183	    <entry>Unknown device node</entry>
184	  </row>
185	  <row>
186	    <entry><constant>MEDIA_ENT_T_DEVNODE_V4L</constant></entry>
187	    <entry>V4L video, radio or vbi device node</entry>
188	  </row>
189	  <row>
190	    <entry><constant>MEDIA_ENT_T_DEVNODE_FB</constant></entry>
191	    <entry>Frame buffer device node</entry>
192	  </row>
193	  <row>
194	    <entry><constant>MEDIA_ENT_T_DEVNODE_ALSA</constant></entry>
195	    <entry>ALSA card</entry>
196	  </row>
197	  <row>
198	    <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_FE</constant></entry>
199	    <entry>DVB frontend devnode</entry>
200	  </row>
201	  <row>
202	    <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_DEMUX</constant></entry>
203	    <entry>DVB demux devnode</entry>
204	  </row>
205	  <row>
206	    <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_DVR</constant></entry>
207	    <entry>DVB DVR devnode</entry>
208	  </row>
209	  <row>
210	    <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_CA</constant></entry>
211	    <entry>DVB CAM devnode</entry>
212	  </row>
213	  <row>
214	    <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_NET</constant></entry>
215	    <entry>DVB network devnode</entry>
216	  </row>
217	  <row>
218	    <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV</constant></entry>
219	    <entry>Unknown V4L sub-device</entry>
220	  </row>
221	  <row>
222	    <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_SENSOR</constant></entry>
223	    <entry>Video sensor</entry>
224	  </row>
225	  <row>
226	    <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_FLASH</constant></entry>
227	    <entry>Flash controller</entry>
228	  </row>
229	  <row>
230	    <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_LENS</constant></entry>
231	    <entry>Lens controller</entry>
232	  </row>
233	  <row>
234	    <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_DECODER</constant></entry>
235	    <entry>Video decoder, the basic function of the video decoder is to
236	    accept analogue video from a wide variety of sources such as
237	    broadcast, DVD players, cameras and video cassette recorders, in
238	    either NTSC, PAL or HD format and still occasionally SECAM, separate
239	    it into its component parts, luminance and chrominance, and output
240	    it in some digital video standard, with appropriate embedded timing
241	    signals.</entry>
242	  </row>
243	  <row>
244	    <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_TUNER</constant></entry>
245	    <entry>TV and/or radio tuner</entry>
246	  </row>
247	</tbody>
248      </tgroup>
249    </table>
250
251    <table frame="none" pgwide="1" id="media-entity-flag">
252      <title>Media entity flags</title>
253      <tgroup cols="2">
254        <colspec colname="c1"/>
255        <colspec colname="c2"/>
256	<tbody valign="top">
257	  <row>
258	    <entry><constant>MEDIA_ENT_FL_DEFAULT</constant></entry>
259	    <entry>Default entity for its type. Used to discover the default
260	    audio, VBI and video devices, the default camera sensor, ...</entry>
261	  </row>
262	</tbody>
263      </tgroup>
264    </table>
265  </refsect1>
266
267  <refsect1>
268    &return-value;
269
270    <variablelist>
271      <varlistentry>
272	<term><errorcode>EINVAL</errorcode></term>
273	<listitem>
274	  <para>The &media-entity-desc; <structfield>id</structfield> references
275	  a non-existing entity.</para>
276	</listitem>
277      </varlistentry>
278    </variablelist>
279  </refsect1>
280</refentry>
281