/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * Copyright (C) 2018-2019, Google Inc. * * device_enumerator_udev.h - udev-based device enumerator */ #ifndef __LIBCAMERA_DEVICE_ENUMERATOR_UDEV_H__ #define __LIBCAMERA_DEVICE_ENUMERATOR_UDEV_H__ #include #include #include #include #include #include "device_enumerator.h" struct udev; struct udev_device; struct udev_monitor; namespace libcamera { class EventNotifier; class MediaDevice; class MediaEntity; class DeviceEnumeratorUdev : public DeviceEnumerator { public: DeviceEnumeratorUdev(); ~DeviceEnumeratorUdev(); int init() final; int enumerate() final; private: struct udev *udev_; struct udev_monitor *monitor_; EventNotifier *notifier_; std::map, std::list> deps_; std::map> devnumToDevice_; std::map devnumToEntity_; std::list orphans_; int addUdevDevice(struct udev_device *dev); int populateMediaDevice(const std::shared_ptr &media); std::string lookupDeviceNode(dev_t devnum); int addV4L2Device(dev_t devnum); void udevNotify(EventNotifier *notifier); }; } /* namespace libcamera */ #endif /* __LIBCAMERA_DEVICE_ENUMERATOR_UDEV_H__ */