diff options
Diffstat (limited to 'Documentation/video4linux/v4l2-controls.txt')
-rw-r--r-- | Documentation/video4linux/v4l2-controls.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Documentation/video4linux/v4l2-controls.txt b/Documentation/video4linux/v4l2-controls.txt index 54270df99d5c..cfe52c798d74 100644 --- a/Documentation/video4linux/v4l2-controls.txt +++ b/Documentation/video4linux/v4l2-controls.txt | |||
@@ -136,11 +136,25 @@ Or alternatively for integer menu controls, by calling v4l2_ctrl_new_int_menu: | |||
136 | const struct v4l2_ctrl_ops *ops, | 136 | const struct v4l2_ctrl_ops *ops, |
137 | u32 id, s32 max, s32 def, const s64 *qmenu_int); | 137 | u32 id, s32 max, s32 def, const s64 *qmenu_int); |
138 | 138 | ||
139 | Standard menu controls with a driver specific menu are added by calling | ||
140 | v4l2_ctrl_new_std_menu_items: | ||
141 | |||
142 | struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items( | ||
143 | struct v4l2_ctrl_handler *hdl, | ||
144 | const struct v4l2_ctrl_ops *ops, u32 id, s32 max, | ||
145 | s32 skip_mask, s32 def, const char * const *qmenu); | ||
146 | |||
139 | These functions are typically called right after the v4l2_ctrl_handler_init: | 147 | These functions are typically called right after the v4l2_ctrl_handler_init: |
140 | 148 | ||
141 | static const s64 exp_bias_qmenu[] = { | 149 | static const s64 exp_bias_qmenu[] = { |
142 | -2, -1, 0, 1, 2 | 150 | -2, -1, 0, 1, 2 |
143 | }; | 151 | }; |
152 | static const char * const test_pattern[] = { | ||
153 | "Disabled", | ||
154 | "Vertical Bars", | ||
155 | "Solid Black", | ||
156 | "Solid White", | ||
157 | }; | ||
144 | 158 | ||
145 | v4l2_ctrl_handler_init(&foo->ctrl_handler, nr_of_controls); | 159 | v4l2_ctrl_handler_init(&foo->ctrl_handler, nr_of_controls); |
146 | v4l2_ctrl_new_std(&foo->ctrl_handler, &foo_ctrl_ops, | 160 | v4l2_ctrl_new_std(&foo->ctrl_handler, &foo_ctrl_ops, |
@@ -156,6 +170,9 @@ These functions are typically called right after the v4l2_ctrl_handler_init: | |||
156 | ARRAY_SIZE(exp_bias_qmenu) - 1, | 170 | ARRAY_SIZE(exp_bias_qmenu) - 1, |
157 | ARRAY_SIZE(exp_bias_qmenu) / 2 - 1, | 171 | ARRAY_SIZE(exp_bias_qmenu) / 2 - 1, |
158 | exp_bias_qmenu); | 172 | exp_bias_qmenu); |
173 | v4l2_ctrl_new_std_menu_items(&foo->ctrl_handler, &foo_ctrl_ops, | ||
174 | V4L2_CID_TEST_PATTERN, ARRAY_SIZE(test_pattern) - 1, 0, | ||
175 | 0, test_pattern); | ||
159 | ... | 176 | ... |
160 | if (foo->ctrl_handler.error) { | 177 | if (foo->ctrl_handler.error) { |
161 | int err = foo->ctrl_handler.error; | 178 | int err = foo->ctrl_handler.error; |
@@ -185,6 +202,13 @@ v4l2_ctrl_new_std_menu in that it doesn't have the mask argument and takes | |||
185 | as the last argument an array of signed 64-bit integers that form an exact | 202 | as the last argument an array of signed 64-bit integers that form an exact |
186 | menu item list. | 203 | menu item list. |
187 | 204 | ||
205 | The v4l2_ctrl_new_std_menu_items function is very similar to | ||
206 | v4l2_ctrl_new_std_menu but takes an extra parameter qmenu, which is the driver | ||
207 | specific menu for an otherwise standard menu control. A good example for this | ||
208 | control is the test pattern control for capture/display/sensors devices that | ||
209 | have the capability to generate test patterns. These test patterns are hardware | ||
210 | specific, so the contents of the menu will vary from device to device. | ||
211 | |||
188 | Note that if something fails, the function will return NULL or an error and | 212 | Note that if something fails, the function will return NULL or an error and |
189 | set ctrl_handler->error to the error code. If ctrl_handler->error was already | 213 | set ctrl_handler->error to the error code. If ctrl_handler->error was already |
190 | set, then it will just return and do nothing. This is also true for | 214 | set, then it will just return and do nothing. This is also true for |