STRUCT V4L2_CTRL(9)
๐ struct v4l2_ctrl(9) โ The control structure ๐
okay bestie, welcome to the Kernel API Manual page for struct v4l2_ctrl(9) ๐
this is the whole control-structure situation, and itโs lowkey iconic.
โจ NAME โจ
struct v4l2_ctrl โ The control structure. ๐ซถ
๐ธ SYNOPSIS ๐ธ
so hereโs the actual shape of struct v4l2_ctrl, and yes every field is exactly where it should be:
struct v4l2_ctrl {
struct list_head node;
struct list_head ev_subs;
struct v4l2_ctrl_handler *handler;
struct v4l2_ctrl **cluster;
unsigned int ncontrols;
unsigned int done:1;
unsigned int is_new:1;
unsigned int has_changed:1;
unsigned int is_private:1;
unsigned int is_auto:1;
unsigned int is_int:1;
unsigned int is_string:1;
unsigned int is_ptr:1;
unsigned int is_array:1;
unsigned int is_dyn_array:1;
unsigned int has_volatiles:1;
unsigned int call_notify:1;
unsigned int manual_mode_value:8;
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 minimum, maximum, default_value;
u32 elems;
u32 elem_size;
u32 new_elems;
u32 dims[V4L2_CTRL_MAX_DIMS];
u32 nr_of_dims;
union {
u64 step;
u64 menu_skip_mask;
};
union {
const char * const *qmenu;
const s64 *qmenu_int;
};
unsigned long flags;
void *priv;
void *p_array;
u32 p_array_alloc_elems;
s32 val;
struct {
s32 val;
} cur;
union v4l2_ctrl_ptr p_def;
union v4l2_ctrl_ptr p_min;
union v4l2_ctrl_ptr p_max;
union v4l2_ctrl_ptr p_new;
union v4l2_ctrl_ptr p_cur;
};
๐ง Members ๐ง
nodeโ the list node. just vibing in the linked list ๐ซev_subsโ the list of control event subscriptions ๐๏ธhandlerโ the handler that owns the control ๐clusterโ points to the start of the cluster array ๐ซncontrolsโ number of controls in the cluster array ๐ขdoneโ internal flag: set for each processed control ๐ซกis_newโ set when the user specified a new value for this control. It is also set when called fromv4l2_ctrl_handler_setup. Drivers should never set this flag. โ ๏ธhas_changedโ set when the current value differs from the new value. Drivers should never use this flag. ๐ซis_privateโ if set, then this control is private to its handler and it will not be added to any other handlers. Drivers can set this flag. ๐is_autoโ if set, then this control selects whether the other cluster members are in 'automatic' mode or 'manual' mode. This is used for autogain/gain type clusters. Drivers should never set this flag directly. ๐๏ธis_intโ if set, then this control has a simple integer value (i.e. it usesctrl->val). ๐ขis_stringโ if set, then this control has typeV4L2_CTRL_TYPE_STRING. ๐งตis_ptrโ if set, then this control is an array and/or has type >=V4L2_CTRL_COMPOUND_TYPESand/or has typeV4L2_CTRL_TYPE_STRING. In other words,struct v4l2_ext_controluses fieldpto point to the data. ๐is_arrayโ if set, then this control contains an N-dimensional array. ๐งis_dyn_arrayโ if set, then this control contains a dynamically sized 1-dimensional array. If this is set, thenis_arrayis also set. ๐has_volatilesโ if set, then one or more members of the cluster are volatile. Drivers should never touch this flag. ๐งจcall_notifyโ if set, then call the handler's notify function whenever the control's value changes. ๐ฃmanual_mode_valueโ if theis_autoflag is set, then this is the value of the auto control that determines if that control is in manual mode. So if the value of the auto control equals this value, then the whole cluster is in manual mode. Drivers should never set this flag directly. ๐น๏ธopsโ the control ops. ๐ ๏ธtype_opsโ the control type ops. ๐งฐidโ the control ID. ๐nameโ the control name. ๐ท๏ธtypeโ the control type. ๐งฌminimumโ the control's minimum value. โฌ๏ธmaximumโ the control's maximum value. โฌ๏ธdefault_valueโ the control's default value. ๐ฏelemsโ the number of elements in the N-dimensional array. ๐งฎelem_sizeโ the size in bytes of the control. ๐new_elemsโ the number of elements inp_new. This is the same aselems, except for dynamic arrays. In that case it is in the range of1top_array_alloc_elems. ๐dimsโ the size of each dimension. ๐nr_of_dimsโ the number of dimensions indims. ๐ข{unnamed_union}โ anonymous. this is the union wherestep/menu_skip_masklive ๐ซฅstepโ the control's step value for non-menu controls. ๐ฃmenu_skip_maskโ the control's skip mask for menu controls. This 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 <=32menu items. There are no menus that come close to that number, so this is OK. Should we ever need more, then this will have to be extended to au64or a bit array. ๐ซ{unnamed_union}โ anonymous. this is the union whereqmenu/qmenu_intlive ๐ซฅqmenuโ aconst char *array for all menu items. Array entries that are empty strings ("") correspond to non-existing menu items (this is in addition to themenu_skip_maskabove). The last entry must beNULL. Used only if the type isV4L2_CTRL_TYPE_MENU. ๐qmenu_intโ a 64-bit integer array for integer menu items. The size of array must be equal to the menu size, e. g.:
:math:`ceil(ac{maximum - minimum}{step}) + 1`
Used only if the type is V4L2_CTRL_TYPE_INTEGER_MENU. ๐ข
flagsโ the control's flags. ๐ฉprivโ the control's private pointer. For use by the driver. It is untouched by the control framework. Note that this pointer is not freed when the control is deleted. Should this be needed then a new internal bitfield can be added to tell the framework to free this pointer. ๐p_arrayโ pointer to the allocated array. Only valid ifis_arrayis true. ๐งทp_array_alloc_elemsโ the number of elements in the allocated array for both thecurand new values. Sop_arrayis actually sized for2 * p_array_alloc_elems * elem_size. Only valid ifis_arrayis true. ๐งฎvalโ the control's news32value. ๐curโ structure to store the current value. ๐ฆcur.valโ the control's current value, if the type is represented via au32integer (seeenum v4l2_ctrl_type). ๐๏ธp_defโ the control's default value represented via a union which provides a standard way of accessing control types through a pointer (for compound controls only). ๐p_minโ the control's minimum value represented via a union which provides a standard way of accessing control types through a pointer (for compound controls only). โฌ๏ธp_maxโ the control's maximum value represented via a union which provides a standard way of accessing control types through a pointer (for compound controls only). โฌ๏ธp_newโ the control's new value represented via a union which provides a standard way of accessing control types through a pointer. ๐p_curโ the control's current value represented via a union which provides a standard way of accessing control types through a pointer. ๐ฏ
๐ SEE ALSO ๐
- 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_ref(9)struct v4l2_ctrl_handler(9)struct v4l2_ctrl_config(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)
okay thatโs the whole page, bestie ๐ซถ source/version path: ./include/media, date: October 2026, and the page is struct v4l2_ctrl(9). mwah ๐
๐ฆ 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