STRUCT V4L2_CTRL_REF(9)
π struct v4l2_ctrl_ref(9) β the control reference, bestie
okay so this is a page straight outta the Kernel API Manual and it's literally all about struct v4l2_ctrl_ref, which is, like, the control reference. yes queen, the whole thing. let's get into it π
β¨ SYNOPSIS β¨
here's the struct, in all its glory β no cap, this is character-for-character what you get:
struct v4l2_ctrl_ref {
struct list_head node;
struct v4l2_ctrl_ref *next;
struct v4l2_ctrl *ctrl;
struct v4l2_ctrl_helper *helper;
bool from_other_dev;
bool req_done;
bool p_req_valid;
bool p_req_array_enomem;
u32 p_req_array_alloc_elems;
u32 p_req_elems;
union v4l2_ctrl_ptr p_req;
};
π¦ Members π¦
okay so let's go field by field, because every single one of these matters π
nodeβ the list node for the sorted list. she's linked, she's ordered, she's iconic.nextβ single-link list node for the hash. one pointer, one job, slay.ctrlβ the actual control information. like, the real deal.helperβ pointer to helper struct. used internally inprepare_ext_ctrls function at v4l2-ctrl.cβ iykyk, that's where she lives.from_other_devβ if true, thenctrlwas defined in another device than thestruct v4l2_ctrl_handler. so she's visiting from another dev, we love a crossover moment πreq_doneβ internal flag: if the control handler containing this control reference is bound to a media request, then this is set when the control has been applied. this prevents applying controls from a cluster with multiple controls twice (when the first control of a cluster is applied, they all are). no double-dipping bestie, that's the whole point πp_req_validβ if set, thenp_reqcontains the control value for the request.p_req_array_enomemβ if set, thenp_reqis invalid since allocating space for an array failed. attempting to read this value shall result inENOMEM. only valid ifctrl->is_arrayis true. π the allocation said no.p_req_array_alloc_elemsβ the number of elements allocated for the array. only valid ifp_req_validandctrl->is_arrayare true.p_req_elemsβ the number of elements inp_req. this is the same asctrl->elems, except for dynamic arrays. in that case it is in the range of1top_req_array_alloc_elems. only valid ifp_req_validis true.p_reqβ if the control handler containing this control reference is bound to a media request, then this points to the value of the control that must be applied when the request is executed, or to the value of the control at the time that the request was completed. ifp_req_validis false, then this control was never set for this request and the control will not be updated when this request is applied. honestly kind of a main character field, the way she carries the request value π«Ά
πΈ Description πΈ
each control handler has a list of these refs. periodt.
the list_head is used to keep a sorted-by-control-ID list of all controls, while the next pointer is used to link the control in the hash's bucket. two structures, two purposes, one little struct doing both β that's range, bestie β¨
π SEE ALSO π
okay this list is LONG and we are NOT skipping a single one, so buckle up π β kernel file ./include/media/v4l2-ctrls.h plus:
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_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)
and that's the whole page bestie!! π«Άπ
cute little sign-off: this one lives in ./include/media and the version stamp says October 2026, so she's dated, she's sourced, she's struct v4l2_ctrl_ref(9) and she ate π
β¨π
π¦ 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