summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller/rpi
ModeNameSize
-rw-r--r--agc.cpp27655logplain
-rw-r--r--agc.hpp4130logplain
-rw-r--r--alsc.cpp25202logplain
-rw-r--r--alsc.hpp3516logplain
-rw-r--r--awb.cpp21712logplain
-rw-r--r--awb.hpp6010logplain
-rw-r--r--black_level.cpp1404logplain
-rw-r--r--black_level.hpp675logplain
-rw-r--r--ccm.cpp4815logplain
-rw-r--r--ccm.hpp1787logplain
-rw-r--r--contrast.cpp5740logplain
-rw-r--r--contrast.hpp1186logplain
-rw-r--r--dpc.cpp1162logplain
-rw-r--r--dpc.hpp647logplain
-rw-r--r--focus.cpp1062logplain
-rw-r--r--focus.hpp611logplain
-rw-r--r--geq.cpp2170logplain
-rw-r--r--geq.hpp698logplain
-rw-r--r--lux.cpp3093logplain
-rw-r--r--lux.hpp1089logplain
-rw-r--r--noise.cpp2115logplain
-rw-r--r--noise.hpp784logplain
-rw-r--r--sdn.cpp1645logplain
-rw-r--r--sdn.hpp635logplain
-rw-r--r--sharpen.cpp2374logplain
-rw-r--r--sharpen.hpp823logplain
span>match(const MediaDevice *device) const { if (driver_ != device->driver()) return false; for (const std::string &name : entities_) { bool found = false; for (const MediaEntity *entity : device->entities()) { if (name == entity->name()) { found = true; break; } } if (!found) return false; } return true; } /** * \class DeviceEnumerator * \brief Enumerate, store and search media devices * * The DeviceEnumerator class is responsible for all interactions with the * operating system related to media devices. It enumerates all media devices * in the system, and for each device found creates an instance of the * MediaDevice class and stores it internally. The list of media devices can * then be searched using DeviceMatch search patterns. * * The enumerator also associates media device entities with device node paths. */ /** * \brief Create a new device enumerator matching the systems capabilities * * Depending on how the operating system handles device detection, hot-plug * notification and device node lookup, different device enumerator * implementations may be needed. This function creates the best enumerator for * the operating system based on the available resources. Not all different * enumerator types are guaranteed to support all features. * * \return A pointer to the newly created device enumerator on success, or * nullptr if an error occurs */ std::unique_ptr<DeviceEnumerator> DeviceEnumerator::create() { std::unique_ptr<DeviceEnumerator> enumerator; #ifdef HAVE_LIBUDEV enumerator = std::make_unique<DeviceEnumeratorUdev>(); if (!enumerator->init()) return enumerator; #endif /* * Either udev is not available or udev initialization failed. Fall back * on the sysfs enumerator. */ enumerator = std::make_unique<DeviceEnumeratorSysfs>(); if (!enumerator->init()) return enumerator; return nullptr; } DeviceEnumerator::~DeviceEnumerator() { for (std::shared_ptr<MediaDevice> media : devices_) { if (media->busy()) LOG(DeviceEnumerator, Error) << "Removing media device " << media->deviceNode() << " while still in use"; } } /** * \fn DeviceEnumerator::init() * \brief Initialize the enumerator * \return 0 on success or a negative error code otherwise * \retval -EBUSY the enumerator has already been initialized * \retval -ENODEV the enumerator can't enumerate devices */ /** * \fn DeviceEnumerator::enumerate() * \brief Enumerate all media devices in the system * * This function finds and add all media devices in the system to the * enumerator. It shall be implemented by all subclasses of DeviceEnumerator * using system-specific methods. * * Individual media devices that can't be properly enumerated shall be skipped * with a warning message logged, without returning an error. Only errors that * prevent enumeration altogether shall be fatal. * * \context This function is \threadbound. * * \return 0 on success or a negative error code otherwise */ /** * \brief Create a media device instance * \param[in] deviceNode path to the media device to create * * Create a media device for the \a deviceNode, open it, and populate its * media graph. The device enumerator shall then populate the media device by * associating device nodes with entities using MediaEntity::setDeviceNode(). * This process is specific to each device enumerator, and the device enumerator * shall ensure that device nodes are ready to be used (for instance, if * applicable, by waiting for device nodes to be created and access permissions * to be set by the system). Once done, it shall add the media device to the * system with addDevice(). * * \return Created media device instance on success, or nullptr otherwise */ std::unique_ptr<MediaDevice> DeviceEnumerator::createDevice(const std::string &deviceNode) { std::unique_ptr<MediaDevice> media = std::make_unique<MediaDevice>(deviceNode); int ret = media->populate(); if (ret < 0) { LOG(DeviceEnumerator, Info) << "Unable to populate media device " << deviceNode << " (" << strerror(-ret) << "), skipping"; return nullptr; } LOG(DeviceEnumerator, Debug) << "New media device \"" << media->driver() << "\" created from " << deviceNode; return media; } /** * \brief Add a media device to the enumerator * \param[in] media media device instance to add * * Store the media device in the internal list for later matching with * pipeline handlers. \a media shall be created with createDevice() first. * This method shall be called after all members of the entities of the * media graph have been confirmed to be initialized. */ void DeviceEnumerator::addDevice(std::unique_ptr<MediaDevice> &&media) { LOG(DeviceEnumerator, Debug) << "Added device " << media->deviceNode() << ": " << media->driver(); devices_.push_back(std::move(media)); } /** * \brief Remove a media device from the enumerator * \param[in] deviceNode Path to the media device to remove * * Remove the media device identified by \a deviceNode previously added to the * enumerator with addDevice(). The media device's MediaDevice::disconnected * signal is emitted. */ void DeviceEnumerator::removeDevice(const std::string &deviceNode) { std::shared_ptr<MediaDevice> media; for (auto iter = devices_.begin(); iter != devices_.end(); ++iter) { if ((*iter)->deviceNode() == deviceNode) { media = std::move(*iter); devices_.erase(iter); break; } } if (!media) { LOG(DeviceEnumerator, Warning) << "Media device for node " << deviceNode << " not found"; return; } LOG(DeviceEnumerator, Debug) << "Media device for node " << deviceNode << " removed."; media->disconnected.emit(media.get()); } /** * \brief Search available media devices for a pattern match * \param[in] dm Search pattern * * Search in the enumerated media devices that are not already in use for a * match described in \a dm. If a match is found and the caller intends to use * it the caller is responsible for acquiring the MediaDevice object and * releasing it when done with it. * * \return pointer to the matching MediaDevice, or nullptr if no match is found */ std::shared_ptr<MediaDevice> DeviceEnumerator::search(const DeviceMatch &dm) { for (std::shared_ptr<MediaDevice> &media : devices_) { if (media->busy()) continue; if (dm.match(media.get())) { LOG(DeviceEnumerator, Debug) << "Successful match for media device \"" << media->driver() << "\""; return media; } } return nullptr; } } /* namespace libcamera */