STRUCT V4L2_CTRL_CONFIG(9)
π 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β aconst 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 themenu_skip_maskabove, double protection bestie. the last entry must beNULL. do not forget theNULL, I'm begging πqmenu_intβ aconst s64integer array for all menu items of the typeV4L2_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.
union v4l2_ctrl_ptr(9)v4l2_ctrl_ptr_create(9)struct v4l2_ctrl_ops(9)struct v4l2_ctrl_type_ops(9)v4l2_ctrl_notify_fnc(9)struct v4l2_ctrl(9)struct v4l2_ctrl_ref(9)struct v4l2_ctrl_handler(9)v4l2_ctrl_fill(9)v4l2_ctrl_handler_init_class(9)v4l2_ctrl_handler_init(9)v4l2_ctrl_handler_free(9)v4l2_ctrl_lock(9)v4l2_ctrl_unlock(9)__v4l2_ctrl_handler_setup(9)v4l2_ctrl_handler_setup(9)v4l2_ctrl_handler_log_status(9)v4l2_ctrl_new_custom(9)v4l2_ctrl_new_std(9)v4l2_ctrl_new_std_menu(9)v4l2_ctrl_new_std_menu_items(9)v4l2_ctrl_new_std_compound(9)v4l2_ctrl_new_int_menu(9)v4l2_ctrl_filter(9)v4l2_ctrl_add_handler(9)v4l2_ctrl_radio_filter(9)v4l2_ctrl_cluster(9)v4l2_ctrl_auto_cluster(9)v4l2_ctrl_find(9)v4l2_ctrl_activate(9)__v4l2_ctrl_grab(9)v4l2_ctrl_grab(9)__v4l2_ctrl_modify_range(9)v4l2_ctrl_modify_range(9)__v4l2_ctrl_modify_dimensions(9)v4l2_ctrl_modify_dimensions(9)v4l2_ctrl_notify(9)v4l2_ctrl_get_name(9)v4l2_ctrl_get_menu(9)v4l2_ctrl_get_int_menu(9)v4l2_ctrl_g_ctrl(9)__v4l2_ctrl_s_ctrl(9)v4l2_ctrl_s_ctrl(9)v4l2_ctrl_g_ctrl_int64(9)__v4l2_ctrl_s_ctrl_int64(9)v4l2_ctrl_s_ctrl_int64(9)__v4l2_ctrl_s_ctrl_string(9)v4l2_ctrl_s_ctrl_string(9)__v4l2_ctrl_s_ctrl_compound(9)v4l2_ctrl_s_ctrl_compound(9)v4l2_ctrl_replace(9)v4l2_ctrl_merge(9)v4l2_ctrl_log_status(9)v4l2_ctrl_subscribe_event(9)v4l2_ctrl_poll(9)v4l2_ctrl_request_setup(9)v4l2_ctrl_request_complete(9)v4l2_ctrl_request_hdl_find(9)v4l2_ctrl_request_hdl_put(9)v4l2_ctrl_request_hdl_ctrl_find(9)v4l2_queryctrl(9)v4l2_query_ext_ctrl_to_v4l2_queryctrl(9)v4l2_query_ext_ctrl(9)v4l2_querymenu(9)v4l2_g_ctrl(9)v4l2_s_ctrl(9)v4l2_g_ext_ctrls(9)v4l2_try_ext_ctrls(9)v4l2_s_ext_ctrls(9)v4l2_ctrl_subdev_subscribe_event(9)v4l2_ctrl_subdev_log_status(9)v4l2_ctrl_new_fwnode_properties(9)v4l2_ctrl_type_op_equal(9)v4l2_ctrl_type_op_init(9)v4l2_ctrl_type_op_log(9)v4l2_ctrl_type_op_validate(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms