Name

MEDIA_IOC_ENUM_ENTITIES — Enumerate entities and their properties

Synopsis

int ioctl(int fd,
 int request,
 struct media_entity_desc *argp);
 

Arguments

fd

File descriptor returned by open().

request

MEDIA_IOC_ENUM_ENTITIES

argp

Description

To query the attributes of an entity, applications set the id field of a struct 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 one ('next entity'), or the EINVAL error code if there is none.

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.

Two or more entities that share a common non-zero group_id value are considered as logically grouped. Groups are used to report

  • ALSA, VBI and video nodes that carry the same media stream

  • lens and flash controllers associated with a sensor

Table K.2. struct media_entity_desc

__u32id  Entity id, set by the application. When the id is or'ed with MEDIA_ENT_ID_FLAG_NEXT, the driver clears the flag and returns the first entity with a larger id.
charname[32]  Entity name as an UTF-8 NULL-terminated string.
__u32type  Entity type, see Table K.3, “Media entity types” for details.
__u32revision  Entity revision in a driver/hardware specific format.
__u32flags  Entity flags, see Table K.4, “Media entity flags” for details.
__u32group_id  Entity group ID
__u16pads  Number of pads
__u16links  Total number of outbound links. Inbound links are not counted in this field.
union    
 structv4l Valid for V4L sub-devices and nodes only.
  __u32majorV4L device node major number. For V4L sub-devices with no device node, set by the driver to 0.
  __u32minorV4L device node minor number. For V4L sub-devices with no device node, set by the driver to 0.
 structfb Valid for frame buffer nodes only.
  __u32majorFrame buffer device node major number.
  __u32minorFrame buffer device node minor number.
 structalsa Valid for ALSA devices only.
  __u32cardALSA card number
  __u32deviceALSA device number
  __u32subdeviceALSA sub-device number
 intdvb DVB card number
 __u8raw[180]  

Table K.3. Media entity types

MEDIA_ENT_T_DEVNODEUnknown device node
MEDIA_ENT_T_DEVNODE_V4LV4L video, radio or vbi device node
MEDIA_ENT_T_DEVNODE_FBFrame buffer device node
MEDIA_ENT_T_DEVNODE_ALSAALSA card
MEDIA_ENT_T_DEVNODE_DVBDVB card
MEDIA_ENT_T_V4L2_SUBDEVUnknown V4L sub-device
MEDIA_ENT_T_V4L2_SUBDEV_SENSORVideo sensor
MEDIA_ENT_T_V4L2_SUBDEV_FLASHFlash controller
MEDIA_ENT_T_V4L2_SUBDEV_LENSLens controller

Table K.4. Media entity flags

MEDIA_ENT_FL_DEFAULTDefault entity for its type. Used to discover the default audio, VBI and video devices, the default camera sensor, ...

Return Value

On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.

EINVAL

The struct media_entity_desc id references a non-existing entity.