{"id":3583,"url":"https://patchwork.libcamera.org/api/patches/3583/?format=json","web_url":"https://patchwork.libcamera.org/patch/3583/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20200427222651.3987-1-laurent.pinchart@ideasonboard.com>","date":"2020-04-27T22:26:51","name":"[libcamera-devel] libcamera: camera_sensor: Add model() function","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"10c17e9370a2162b9fc95b3b9e223b9fe2c80f11","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3583/mbox/","series":[{"id":839,"url":"https://patchwork.libcamera.org/api/series/839/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=839","date":"2020-04-27T22:26:51","name":"[libcamera-devel] libcamera: camera_sensor: Add model() function","version":1,"mbox":"https://patchwork.libcamera.org/series/839/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3583/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3583/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 6092560AF4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 00:27:11 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D20B972C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 00:27:10 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Lcv4UdHD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1588026431;\n\tbh=sdfLLYrDwhQb8UjFKAxQq4mSDwFQhEguEaIAl2l0jCE=;\n\th=From:To:Subject:Date:From;\n\tb=Lcv4UdHDRR/uJfyC35pfD4ECR65lJoYpTlPOT1AIVWkyJk/KYyIxZ+Pl1wC3cXvZi\n\tGXefNHJglyRkhKV4SlYOF2mFzIUS1ekyoWqtYB2vUL60ckQj9E+V06OnBfaS5lSFfD\n\t5+ZZEQ4YimY1/bCl0p72OdbdDnOUUskJanIXzCH8=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 28 Apr 2020 01:26:51 +0300","Message-Id":"<20200427222651.3987-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.25.3","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] libcamera: camera_sensor: Add model()\n\tfunction","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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":"Mon, 27 Apr 2020 22:27:11 -0000"},"content":"Add a new model() function to the CameraSensor class to report the\ncamera sensor model.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/camera_sensor.cpp       | 24 ++++++++++++++++++++++++\n src/libcamera/include/camera_sensor.h |  1 +\n 2 files changed, 25 insertions(+)\n\nJacopo,\n\nI'll need this in pipeline handlers to obtain the sensor model, in order\nto construct a configuration file name, without having to generate the\nwhole CameraSensorInfo. Is this OK with you ? As I've taken the\nimplementation of the function from your code, should I add your\nSigned-off-by ?","diff":"diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex c893b90979d8..55a9fbd71e69 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -163,6 +163,30 @@ int CameraSensor::init()\n \treturn 0;\n }\n \n+/**\n+ * \\brief Retrieve the sensor model name\n+ *\n+ * The sensor model name is a free-formed string that uniquely identifies the\n+ * sensor model.\n+ *\n+ * \\return The sensor model name\n+ */\n+std::string CameraSensor::model() const\n+{\n+\t/*\n+\t * Extract the camera sensor model name from the media entity name.\n+\t *\n+\t * \\todo There is no standardized naming scheme for sensor entities\n+\t * in the Linux kernel at the moment. The most common naming scheme\n+\t * is the one obtained by associating the sensor name and its I2C\n+\t * device and bus addresses in the form of: \"devname i2c-adapt:i2c-addr\"\n+\t * Assume this is the standard naming scheme and parse the first part\n+\t * of the entity name to obtain \"devname\".\n+\t */\n+\tstd::string entityName = subdev_->entity()->name();\n+\treturn entityName.substr(0, entityName.find(' '));\n+}\n+\n /**\n  * \\fn CameraSensor::entity()\n  * \\brief Retrieve the sensor media entity\ndiff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h\nindex 5277f7f7fe87..e68185370eb2 100644\n--- a/src/libcamera/include/camera_sensor.h\n+++ b/src/libcamera/include/camera_sensor.h\n@@ -33,6 +33,7 @@ public:\n \n \tint init();\n \n+\tstd::string model() const;\n \tconst MediaEntity *entity() const { return entity_; }\n \tconst std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }\n \tconst std::vector<Size> &sizes() const { return sizes_; }\n","prefixes":["libcamera-devel"]}