STRUCT VIDEO_DEVICE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ struct video_device(9) πŸŽ€

okay bestie, welcome to the Kernel API Manual ✨ β€” this is the page for struct video_device, which is, and I cannot stress this enough, the actual structure used to create and manage the V4L2 device nodes. main character energy fr πŸ’…


🌸 NAME 🌸

struct video_device β€” Structure used to create and manage the V4L2 device nodes. that's it, that's the vibe 🫢


✨ SYNOPSIS ✨

lowkey just look at it:

struct video_device {
  #if defined(CONFIG_MEDIA_CONTROLLER);
    struct media_entity entity;
    struct media_intf_devnode *intf_devnode;
    struct media_pipeline pipe;
  #endif;
    const struct v4l2_file_operations *fops;
    u32 device_caps;
    struct device dev;
    struct cdev *cdev;
    struct v4l2_device *v4l2_dev;
    struct device *dev_parent;
    struct v4l2_ctrl_handler *ctrl_handler;
    struct vb2_queue *queue;
    struct v4l2_prio_state *prio;
    char name[64];
    enum vfl_devnode_type vfl_type;
    enum vfl_devnode_direction vfl_dir;
    int minor;
    u16 num;
    unsigned long flags;
    int index;
    spinlock_t fh_lock;
    struct list_head        fh_list;
    int dev_debug;
    v4l2_std_id tvnorms;
    void (*release)(struct video_device *vdev);
    const struct v4l2_ioctl_ops *ioctl_ops;
    unsigned long valid_ioctls[BITS_TO_LONGS( BASE_VIDIOC_PRIVATE)];
    struct mutex *lock;
 };

πŸ’… Members πŸ’…

every single field, no skips, we do not skip fields in this house πŸ’–

  • entity β€” struct media_entity πŸ‘‘
  • intf_devnode β€” pointer to struct media_intf_devnode
  • pipe β€” struct media_pipeline
  • fops β€” pointer to struct v4l2_file_operations for the video device
  • device_caps β€” device capabilities as used in v4l2_capabilities
  • dev β€” struct device for the video device
  • cdev β€” character device
  • v4l2_dev β€” pointer to struct v4l2_device parent
  • dev_parent β€” pointer to struct device parent
  • ctrl_handler β€” Control handler associated with this device node. May be NULL.
  • queue β€” struct vb2_queue associated with this device node. May be NULL.
  • prio β€” pointer to struct v4l2_prio_state with device's Priority state. If NULL, then v4l2_dev->prio will be used.
  • name β€” video device name
  • vfl_type β€” V4L device type, as defined by enum vfl_devnode_type
  • vfl_dir β€” V4L receiver, transmitter or m2m
  • minor β€” device node 'minor'. It is set to -1 if the registration failed 😭 (yes, that's the fail flag, clock it)
  • num β€” number of the video device node
  • flags β€” video device flags. Use bitops to set/clear/test flags. Contains a set of enum v4l2_video_device_flags.
  • index β€” attribute to differentiate multiple indices on one physical device
  • fh_lock β€” Lock for all v4l2_fhs
  • fh_list β€” List of struct v4l2_fh
  • dev_debug β€” Internal device debug flags, not for use by drivers πŸ™ˆ (hands off, bestie)
  • tvnorms β€” Supported tv norms
  • release β€” video device release callback
  • ioctl_ops β€” pointer to struct v4l2_ioctl_ops with ioctl callbacks
  • valid_ioctls β€” bitmap with the valid ioctls for this device
  • lock β€” pointer to struct mutex serialization lock

πŸ¦‹ Description πŸ¦‹

NOTE: Only set dev_parent if that can't be deduced from v4l2_dev.

that's the whole note, but it's a very serious note okay 😀 only set dev_parent when it genuinely can't be deduced from v4l2_dev. no cap.


🌈 SEE ALSO 🌈

the whole friend group, in order, all of them, iykyk πŸ’œ


and that's the page bestie πŸŽ€ go forth and register some video devices, you're gonna slay ✨

source: ./include/media Β· dated October 2026 β€” mwah, see u in the next manpage πŸ’‹πŸ¦‹

πŸ“¦ where this page comes from