libcamera: device_enumerator: add DeviceEnumeratorSysfs class
A udev-based device enumerator is not sufficient, since libudev is an optional dependency, or udev might fail. In these cases, we should fall back to using sysfs to enumerate devices. Add a DeviceEnumeratorSysfs class which is a specialization of DeviceEnumerator that uses sysfs to enumerate media devices on the system. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
/*
|
||||
* Copyright (C) 2019, Google Inc.
|
||||
*
|
||||
* device_enumerator_sysfs.h - sysfs-based device enumerator
|
||||
*/
|
||||
#ifndef __LIBCAMERA_DEVICE_ENUMERATOR_SYSFS_H__
|
||||
#define __LIBCAMERA_DEVICE_ENUMERATOR_SYSFS_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "device_enumerator.h"
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
class DeviceEnumeratorSysfs final : public DeviceEnumerator
|
||||
{
|
||||
public:
|
||||
int init();
|
||||
int enumerate();
|
||||
|
||||
private:
|
||||
std::string lookupDeviceNode(int major, int minor);
|
||||
};
|
||||
|
||||
} /* namespace libcamera */
|
||||
|
||||
#endif /* __LIBCAMERA_DEVICE_ENUMERATOR_SYSFS_H__ */
|
||||
Reference in New Issue
Block a user