media-ioc-enum-entities.rst 3.5 KB
Newer Older
1
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
.. c:namespace:: MC
3

4
.. _media_ioc_enum_entities:
5 6 7 8 9

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

10
Name
11
====
12

13
MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties
14

15
Synopsis
16 17
========

18
.. c:macro:: MEDIA_IOC_ENUM_ENTITIES
19

20
``int ioctl(int fd, MEDIA_IOC_ENUM_ENTITIES, struct media_entity_desc *argp)``
21

22
Arguments
23 24 25
=========

``fd``
26
    File descriptor returned by :c:func:`open()`.
27 28

``argp``
29
    Pointer to struct :c:type:`media_entity_desc`.
30

31
Description
32 33 34
===========

To query the attributes of an entity, applications set the id field of a
35
struct :c:type:`media_entity_desc` structure and
36 37 38 39
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.

40 41
.. _media-ent-id-flag-next:

42 43 44
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

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.

51
.. c:type:: media_entity_desc
52

53
.. tabularcolumns:: |p{1.5cm}|p{1.7cm}|p{1.6cm}|p{1.5cm}|p{10.6cm}|
54

55 56 57
.. flat-table:: struct media_entity_desc
    :header-rows:  0
    :stub-columns: 0
58
    :widths: 2 2 1 8
59

60
    *  -  __u32
61
       -  ``id``
62
       -
63
       -  Entity ID, set by the application. When the ID is or'ed with
64
	  ``MEDIA_ENT_ID_FLAG_NEXT``, the driver clears the flag and returns
65 66 67
	  the first entity with a larger ID. Do not expect that the ID will
	  always be the same for each instance of the device. In other words,
	  do not hardcode entity IDs in an application.
68

69
    *  -  char
70
       -  ``name``\ [32]
71
       -
72 73
       -  Entity name as an UTF-8 NULL-terminated string. This name must be unique
          within the media topology.
74

75
    *  -  __u32
76
       -  ``type``
77
       -
78
       -  Entity type, see :ref:`media-entity-functions` for details.
79

80
    *  -  __u32
81
       -  ``revision``
82
       -
83 84
       -  Entity revision. Always zero (obsolete)

85
    *  -  __u32
86
       -  ``flags``
87
       -
88 89
       -  Entity flags, see :ref:`media-entity-flag` for details.

90
    *  -  __u32
91
       -  ``group_id``
92
       -
93 94
       -  Entity group ID. Always zero (obsolete)

95
    *  -  __u16
96
       -  ``pads``
97
       -
98 99
       -  Number of pads

100
    *  -  __u16
101
       -  ``links``
102
       -
103
       -  Total number of outbound links. Inbound links are not counted in
104
	  this field.
105

106
    *  -  __u32
107 108 109 110
       -  ``reserved[4]``
       -
       -  Reserved for future extensions. Drivers and applications must set
          the array to zero.
111

112 113
    *  -  union {
       -  (anonymous)
114

115
    *  -  struct
116
       -  ``dev``
117
       -
118 119
       -  Valid for (sub-)devices that create a single device node.

120
    *  -
121 122 123 124
       -  __u32
       -  ``major``
       -  Device node major number.

125
    *  -
126 127 128 129
       -  __u32
       -  ``minor``
       -  Device node minor number.

130
    *  -  __u8
131
       -  ``raw``\ [184]
132 133
       -
       -
134 135
    *  - }
       -
136

137
Return Value
138 139 140 141 142 143 144
============

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
145
    The struct :c:type:`media_entity_desc` ``id``
146
    references a non-existing entity.