diff --git a/include/libcamera/internal/device_enumerator_udev.h b/include/libcamera/internal/device_enumerator_udev.h
index 6f45be0c1c423d02..595b16acb89d98bb 100644
--- a/include/libcamera/internal/device_enumerator_udev.h
+++ b/include/libcamera/internal/device_enumerator_udev.h
@@ -35,6 +35,8 @@ public:
 	int init();
 	int enumerate();
 
+	std::string lookupSysfsPath(const std::string &deviceNode);
+
 private:
 	using DependencyMap = std::map<dev_t, std::list<MediaEntity *>>;
 
diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp
index 96689daa5dd113dc..2e43b84f62e0333d 100644
--- a/src/libcamera/device_enumerator_udev.cpp
+++ b/src/libcamera/device_enumerator_udev.cpp
@@ -14,6 +14,7 @@
 #include <map>
 #include <string.h>
 #include <sys/ioctl.h>
+#include <sys/stat.h>
 #include <sys/sysmacros.h>
 #include <unistd.h>
 
@@ -193,6 +194,29 @@ done:
 	return 0;
 }
 
+std::string DeviceEnumeratorUdev::lookupSysfsPath(const std::string &deviceNode)
+{
+	struct stat st;
+	int ret = stat(deviceNode.c_str(), &st);
+	if (ret < 0) {
+		LOG(DeviceEnumerator, Error)
+			<< "Unable to stat '" << deviceNode << "'";
+		return {};
+	}
+
+	struct udev_device *dev = udev_device_new_from_devnum(udev_, 'c',
+							      st.st_rdev);
+	if (!dev) {
+		LOG(DeviceEnumerator, Error)
+			<< "Unable to make device from devnum " << st.st_rdev;
+		return {};
+	}
+
+	std::string path{ udev_device_get_syspath(dev) };
+	udev_device_unref(dev);
+	return path;
+}
+
 int DeviceEnumeratorUdev::populateMediaDevice(MediaDevice *media, DependencyMap *deps)
 {
 	std::set<dev_t> children;
