libcamera: v4l2_device: List valid controls at open
Enumerate all the valid controls a device supports at open() time. A control is valid only if its type is supported. Store the control information in a map inside the device to save querying the control when setting or getting its value from the device and provide an operation to retrieve information by control ID. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -7,18 +7,23 @@
|
||||
#ifndef __LIBCAMERA_V4L2_DEVICE_H__
|
||||
#define __LIBCAMERA_V4L2_DEVICE_H__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
class V4L2ControlInfo;
|
||||
|
||||
class V4L2Device : protected Loggable
|
||||
{
|
||||
public:
|
||||
void close();
|
||||
bool isOpen() const { return fd_ != -1; }
|
||||
|
||||
const V4L2ControlInfo *getControlInfo(unsigned int id) const;
|
||||
|
||||
const std::string &deviceNode() const { return deviceNode_; }
|
||||
|
||||
protected:
|
||||
@@ -32,6 +37,9 @@ protected:
|
||||
int fd() { return fd_; }
|
||||
|
||||
private:
|
||||
void listControls();
|
||||
|
||||
std::map<unsigned int, V4L2ControlInfo> controls_;
|
||||
std::string deviceNode_;
|
||||
int fd_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user