/* SPDX-License-Identifier: LGPL-2.1-or-later *//* * Copyright (C) 2019, Google Inc. * * v4l2_device.cpp - Common base for V4L2 video devices and subdevices */#include"libcamera/internal/v4l2_device.h"#include <fcntl.h>#include <iomanip>#include <limits.h>#include <map>#include <stdlib.h>#include <string.h>#include <sys/ioctl.h>#include <sys/syscall.h>#include <unistd.h>#include <vector>#include <linux/v4l2-mediabus.h>#include <libcamera/base/event_notifier.h>#include <libcamera/base/log.h>#include <libcamera/base/utils.h>#include"libcamera/internal/formats.h"#include"libcamera/internal/sysfs.h"/** * \file v4l2_device.h * \brief Common base for V4L2 devices and subdevices */namespace libcamera {LOG_DEFINE_CATEGORY(V4L2)/** * \class V4L2Device * \brief Base class for V4L2VideoDevice and V4L2Subdevice * * The V4L2Device class groups together the functions and fields common to * both the V4L2VideoDevice and V4L2Subdevice classes, and provides a base * class with functions to open and close the device node associated with the * device and to perform IOCTL system calls on it. * * The V4L2Device class cannot be instantiated directly, as its constructor * is protected. Users should instead create instances of one the derived * classes to model either a V4L2 video device or a V4L2 subdevice. */