summaryrefslogtreecommitdiff
path: root/test/process/process_test.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-11-04 03:12:29 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2021-02-05 01:20:32 +0100
commit60b5f3b8b9e60c956d6db0ab82ca5a3930e0e3f3 (patch)
tree7a5400be423720a25e8e75bfc75ff77bbe2fa526 /test/process/process_test.cpp
parent9cdad8461e61e815ddb7378e87cb047ab168d290 (diff)
libcamera: ipu3: imgu: Allocate buffers for stats and param
Instead of preparing for buffer importing allocate buffers that can be used by an IPA. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test/process/process_test.cpp')
0 files changed, 0 insertions, 0 deletions
class="hl kwd">cameraRemovedHandler([[maybe_unused]] std::shared_ptr<Camera> cam) { cameraRemoved_ = true; } int init() { if (!File::exists("/sys/module/uvcvideo")) { std::cout << "uvcvideo driver is not loaded, skipping" << std::endl; return TestSkip; } if (geteuid() != 0) { std::cout << "This test requires root permissions, skipping" << std::endl; return TestSkip; } cm_ = new CameraManager(); if (cm_->start()) { std::cout << "Failed to start camera manager" << std::endl; return TestFail; } cameraAdded_ = false; cameraRemoved_ = false; cm_->cameraAdded.connect(this, &HotplugTest::cameraAddedHandler); cm_->cameraRemoved.connect(this, &HotplugTest::cameraRemovedHandler); return 0; } int run() { DIR *dir; struct dirent *dirent; std::string uvcDeviceDir; dir = opendir(uvcDriverDir_.c_str()); /* Find a UVC device directory, which we can bind/unbind. */ while ((dirent = readdir(dir)) != nullptr) { if (!File::exists(uvcDriverDir_ + dirent->d_name + "/video4linux")) continue; uvcDeviceDir = dirent->d_name; break; } closedir(dir); /* If no UVC device found, skip the test. */ if (uvcDeviceDir.empty()) return TestSkip; /* Unbind a camera and process events. */ std::ofstream(uvcDriverDir_ + "unbind", std::ios::binary) << uvcDeviceDir; Timer timer; timer.start(1000); while (timer.isRunning() && !cameraRemoved_) Thread::current()->eventDispatcher()->processEvents(); if (!cameraRemoved_) { std::cout << "Camera unplug not detected" << std::endl; return TestFail; } /* Bind the camera again and process events. */ std::ofstream(uvcDriverDir_ + "bind", std::ios::binary) << uvcDeviceDir; timer.start(1000); while (timer.isRunning() && !cameraAdded_) Thread::current()->eventDispatcher()->processEvents(); if (!cameraAdded_) { std::cout << "Camera plug not detected" << std::endl; return TestFail; } return TestPass; } void cleanup() { cm_->stop(); delete cm_; } private: CameraManager *cm_; static const std::string uvcDriverDir_; bool cameraRemoved_; bool cameraAdded_; }; const std::string HotplugTest::uvcDriverDir_ = "/sys/bus/usb/drivers/uvcvideo/"; TEST_REGISTER(HotplugTest)