diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/internal/v4l2_device.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h index 7816a290..8886b750 100644 --- a/include/libcamera/internal/v4l2_device.h +++ b/include/libcamera/internal/v4l2_device.h @@ -16,6 +16,7 @@ #include <libcamera/base/log.h> #include <libcamera/base/signal.h> #include <libcamera/base/span.h> +#include <libcamera/base/unique_fd.h> #include <libcamera/controls.h> @@ -27,7 +28,7 @@ class V4L2Device : protected Loggable { public: void close(); - bool isOpen() const { return fd_ != -1; } + bool isOpen() const { return fd_.isValid(); } const ControlInfoMap &controls() const { return controls_; } @@ -49,11 +50,11 @@ protected: ~V4L2Device(); int open(unsigned int flags); - int setFd(int fd); + int setFd(UniqueFD fd); int ioctl(unsigned long request, void *argp); - int fd() const { return fd_; } + int fd() const { return fd_.get(); } private: static ControlType v4l2CtrlType(uint32_t ctrlType); @@ -72,7 +73,7 @@ private: ControlIdMap controlIdMap_; ControlInfoMap controls_; std::string deviceNode_; - int fd_; + UniqueFD fd_; EventNotifier *fdEventNotifier_; bool frameStartEnabled_; |