7 #ifndef __LIBCAMERA_INTERNAL_V4L2_DEVICE_H__ 8 #define __LIBCAMERA_INTERNAL_V4L2_DEVICE_H__ 14 #include <linux/videodev2.h> 17 #include <libcamera/span.h> 30 bool isOpen()
const {
return fd_ != -1; }
37 const struct v4l2_query_ext_ctrl *
controlInfo(uint32_t
id)
const;
39 const std::string &
deviceNode()
const {
return deviceNode_; }
49 int open(
unsigned int flags);
52 int ioctl(
unsigned long request,
void *argp);
54 int fd()
const {
return fd_; }
59 Span<const v4l2_ext_control> v4l2Ctrls);
63 std::map<unsigned int, struct v4l2_query_ext_ctrl> controlInfo_;
64 std::vector<std::unique_ptr<V4L2ControlId>> controlIds_;
66 std::string deviceNode_;
70 bool frameStartEnabled_;
int fd() const
Retrieve the V4L2 device file descriptor.
Definition: v4l2_device.h:54
int open(unsigned int flags)
Open a V4L2 device node.
Definition: v4l2_device.cpp:77
Base class for V4L2VideoDevice and V4L2Subdevice.
Definition: v4l2_device.h:26
Base class to support log message extensions.
Definition: log.h:84
Top-level libcamera namespace.
Definition: bound_method.h:15
void close()
Close the device node.
Definition: v4l2_device.cpp:134
std::string devicePath() const
Retrieve the device path in sysfs.
Definition: v4l2_device.cpp:386
Support for V4L2 Controls using the V4L2 Extended Controls APIs.
bool isOpen() const
Check if the V4L2 device node is open.
Definition: v4l2_device.h:30
Signal< uint32_t > frameStart
A Signal emitted when capture of a frame has started.
Definition: v4l2_device.h:43
const std::string & deviceNode() const
Retrieve the device node path.
Definition: v4l2_device.h:39
int setFd(int fd)
Set the file descriptor of a V4L2 device.
Definition: v4l2_device.cpp:115
A map of ControlId to ControlInfo.
Definition: controls.h:301
~V4L2Device()
Destroy a V4L2Device.
Definition: v4l2_device.cpp:64
Signal & slot implementation.
const struct v4l2_query_ext_ctrl * controlInfo(uint32_t id) const
Retrieve the v4l2_query_ext_ctrl information for the given control.
Definition: v4l2_device.cpp:366
int setControls(ControlList *ctrls)
Write controls to the device.
Definition: v4l2_device.cpp:283
Notify of activity on a file descriptor.
Definition: event_notifier.h:17
int ioctl(unsigned long request, void *argp)
Perform an IOCTL system call on the device node.
Definition: v4l2_device.cpp:443
const ControlInfoMap & controls() const
Retrieve the supported V4L2 controls and their information.
Definition: v4l2_device.h:32
V4L2Device(const std::string &deviceNode)
Construct a V4L2Device.
Definition: v4l2_device.cpp:55
ControlList getControls(const std::vector< uint32_t > &ids)
Read controls from the device.
Definition: v4l2_device.cpp:174
Associate a list of ControlId with their values for an object.
Definition: controls.h:346
int setFrameStartEnabled(bool enable)
Enable or disable frame start event notification.
Definition: v4l2_device.cpp:412