STRUCT V4L2_CTRL_CONFIG(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct v4l2_ctrl_config(9) πŸ’…

okay so this is the Kernel API Manual bestie, and today's main character is struct v4l2_ctrl_config β€” literally the glow-up blueprint you fill in when you're building a brand new control. it's giving "custom order form but make it kernel" ✨


πŸŽ€ NAME πŸŽ€

struct v4l2_ctrl_config β€” Control configuration structure. that's it, that's the vibe. it's the struct you hand over when you want a control that's yours, not one of the pre-made ones. πŸ¦‹


✨ SYNOPSIS ✨

struct v4l2_ctrl_config {
    const struct v4l2_ctrl_ops *ops;
    const struct v4l2_ctrl_type_ops *type_ops;
    u32 id;
    const char *name;
    enum v4l2_ctrl_type type;
    s64 min;
    s64 max;
    u64 step;
    s64 def;
    union v4l2_ctrl_ptr p_def;
    union v4l2_ctrl_ptr p_min;
    union v4l2_ctrl_ptr p_max;
    u32 dims[V4L2_CTRL_MAX_DIMS];
    u32 elem_size;
    u32 flags;
    u64 menu_skip_mask;
    const char * const *qmenu;
    const s64 *qmenu_int;
    unsigned int is_private:1;
 };

no cap, that's the whole fit. every field below is a little accessory you can pick and choose 🫢


🌸 Members 🌸

  • ops β€” the control ops. your actual behaviour lives here, bestie πŸ‘‘
  • type_ops β€” the control type ops. only needed for compound controls, so if you're not doing compound stuff you can lowkey leave it alone πŸ’…
  • id β€” the control ID. its legal name, its government name, its whole identity.
  • name β€” the control name. the cute display name, the one people actually see.
  • type β€” the control type. what kind of control this is.
  • min β€” the control's minimum value. the floor, the bare minimum, we don't go lower πŸ”»
  • max β€” the control's maximum value. the ceiling. the limit. the "you shall not pass" 🚫
  • step β€” the control's step value for non-menu controls. how big a jump it takes between values (menu controls don't use this one, iykyk).
  • def β€” the control's default value. the starting point, the factory setting, the "before you touch anything" vibe ⭐
  • p_def β€” the control's default value for compound controls. pointer edition, because compound controls are built different 🧚
  • p_min β€” the control's minimum value for compound controls.
  • p_max β€” the control's maximum value for compound controls.
  • dims β€” the size of each dimension. one entry per dimension, literally πŸ“
  • elem_size β€” the size in bytes of the control. count those bytes, bestie.
  • flags β€” the control's flags. all the little behavioural switches go here 🚩
  • menu_skip_mask β€” the control's skip mask for menu controls. and honestly? this one's iconic. it makes it easy to skip menu items that are not valid: if bit X is set, then menu item X is skipped. of course, this only works for menus with <= 64 menu items β€” but like, there are no menus that come close to that number, so this is OK. and if we ever do need more? then this will have to be extended to a bit array. noted, future us πŸ“
  • qmenu β€” a const char * array for all menu items. and here's the tea: array entries that are empty strings ("") correspond to non-existing menu items β€” and yes, that's in addition to the menu_skip_mask above, double protection bestie. the last entry must be NULL. do not forget the NULL, I'm begging πŸ™ˆ
  • qmenu_int β€” a const s64 integer array for all menu items of the type V4L2_CTRL_TYPE_INTEGER_MENU. numbers-only menu, slay πŸ”’
  • is_private β€” if set, then this control is private to its handler and it will not be added to any other handlers. it's exclusive. it's not sharing. boundaries, periodt πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

so there's a whole friend group here, and you should lowkey meet all of them. also, heads up: Kernel file ./include/media/v4l2-ctrls.h.

like I said. whole friend group. go say hi πŸ’–


and that's the whole page bestie, mwah 😘 it lives in ./include/media and it's dated October 2026 β€” so go forth, fill in your struct, and remember the NULL terminator. love u, bye πŸŽ€πŸ’œ

πŸ“¦ where this page comes from