]> Git Repo - linux.git/commitdiff
media: uvcvideo: Fix custom control mapping probing
authorRicardo Ribalda <[email protected]>
Mon, 22 Jul 2024 11:52:26 +0000 (11:52 +0000)
committerLaurent Pinchart <[email protected]>
Mon, 22 Jul 2024 12:22:20 +0000 (15:22 +0300)
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: 8f4362a8d42b ("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]>
drivers/media/usb/uvc/uvc_ctrl.c

index 0136df5732bac5d6600f035641e07689e14782cd..4fe26e82e3d1c167bd59c5decf79a8391ae465a4 100644 (file)
@@ -2680,6 +2680,10 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain,
        for (i = 0; i < ARRAY_SIZE(uvc_ctrl_mappings); ++i) {
                const struct uvc_control_mapping *mapping = &uvc_ctrl_mappings[i];
 
+               if (!uvc_entity_match_guid(ctrl->entity, mapping->entity) ||
+                   ctrl->info.selector != mapping->selector)
+                       continue;
+
                /* Let the device provide a custom mapping. */
                if (mapping->filter_mapping) {
                        mapping = mapping->filter_mapping(chain, ctrl);
@@ -2687,9 +2691,7 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain,
                                continue;
                }
 
-               if (uvc_entity_match_guid(ctrl->entity, mapping->entity) &&
-                   ctrl->info.selector == mapping->selector)
-                       __uvc_ctrl_add_mapping(chain, ctrl, mapping);
+               __uvc_ctrl_add_mapping(chain, ctrl, mapping);
        }
 }
 
This page took 0.071505 seconds and 4 git commands to generate.