[{"id":4590,"web_url":"https://patchwork.libcamera.org/comment/4590/","msgid":"<20200427230625.GC1165729@oden.dyn.berto.se>","date":"2020-04-27T23:06:25","subject":"Re: [libcamera-devel] [PATCH] libcamera: camera_sensor: Add model()\n\tfunction","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your patch.\n\nOn 2020-04-28 01:26:51 +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\nA quick test for me have this at \"`devname` `i2c-adapt`-`i2c-addr`\".\n\n> +\t * Assume this is the standard naming scheme and parse the first part\n> +\t * of the entity name to obtain \"devname\".\n\nWould it make sens to verify the full entity name to match our \nassumption of the format and fail if it does not match? I'm thinking \nfiling is better then reporting the wrong name due to our assumption \nabout format is off.\n\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_; }\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x242.google.com (mail-lj1-x242.google.com\n\t[IPv6:2a00:1450:4864:20::242])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 11C4360AF4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 01:06:27 +0200 (CEST)","by mail-lj1-x242.google.com with SMTP id b2so19411681ljp.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Apr 2020 16:06:27 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tp14sm12100755lfe.87.2020.04.27.16.06.25\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 27 Apr 2020 16:06:25 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com header.b=\"a1a5aFV5\"; \n\tdkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=sL1qBgjnJ7BzCJ308kwWo5oWBI9Uif6gpNp7ylsQ4o8=;\n\tb=a1a5aFV5p/oMW59OvetPm30yz3m+vK1LATdnH7T6klw4m91B7YH1gOJtQNvWk/hcGK\n\tnB081jFhVKEnR1opW2Xf4p7uk6NRXz0KVL5tJak1rVPgM3SMrgLztuev5qak663SncB0\n\tLYOK49+9GkUj/4c9f3H9eaiMq7z/BTLZf9rT1k9mjc2Z7wIUsA6WirdeizpqI/dKdjI8\n\t96lzb//cwBFi2QjTNyh4aklhXjXirq+Z0nLNTSzVk40rfWrf7Cr4WjnUdW5HYXPgoJok\n\tThsSMCwVFt5VFVBhepLzEBkyBVjFmfgr1LX1hPcU+pvcwJ/M3+1mbY13TOjI6IEQTkve\n\tdbBw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=sL1qBgjnJ7BzCJ308kwWo5oWBI9Uif6gpNp7ylsQ4o8=;\n\tb=SDg+iv3gstvmScrzGOR0q4OJspJ8PPsW/qy55BR2y1wiWNE2AmZO1zYTb+qofwsTht\n\t2yknO5hw3yQBeaQUUFW90tYDQAnrtDPPx4MKepoNFThQsBlk/8LslNlXIl0L5NFzJufx\n\tb/hPClRTBo5Coxx1xuL7CX618f3zHLuAXqZPVfi0kJeTKHYg5+nJ1bzilVk8PxbUkYQK\n\tt98rFrJ7/qp745975aEYtbwVruwbYbE8rOWOw2hMVJWCy5JvesHzSzjUMihgSIcdfOwN\n\t4MNunbIxlW1rXaciCoZUQ3XqgVUjQ17CCZFCsVgJXw/rkQ4S8lMV722xzaoguD9CMerJ\n\t6kUg==","X-Gm-Message-State":"AGi0PubnfQ/CuDtTvz+txZB2YK+iZ4nEhfiCLZ/x7sUufFrL6kDn/2C8\n\thXV6xKuB7d7QFcdg/Wwg2SoxUYQ/qRI=","X-Google-Smtp-Source":"APiQypKQM7s5vaktv8Wnnz9E9mRix0et9Pb4p/K6EtLijXhsWW/2maSQYeQu1NwHGguIE26/DtfK2g==","X-Received":"by 2002:a2e:8549:: with SMTP id u9mr14643472ljj.24.1588028786392;\n\tMon, 27 Apr 2020 16:06:26 -0700 (PDT)","Date":"Tue, 28 Apr 2020 01:06:25 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200427230625.GC1165729@oden.dyn.berto.se>","References":"<20200427222651.3987-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200427222651.3987-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":"Mon, 27 Apr 2020 23:06:27 -0000"}},{"id":4606,"web_url":"https://patchwork.libcamera.org/comment/4606/","msgid":"<20200428022844.GH3579@pendragon.ideasonboard.com>","date":"2020-04-28T02:28:44","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":"Hi Niklas,\n\nOn Tue, Apr 28, 2020 at 01:06:25AM +0200, Niklas Söderlund wrote:\n> On 2020-04-28 01:26:51 +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> \n> A quick test for me have this at \"`devname` `i2c-adapt`-`i2c-addr`\".\n\nCorrect.\n\n> > +\t * Assume this is the standard naming scheme and parse the first part\n> > +\t * of the entity name to obtain \"devname\".\n> \n> Would it make sens to verify the full entity name to match our \n> assumption of the format and fail if it does not match? I'm thinking \n> filing is better then reporting the wrong name due to our assumption \n> about format is off.\n\nWe already have a problem here with vimc, as we'll report \"Sensor\"\ninstead of \"Sensor B\". I'll fix it with a proper heuristic. After\nsleeping :-)\n\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 AD80E603F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 04:29:00 +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 2A16572C;\n\tTue, 28 Apr 2020 04:29:00 +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=\"h+Z1q9c7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1588040940;\n\tbh=R8DRfLQeRAK12MSDJ/mWgPHZQ92ET1rVjIdyqywFb2c=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=h+Z1q9c7Y95t3YxN13WmtlCQIab94j4p/850G3o86MCyO5NDAX4dj2g58R45K7pOq\n\tOyVSiq0bgD6ObDpNWUUPdvbwTKwVpQG4+aYMO8P9HxIjtPYnm4EAAzoE3oigowb6Sf\n\tdrnC9mtMwGRwcxymOdceztuzyIPM3IyPmPCdHTvw=","Date":"Tue, 28 Apr 2020 05:28:44 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200428022844.GH3579@pendragon.ideasonboard.com>","References":"<20200427222651.3987-1-laurent.pinchart@ideasonboard.com>\n\t<20200427230625.GC1165729@oden.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200427230625.GC1165729@oden.dyn.berto.se>","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 02:29:00 -0000"}},{"id":4607,"web_url":"https://patchwork.libcamera.org/comment/4607/","msgid":"<20200428070611.bxftskxbhg6ypirl@uno.localdomain>","date":"2020-04-28T07:06:11","subject":"Re: [libcamera-devel] [PATCH] libcamera: camera_sensor: Add model()\n\tfunction","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Tue, Apr 28, 2020 at 01:26:51AM +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\nYeah, no worries as you wish\n\nSpeaking of this patch, I'll rebase CameraSensorInfo to use this\nmethod as there discussed with you and Niklas.\n\nThanks\n  j\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_; }\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 86E4E603F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 09:03:02 +0200 (CEST)","from uno.localdomain (a-ur1-85.tin.it [212.216.150.148])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B3A594000B;\n\tTue, 28 Apr 2020 07:03:01 +0000 (UTC)"],"X-Originating-IP":"212.216.150.148","Date":"Tue, 28 Apr 2020 09:06:11 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200428070611.bxftskxbhg6ypirl@uno.localdomain>","References":"<20200427222651.3987-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200427222651.3987-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 07:03:02 -0000"}}]