{"id":1019,"url":"https://patchwork.libcamera.org/api/1.1/patches/1019/?format=json","web_url":"https://patchwork.libcamera.org/patch/1019/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190416220839.1577-11-laurent.pinchart@ideasonboard.com>","date":"2019-04-16T22:08:36","name":"[libcamera-devel,v2,10/13] libcamera: v4l2-subdevice: Add method to retrieve the media entity","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"759199f54b8699ddbe62a2a0be4eb48487fac7b4","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1019/mbox/","series":[{"id":253,"url":"https://patchwork.libcamera.org/api/1.1/series/253/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=253","date":"2019-04-16T22:08:26","name":"Rockchip ISP pipeline handler","version":2,"mbox":"https://patchwork.libcamera.org/series/253/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1019/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1019/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D2DE960DC0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Apr 2019 00:08:54 +0200 (CEST)","from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 58A982BA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Apr 2019 00:08:54 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555452534;\n\tbh=cMpbBV72CoEG8V8PaJaGE5AqvOAtchALPQ5WewmQSbc=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=W9r1m2l6VoStgbcRKs8s101OL/Qt9uRc4nvGSAE3NJuZ8jG3G88a1K9RTE1lqt25p\n\tQYtmdR5UB0/cB6NnQhzAVNNSrUZqFmFvgxcfM4GZf/ZQuin0ULQkzzuNwFtMBdgi1m\n\thli6l4Pgo0DrW9T4Ypcoy3kz4l0QEK024W9bqmEo=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 17 Apr 2019 01:08:36 +0300","Message-Id":"<20190416220839.1577-11-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190416220839.1577-1-laurent.pinchart@ideasonboard.com>","References":"<20190416220839.1577-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 10/13] libcamera: v4l2-subdevice: Add\n\tmethod to retrieve the media entity","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 16 Apr 2019 22:08:56 -0000"},"content":"Add a method to retrieve the media entity associated with a subdevice.\nThe entityName() and deviceNode() methods are not needed anymore as they\ncan be accessed through the media entity, remove them.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/include/v4l2_subdevice.h      |  3 +--\n src/libcamera/pipeline/ipu3/ipu3.cpp        |  4 ++--\n src/libcamera/v4l2_subdevice.cpp            | 22 +++++++--------------\n test/v4l2_subdevice/list_formats.cpp        |  6 +++---\n test/v4l2_subdevice/v4l2_subdevice_test.cpp |  2 +-\n 5 files changed, 14 insertions(+), 23 deletions(-)","diff":"diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\nindex e592d67dd043..c7b0b4cb76ea 100644\n--- a/src/libcamera/include/v4l2_subdevice.h\n+++ b/src/libcamera/include/v4l2_subdevice.h\n@@ -41,8 +41,7 @@ public:\n \tbool isOpen() const;\n \tvoid close();\n \n-\tconst std::string &deviceNode() const { return entity_->deviceNode(); }\n-\tconst std::string &entityName() const { return entity_->name(); }\n+\tconst MediaEntity *entity() const { return entity_; }\n \n \tint setCrop(unsigned int pad, Rectangle *rect);\n \tint setCompose(unsigned int pad, Rectangle *rect);\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 4ddd1ede1c81..e3c79f93963e 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -579,7 +579,7 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n \n \t\t/* Create and register the Camera instance. */\n-\t\tstd::string cameraName = cio2->sensor_->entityName() + \" \"\n+\t\tstd::string cameraName = cio2->sensor_->entity()->name() + \" \"\n \t\t\t\t       + std::to_string(id);\n \t\tstd::shared_ptr<Camera> camera = Camera::create(this,\n \t\t\t\t\t\t\t\tcameraName,\n@@ -1055,7 +1055,7 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index)\n \t\t}\n \t}\n \tif (maxSize_.width == 0) {\n-\t\tLOG(IPU3, Info) << \"Sensor '\" << sensor_->entityName()\n+\t\tLOG(IPU3, Info) << \"Sensor '\" << sensor_->entity()->name()\n \t\t\t\t<< \"' detected, but no supported image format \"\n \t\t\t\t<< \" found: skip camera creation\";\n \t\treturn -ENODEV;\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex a03fadfd579e..5d5b168f98a2 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -131,12 +131,12 @@ int V4L2Subdevice::open()\n \t\treturn -EBUSY;\n \t}\n \n-\tret = ::open(deviceNode().c_str(), O_RDWR);\n+\tret = ::open(entity_->deviceNode().c_str(), O_RDWR);\n \tif (ret < 0) {\n \t\tret = -errno;\n \t\tLOG(V4L2Subdev, Error)\n-\t\t\t<< \"Failed to open V4L2 subdevice '\" << deviceNode()\n-\t\t\t<< \"': \" << strerror(-ret);\n+\t\t\t<< \"Failed to open V4L2 subdevice '\"\n+\t\t\t<< entity_->deviceNode() << \"': \" << strerror(-ret);\n \t\treturn ret;\n \t}\n \tfd_ = ret;\n@@ -166,17 +166,9 @@ void V4L2Subdevice::close()\n }\n \n /**\n- * \\fn V4L2Subdevice::deviceNode()\n- * \\brief Retrieve the path of the device node associated with the subdevice\n- *\n- * \\return The subdevice's device node system path\n- */\n-\n-/**\n- * \\fn V4L2Subdevice::entityName()\n- * \\brief Retrieve the name of the media entity associated with the subdevice\n- *\n- * \\return The name of the media entity the subdevice is associated to\n+ * \\fn V4L2Subdevice::entity()\n+ * \\brief Retrieve the media entity associated with the subdevice\n+ * \\return The subdevice's associated media entity.\n  */\n \n /**\n@@ -343,7 +335,7 @@ V4L2Subdevice *V4L2Subdevice::fromEntityName(const MediaDevice *media,\n \n std::string V4L2Subdevice::logPrefix() const\n {\n-\treturn \"'\" + entityName() + \"'\";\n+\treturn \"'\" + entity_->name() + \"'\";\n }\n \n int V4L2Subdevice::enumPadSizes(unsigned int pad,unsigned int code,\ndiff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp\nindex 09dec9abe854..18dd8761a8ab 100644\n--- a/test/v4l2_subdevice/list_formats.cpp\n+++ b/test/v4l2_subdevice/list_formats.cpp\n@@ -52,7 +52,7 @@ int ListFormatsTest::run()\n \tformats = scaler_->formats(0);\n \tif (formats.empty()) {\n \t\tcerr << \"Failed to list formats on pad 0 of subdevice \"\n-\t\t     << scaler_->entityName() << endl;\n+\t\t     << scaler_->entity()->name() << endl;\n \t\treturn TestFail;\n \t}\n \tfor (auto it = formats.begin(); it != formats.end(); ++it)\n@@ -61,7 +61,7 @@ int ListFormatsTest::run()\n \tformats = scaler_->formats(1);\n \tif (formats.empty()) {\n \t\tcerr << \"Failed to list formats on pad 1 of subdevice \"\n-\t\t     << scaler_->entityName() << endl;\n+\t\t     << scaler_->entity()->name() << endl;\n \t\treturn TestFail;\n \t}\n \tfor (auto it = formats.begin(); it != formats.end(); ++it)\n@@ -71,7 +71,7 @@ int ListFormatsTest::run()\n \tformats = scaler_->formats(2);\n \tif (!formats.empty()) {\n \t\tcerr << \"Listing formats on non-existing pad 2 of subdevice \"\n-\t\t     << scaler_->entityName()\n+\t\t     << scaler_->entity()->name()\n \t\t     << \" should return an empty format list\" << endl;\n \t\treturn TestFail;\n \t}\ndiff --git a/test/v4l2_subdevice/v4l2_subdevice_test.cpp b/test/v4l2_subdevice/v4l2_subdevice_test.cpp\nindex 06582969eb45..dfcf779af95e 100644\n--- a/test/v4l2_subdevice/v4l2_subdevice_test.cpp\n+++ b/test/v4l2_subdevice/v4l2_subdevice_test.cpp\n@@ -66,7 +66,7 @@ int V4L2SubdeviceTest::init()\n \tret = scaler_->open();\n \tif (ret) {\n \t\tcerr << \"Unable to open video subdevice \"\n-\t\t     << scaler_->deviceNode() << endl;\n+\t\t     << scaler_->entity()->deviceNode() << endl;\n \t\tmedia_->release();\n \t\treturn TestSkip;\n \t}\n","prefixes":["libcamera-devel","v2","10/13"]}