From 75c224d8963b0d1b42fb0b7e7634c3513cf52481 Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Mon, 22 Aug 2022 11:54:17 +0100 Subject: lib: configfs: Use wildcard in path to gadget device At some point the kernel has been updated to include a .id descriptor in the gadget directory name - add that to uvc_find_video_device() so that the video node is located properly. Rather than hardcode a specific gadget (for instance with device name gadget.0) use a wildcard. This has the advantage of backwards compatability with older kernels that did not use the ID as part of the device name, though still limits us to supporting scenarios where only a single gadget is bound to the UDC. Reviewed-by: Kieran Bingham Signed-off-by: Daniel Scally --- lib/configfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/configfs.c b/lib/configfs.c index 26a07bb..a29e576 100644 --- a/lib/configfs.c +++ b/lib/configfs.c @@ -204,7 +204,7 @@ static char *udc_find_video_device(const char *udc, const char *function) int ret; ret = asprintf(&vpath, - "/sys/class/udc/%s/device/gadget/video4linux/video*", + "/sys/class/udc/%s/device/gadget*/video4linux/video*", udc ? udc : "*"); if (!ret) return NULL; -- cgit v1.2.3