blob: ae88f46b3a9ea93e7476c3a9fd05d45d7136bfd5 [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
3.. _media-ioc-enum-entities:
4
5*****************************
6ioctl MEDIA_IOC_ENUM_ENTITIES
7*****************************
8
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -03009Name
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030010====
Markus Heiser5377d912016-06-30 15:18:56 +020011
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030012MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties
Markus Heiser5377d912016-06-30 15:18:56 +020013
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030014
15Synopsis
Markus Heiser5377d912016-06-30 15:18:56 +020016========
17
Mauro Carvalho Chehabb7e67f62016-07-02 09:49:16 -030018.. cpp:function:: int ioctl( int fd, int request, struct media_entity_desc *argp )
Markus Heiser5377d912016-06-30 15:18:56 +020019
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030020
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030021Arguments
Markus Heiser5377d912016-06-30 15:18:56 +020022=========
23
24``fd``
25 File descriptor returned by :ref:`open() <media-func-open>`.
26
27``request``
28 MEDIA_IOC_ENUM_ENTITIES
29
30``argp``
31
32
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030033Description
Markus Heiser5377d912016-06-30 15:18:56 +020034===========
35
36To query the attributes of an entity, applications set the id field of a
37struct :ref:`media_entity_desc <media-entity-desc>` structure and
38call the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this
39structure. The driver fills the rest of the structure or returns an
40EINVAL error code when the id is invalid.
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
Mauro Carvalho Chehabcdb4af02016-07-03 11:53:09 -030045one ('next entity'), or the ``EINVAL`` error code if there is none.
Markus Heiser5377d912016-06-30 15:18:56 +020046
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.. _media-entity-desc:
53
54.. flat-table:: struct media_entity_desc
55 :header-rows: 0
56 :stub-columns: 0
Mauro Carvalho Chehab2ceb5d72016-07-06 07:55:55 -030057 :widths: 1 1 1 1 8
Markus Heiser5377d912016-06-30 15:18:56 +020058
59
60 - .. row 1
61
62 - __u32
63
64 - ``id``
65
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030066 -
67 -
Markus Heiser5377d912016-06-30 15:18:56 +020068 - Entity id, set by the application. When the id is or'ed with
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030069 ``MEDIA_ENT_ID_FLAG_NEXT``, the driver clears the flag and returns
70 the first entity with a larger id.
Markus Heiser5377d912016-06-30 15:18:56 +020071
72 - .. row 2
73
74 - char
75
76 - ``name``\ [32]
77
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030078 -
79 -
Markus Heiser5377d912016-06-30 15:18:56 +020080 - Entity name as an UTF-8 NULL-terminated string.
81
82 - .. row 3
83
84 - __u32
85
86 - ``type``
87
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030088 -
89 -
Markus Heiser5377d912016-06-30 15:18:56 +020090 - Entity type, see :ref:`media-entity-type` for details.
91
92 - .. row 4
93
94 - __u32
95
96 - ``revision``
97
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030098 -
99 -
Markus Heiser5377d912016-06-30 15:18:56 +0200100 - Entity revision. Always zero (obsolete)
101
102 - .. row 5
103
104 - __u32
105
106 - ``flags``
107
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300108 -
109 -
Markus Heiser5377d912016-06-30 15:18:56 +0200110 - Entity flags, see :ref:`media-entity-flag` for details.
111
112 - .. row 6
113
114 - __u32
115
116 - ``group_id``
117
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300118 -
119 -
Markus Heiser5377d912016-06-30 15:18:56 +0200120 - Entity group ID. Always zero (obsolete)
121
122 - .. row 7
123
124 - __u16
125
126 - ``pads``
127
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300128 -
129 -
Markus Heiser5377d912016-06-30 15:18:56 +0200130 - Number of pads
131
132 - .. row 8
133
134 - __u16
135
136 - ``links``
137
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300138 -
139 -
Markus Heiser5377d912016-06-30 15:18:56 +0200140 - Total number of outbound links. Inbound links are not counted in
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300141 this field.
Markus Heiser5377d912016-06-30 15:18:56 +0200142
143 - .. row 9
144
145 - union
146
147 - .. row 10
148
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300149 -
Markus Heiser5377d912016-06-30 15:18:56 +0200150 - struct
151
152 - ``dev``
153
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300154 -
Markus Heiser5377d912016-06-30 15:18:56 +0200155 - Valid for (sub-)devices that create a single device node.
156
157 - .. row 11
158
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300159 -
160 -
Markus Heiser5377d912016-06-30 15:18:56 +0200161 - __u32
162
163 - ``major``
164
165 - Device node major number.
166
167 - .. row 12
168
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300169 -
170 -
Markus Heiser5377d912016-06-30 15:18:56 +0200171 - __u32
172
173 - ``minor``
174
175 - Device node minor number.
176
177 - .. row 13
178
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300179 -
Markus Heiser5377d912016-06-30 15:18:56 +0200180 - __u8
181
182 - ``raw``\ [184]
183
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300184 -
185 -
Markus Heiser5377d912016-06-30 15:18:56 +0200186
187
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -0300188Return Value
Markus Heiser5377d912016-06-30 15:18:56 +0200189============
190
191On success 0 is returned, on error -1 and the ``errno`` variable is set
192appropriately. The generic error codes are described at the
193:ref:`Generic Error Codes <gen-errors>` chapter.
194
195EINVAL
196 The struct :ref:`media_entity_desc <media-entity-desc>` ``id``
197 references a non-existing entity.