Skip to content

Commit 6655853

Browse files
ribaldapinchartl
authored andcommitted
media: uvcvideo: Fix custom control mapping probing
Custom control mapping introduced a bug, where the filter function was applied to every single control. Fix it so it is only applied to the matching controls. The following dmesg errors during probe are now fixed: usb 1-5: Found UVC 1.00 device Integrated_Webcam_HD (0c45:670c) usb 1-5: Failed to query (GET_CUR) UVC control 2 on unit 2: -75 (exp. 1). usb 1-5: Failed to query (GET_CUR) UVC control 3 on unit 2: -75 (exp. 1). usb 1-5: Failed to query (GET_CUR) UVC control 6 on unit 2: -75 (exp. 1). usb 1-5: Failed to query (GET_CUR) UVC control 7 on unit 2: -75 (exp. 1). usb 1-5: Failed to query (GET_CUR) UVC control 8 on unit 2: -75 (exp. 1). usb 1-5: Failed to query (GET_CUR) UVC control 9 on unit 2: -75 (exp. 1). usb 1-5: Failed to query (GET_CUR) UVC control 10 on unit 2: -75 (exp. 1). Reported-by: Paul Menzel <[email protected]> Closes: https://lore.kernel.org/linux-media/[email protected]/T/#t Cc: [email protected] Fixes: 8f4362a ("media: uvcvideo: Allow custom control mapping") Signed-off-by: Ricardo Ribalda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Paul Menzel <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]>
1 parent 68a7210 commit 6655853

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/media/usb/uvc/uvc_ctrl.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2680,16 +2680,18 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain,
26802680
for (i = 0; i < ARRAY_SIZE(uvc_ctrl_mappings); ++i) {
26812681
const struct uvc_control_mapping *mapping = &uvc_ctrl_mappings[i];
26822682

2683+
if (!uvc_entity_match_guid(ctrl->entity, mapping->entity) ||
2684+
ctrl->info.selector != mapping->selector)
2685+
continue;
2686+
26832687
/* Let the device provide a custom mapping. */
26842688
if (mapping->filter_mapping) {
26852689
mapping = mapping->filter_mapping(chain, ctrl);
26862690
if (!mapping)
26872691
continue;
26882692
}
26892693

2690-
if (uvc_entity_match_guid(ctrl->entity, mapping->entity) &&
2691-
ctrl->info.selector == mapping->selector)
2692-
__uvc_ctrl_add_mapping(chain, ctrl, mapping);
2694+
__uvc_ctrl_add_mapping(chain, ctrl, mapping);
26932695
}
26942696
}
26952697

0 commit comments

Comments
 (0)