libcamera: v4l2_device: Implement get and set controls

Implement getControls() and setControls() operations in V4L2Device class.

Both operations take a V4L2Controls instance and read or write the V4L2
controls on the V4L2 device.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Jacopo Mondi
2019-06-25 14:01:37 +02:00
parent 030ce6491e
commit eb068f4e67
2 changed files with 199 additions and 0 deletions
+9
View File
@@ -10,11 +10,14 @@
#include <map>
#include <string>
#include <linux/videodev2.h>
#include "log.h"
namespace libcamera {
class V4L2ControlInfo;
class V4L2ControlList;
class V4L2Device : protected Loggable
{
@@ -23,6 +26,8 @@ public:
bool isOpen() const { return fd_ != -1; }
const V4L2ControlInfo *getControlInfo(unsigned int id) const;
int getControls(V4L2ControlList *ctrls);
int setControls(V4L2ControlList *ctrls);
const std::string &deviceNode() const { return deviceNode_; }
@@ -38,6 +43,10 @@ protected:
private:
void listControls();
void updateControls(V4L2ControlList *ctrls,
const V4L2ControlInfo **controlInfo,
const struct v4l2_ext_control *v4l2Ctrls,
unsigned int count);
std::map<unsigned int, V4L2ControlInfo> controls_;
std::string deviceNode_;