STRUCT V4L2_CTRL_HANDLER(9)
π struct v4l2_ctrl_handler(9) π
okay bestie, welcome to the Kernel API Manual β today we're reading the page for struct v4l2_ctrl_handler(9), and it's literally the main character of control bookkeeping. π«Ά
πΈ NAME πΈ
struct v4l2_ctrl_handler β the control handler, and it keeps track of all the controls: both the controls owned by the handler and those inherited from other handlers. periodt π
β¨ SYNOPSIS β¨
struct v4l2_ctrl_handler {
struct mutex _lock;
struct mutex *lock;
struct list_head ctrls;
struct list_head ctrl_refs;
struct v4l2_ctrl_ref *cached;
struct v4l2_ctrl_ref **buckets;
v4l2_ctrl_notify_fnc notify;
void *notify_priv;
u16 nr_of_buckets;
int error;
bool request_is_queued;
struct list_head requests;
struct list_head requests_queued;
struct media_request_object req_obj;
};
π Members π
_lockβ the default forlock. πlockβ the lock that controls access to this handler and its controls. It may be replaced by the user right after init. πctrlsβ the list of controls owned by this handler. β¨ctrl_refsβ the list of control references. πcachedβ the last found control reference. It is common that the same control is needed multiple times, so this is a simple optimization. lowkey iconic. βbucketsβ buckets for the hashing. Allows for quick control lookup. π₯notifyβ a notify callback that is called whenever the control changes value. π¨ Heads up: the handler'slockis held when the notify function is called!notify_privβ passed as argument to thev4l2_ctrlnotify callback. π«Άnr_of_bucketsβ total number of buckets in the array. πͺ£errorβ the error code of the first failed control addition. πrequest_is_queuedβ true if the request was queued. βrequestsβ list to keep track of open control handler request objects. For the parent control handler (req_obj.ops == NULL) this is the list header. When the parent control handler is removed, it has to unbind and put all these requests since they refer to the parent. πrequests_queuedβ list of the queued requests. This determines the order in which these controls are applied. Once the request is completed it is removed from this list. π¦req_objβ thestruct media_request_object, used to link into astruct media_request. This request object has a refcount. π
π SEE ALSO π
Kernel file ./include/media/v4l2-ctrls.h β and the whole extended fam:
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_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)
mwah π β from ./include/media, October 2026, struct v4l2_ctrl_handler(9) β now go slay those controls, bestie! π
β¨
π¦ 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