[{"id":4623,"web_url":"https://patchwork.libcamera.org/comment/4623/","msgid":"<20200428170802.GI5859@pendragon.ideasonboard.com>","date":"2020-04-28T17:08:02","subject":"Re: [libcamera-devel] [PATCH] libcamera: camera_sensor: Add model()\n\tfunction","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Please ignore this patch.\n\nOn Tue, Apr 28, 2020 at 08:06:56PM +0300, Laurent Pinchart wrote:\n> Add a new model() function to the CameraSensor class to report the\n> camera sensor model.\n> \n> Signed-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> \n> Jacopo,\n> \n> I'll need this in pipeline handlers to obtain the sensor model, in order\n> to construct a configuration file name, without having to generate the\n> whole CameraSensorInfo. Is this OK with you ? As I've taken the\n> implementation of the function from your code, should I add your\n> Signed-off-by ?\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index 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\n> diff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h\n> index 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_; }","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 33FA160AF5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 19:08:18 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C17A272C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 19:08:17 +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=\"XL97AzvV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1588093698;\n\tbh=R9pu33mTQk7pwSjscSeMEd3ykWdJjmbXH9mx8FtP1zY=;\n\th=Date:From:To:Subject:References:In-Reply-To:From;\n\tb=XL97AzvVLuSo+3hEtiiLj4CLIgMPxZLehVl3KBbyd/1zi8A3lTnmVT1HEGPugBj6W\n\t8015GGGW/CucmCaWVolR1xLZyBw9f/CE7wxMeMPVaznEw4dLorLgxW6i1ONa8zrpkK\n\txwsLnWuxyvPr0v/sMafnm35zsb+AQgBiP4GBBx/0=","Date":"Tue, 28 Apr 2020 20:08:02 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200428170802.GI5859@pendragon.ideasonboard.com>","References":"<20200428170656.21789-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200428170656.21789-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [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":"Tue, 28 Apr 2020 17:08:18 -0000"}}]