[{"id":11926,"web_url":"https://patchwork.libcamera.org/comment/11926/","msgid":"<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>","date":"2020-08-06T13:28:04","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n\nOn Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n> Instead of only printing the camera ID which is not intended for humans\n> to read and parse create a more user friendly string when prating camera\n> names. The ID is still printed as it is one option used to select camera\n> using the --camera option.\n>\n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n>  1 file changed, 37 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> index cc3facd5a5b22092..5af76f6965ef2387 100644\n> --- a/src/cam/main.cpp\n> +++ b/src/cam/main.cpp\n> @@ -21,6 +21,39 @@\n>\n>  using namespace libcamera;\n>\n> +std::string cameraName(const Camera *camera)\n> +{\n> +\tconst ControlList &props = camera->properties();\n> +\tstd::string name;\n> +\n> +\tif (props.contains(properties::Model))\n> +\t\tname += props.get(properties::Model) + \" \";\n> +\n> +\tif (props.contains(properties::Location)) {\n> +\t\tswitch (props.get(properties::Location)) {\n> +\t\tcase properties::CameraLocationFront:\n> +\t\t\tname += \"facing front \";\n> +\t\t\tbreak;\n> +\t\tcase properties::CameraLocationBack:\n> +\t\t\tname += \"facing back \";\n> +\t\t\tbreak;\n> +\t\tcase properties::CameraLocationExternal:\n> +\t\t\tname += \"external \";\n> +\t\t\tbreak;\n> +\t\t}\n> +\t}\n> +\n> +\tif (props.contains(properties::Rotation))\n> +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n> +\n> +\tif (!name.empty())\n> +\t\tname += \"with id \";\n\nJust a quick question while skimming through the series. cam can\nprintout camera properties, do we need to make 'friendly' names\n100 characters to repeat what's already available there ?\n\n\n> +\n> +\tname += camera->id();\n> +\n> +\treturn name;\n> +}\n> +\n>  class CamApp\n>  {\n>  public:\n> @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n>  \t\t\treturn -EINVAL;\n>  \t\t}\n>\n> -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n> +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n>\n>  \t\tret = prepareConfig();\n>  \t\tif (ret) {\n> @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n>\n>  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n>  {\n> -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n> +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n>  }\n>\n>  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n>  {\n> -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n> +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n>  }\n>\n>  int CamApp::run()\n> @@ -340,7 +373,7 @@ int CamApp::run()\n>\n>  \t\tunsigned int index = 1;\n>  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n> -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n> +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n>  \t\t\tindex++;\n>  \t\t}\n>  \t}\n> --\n> 2.28.0\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E519BBD87A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Aug 2020 13:24:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8795760552;\n\tThu,  6 Aug 2020 15:24:26 +0200 (CEST)","from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D3E7E6038F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Aug 2020 15:24:24 +0200 (CEST)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 705051C000B;\n\tThu,  6 Aug 2020 13:24:24 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","Date":"Thu, 6 Aug 2020 15:28:04 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11928,"web_url":"https://patchwork.libcamera.org/comment/11928/","msgid":"<20200806133249.GK2712616@oden.dyn.berto.se>","date":"2020-08-06T13:32:49","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your feedback.\n\nOn 2020-08-06 15:28:04 +0200, Jacopo Mondi wrote:\n> Hi Niklas,\n> \n> On Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n> > Instead of only printing the camera ID which is not intended for humans\n> > to read and parse create a more user friendly string when prating camera\n> > names. The ID is still printed as it is one option used to select camera\n> > using the --camera option.\n> >\n> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > ---\n> >  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n> >  1 file changed, 37 insertions(+), 4 deletions(-)\n> >\n> > diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> > index cc3facd5a5b22092..5af76f6965ef2387 100644\n> > --- a/src/cam/main.cpp\n> > +++ b/src/cam/main.cpp\n> > @@ -21,6 +21,39 @@\n> >\n> >  using namespace libcamera;\n> >\n> > +std::string cameraName(const Camera *camera)\n> > +{\n> > +\tconst ControlList &props = camera->properties();\n> > +\tstd::string name;\n> > +\n> > +\tif (props.contains(properties::Model))\n> > +\t\tname += props.get(properties::Model) + \" \";\n> > +\n> > +\tif (props.contains(properties::Location)) {\n> > +\t\tswitch (props.get(properties::Location)) {\n> > +\t\tcase properties::CameraLocationFront:\n> > +\t\t\tname += \"facing front \";\n> > +\t\t\tbreak;\n> > +\t\tcase properties::CameraLocationBack:\n> > +\t\t\tname += \"facing back \";\n> > +\t\t\tbreak;\n> > +\t\tcase properties::CameraLocationExternal:\n> > +\t\t\tname += \"external \";\n> > +\t\t\tbreak;\n> > +\t\t}\n> > +\t}\n> > +\n> > +\tif (props.contains(properties::Rotation))\n> > +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n> > +\n> > +\tif (!name.empty())\n> > +\t\tname += \"with id \";\n> \n> Just a quick question while skimming through the series. cam can\n> printout camera properties, do we need to make 'friendly' names\n> 100 characters to repeat what's already available there ?\n\nI know it can print properties :-)\n\nI'm happy to change this to contain more or less information, my main \ngoal of throwing in everything here is to showcase with cam how \napplications can create names.\n\nWhat properties would you like to see make up the user-friendly name?\n\n> \n> \n> > +\n> > +\tname += camera->id();\n> > +\n> > +\treturn name;\n> > +}\n> > +\n> >  class CamApp\n> >  {\n> >  public:\n> > @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n> >  \t\t\treturn -EINVAL;\n> >  \t\t}\n> >\n> > -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n> > +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n> >\n> >  \t\tret = prepareConfig();\n> >  \t\tif (ret) {\n> > @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n> >\n> >  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n> >  {\n> > -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n> > +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n> >  }\n> >\n> >  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n> >  {\n> > -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n> > +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n> >  }\n> >\n> >  int CamApp::run()\n> > @@ -340,7 +373,7 @@ int CamApp::run()\n> >\n> >  \t\tunsigned int index = 1;\n> >  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n> > -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n> > +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n> >  \t\t\tindex++;\n> >  \t\t}\n> >  \t}\n> > --\n> > 2.28.0\n> >\n> > _______________________________________________\n> > libcamera-devel mailing list\n> > libcamera-devel@lists.libcamera.org\n> > https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E777CBD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Aug 2020 13:32:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AC9696071B;\n\tThu,  6 Aug 2020 15:32:52 +0200 (CEST)","from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com\n\t[IPv6:2a00:1450:4864:20::12e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3783E60552\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Aug 2020 15:32:51 +0200 (CEST)","by mail-lf1-x12e.google.com with SMTP id 140so26117759lfi.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 06 Aug 2020 06:32:51 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\t204sm2733999lfm.86.2020.08.06.06.32.49\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 06 Aug 2020 06:32:49 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"iGQDh0ZB\"; dkim-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=O71Fp64KqREq/RydDVi8S0J3gNXtaDRsIpFh1vqSETA=;\n\tb=iGQDh0ZBdrellY7BgELgMNwpwUExQ5870w6y6hGAHX20PpyCCUNQFkinkZdgwTEabL\n\tYgsYqL8rzSLXADzJgw30qbF+hp8YxUJOb1YKxtke0BEuVrOe9pf1IkhjE8FCcpi+SJGz\n\twS/943fEozSLDmig4f1DvXTSKFyhmcepcoe0WEUpzpuegITcfp9UIkwA/TK1NRuBKZWP\n\tATqx1WkvEofDfh3MZmxOLqfRxFlcf5+c1ts86KTsoHsLqaqKtczeTC/3JLhFvXq0Jqu5\n\to7bFd725sbAvsnUjP2hBeDbBK+d1HsFCbC1zdXV+E3N+EbOnHALEa0enpxf0WnkCRBTa\n\tJwlw==","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=O71Fp64KqREq/RydDVi8S0J3gNXtaDRsIpFh1vqSETA=;\n\tb=i59bAoLzFqud4GpKlXzOBD6bNNLsn8BHm5W68JPhI98VJDGnp8z5S4eRfzv22gd6Ry\n\t7NbGg3evUmyX+pIDD5In0fJ+J2/uz/nHj+ZCvFXlFFnUES2TiO34BKQws8HSIS7cy4PB\n\tAwrBfhNWAcpsC9uLtN7NqgHoFthqadfvuEYw5FPixSBvEnhKNUooPz2isrXDmYlUFqLN\n\tnAlbBClFcd0F/Psokvdm7G6kLM3lpFN9TUn/hvCuWvidjPSBmOjisSecDO3ZKtdHNb9K\n\ti98Qu2reEFMlmQUrTI1Ffv+KbvGjSrlgGguWfsoB4bmgiglRuWMQKBqBEIrftVCapQh7\n\t5/SQ==","X-Gm-Message-State":"AOAM531ED/p5BDVaGN6zQ/RcM0U98g61iUr6hOnmf+K4/1hTamp8VENj\n\tZhaezUlGoZC1XGk9LRbNK2gRHiEPbKk=","X-Google-Smtp-Source":"ABdhPJycNOgbzX9kl4Ljem0FMdPi3eq47sfZz4as5PWis/3XM6ohRGwGXLVjDjEtFU8OPxklTJCcSg==","X-Received":"by 2002:a19:86c3:: with SMTP id\n\ti186mr4108879lfd.59.1596720770473; \n\tThu, 06 Aug 2020 06:32:50 -0700 (PDT)","Date":"Thu, 6 Aug 2020 15:32:49 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200806133249.GK2712616@oden.dyn.berto.se>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>\n\t<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11929,"web_url":"https://patchwork.libcamera.org/comment/11929/","msgid":"<77170bb3-7772-7afd-cfa6-bedd8fb72b04@ideasonboard.com>","date":"2020-08-06T13:35:56","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Niklas,\n\nOn 06/08/2020 14:32, Niklas Söderlund wrote:\n> Hi Jacopo,\n> \n> Thanks for your feedback.\n> \n> On 2020-08-06 15:28:04 +0200, Jacopo Mondi wrote:\n>> Hi Niklas,\n>>\n>> On Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n>>> Instead of only printing the camera ID which is not intended for humans\n>>> to read and parse create a more user friendly string when prating camera\n>>> names. The ID is still printed as it is one option used to select camera\n>>> using the --camera option.\n>>>\n>>> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n>>> ---\n>>>  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n>>>  1 file changed, 37 insertions(+), 4 deletions(-)\n>>>\n>>> diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n>>> index cc3facd5a5b22092..5af76f6965ef2387 100644\n>>> --- a/src/cam/main.cpp\n>>> +++ b/src/cam/main.cpp\n>>> @@ -21,6 +21,39 @@\n>>>\n>>>  using namespace libcamera;\n>>>\n>>> +std::string cameraName(const Camera *camera)\n>>> +{\n>>> +\tconst ControlList &props = camera->properties();\n>>> +\tstd::string name;\n>>> +\n>>> +\tif (props.contains(properties::Model))\n>>> +\t\tname += props.get(properties::Model) + \" \";\n>>> +\n>>> +\tif (props.contains(properties::Location)) {\n>>> +\t\tswitch (props.get(properties::Location)) {\n>>> +\t\tcase properties::CameraLocationFront:\n>>> +\t\t\tname += \"facing front \";\n>>> +\t\t\tbreak;\n>>> +\t\tcase properties::CameraLocationBack:\n>>> +\t\t\tname += \"facing back \";\n>>> +\t\t\tbreak;\n>>> +\t\tcase properties::CameraLocationExternal:\n>>> +\t\t\tname += \"external \";\n>>> +\t\t\tbreak;\n>>> +\t\t}\n>>> +\t}\n>>> +\n>>> +\tif (props.contains(properties::Rotation))\n>>> +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n>>> +\n>>> +\tif (!name.empty())\n>>> +\t\tname += \"with id \";\n>>\n>> Just a quick question while skimming through the series. cam can\n>> printout camera properties, do we need to make 'friendly' names\n>> 100 characters to repeat what's already available there ?\n> \n> I know it can print properties :-)\n> \n> I'm happy to change this to contain more or less information, my main \n> goal of throwing in everything here is to showcase with cam how \n> applications can create names.\n> \n> What properties would you like to see make up the user-friendly name?\n\nI would say model and location would be enough.\nI don't think rotation or 'with id' should be there (though rendering\nthe id in the string is useful itself)\n\n--\nKieran\n\n> \n>>\n>>\n>>> +\n>>> +\tname += camera->id();\n>>> +\n>>> +\treturn name;\n>>> +}\n>>> +\n>>>  class CamApp\n>>>  {\n>>>  public:\n>>> @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n>>>  \t\t\treturn -EINVAL;\n>>>  \t\t}\n>>>\n>>> -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n>>> +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n>>>\n>>>  \t\tret = prepareConfig();\n>>>  \t\tif (ret) {\n>>> @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n>>>\n>>>  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n>>>  {\n>>> -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n>>> +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n>>>  }\n>>>\n>>>  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n>>>  {\n>>> -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n>>> +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n>>>  }\n>>>\n>>>  int CamApp::run()\n>>> @@ -340,7 +373,7 @@ int CamApp::run()\n>>>\n>>>  \t\tunsigned int index = 1;\n>>>  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n>>> -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n>>> +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n>>>  \t\t\tindex++;\n>>>  \t\t}\n>>>  \t}\n>>> --\n>>> 2.28.0\n>>>\n>>> _______________________________________________\n>>> libcamera-devel mailing list\n>>> libcamera-devel@lists.libcamera.org\n>>> https://lists.libcamera.org/listinfo/libcamera-devel\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C2655BD87A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Aug 2020 13:36:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4A81260C0A;\n\tThu,  6 Aug 2020 15:36:01 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F22C260552\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Aug 2020 15:35:59 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5F6FF50E;\n\tThu,  6 Aug 2020 15:35:59 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"iXHyiEjN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1596720959;\n\tbh=M0VycpTOec9Q/lqzKNnTOqbzMICrAvRjWVtNYQR8sdI=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=iXHyiEjNMSD8AoZMal4TTHngorF8Eo/8e0KVBmxhqdUOyJDvyPg7r22HqG7F0977i\n\tqMz64lJZXrjUPHrEKxhSZkxuwmAwm9rp5fDlweMvj0zNNZJhqImgZxwjp1fBBqEpwL\n\tbFGoMvO9VpYvYWLWcTHMVOE60qK5h7qF03COOu0Y=","To":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tJacopo Mondi <jacopo@jmondi.org>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>\n\t<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>\n\t<20200806133249.GK2712616@oden.dyn.berto.se>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\t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\n\tWZw01QYHU/GUV/zHJSFk","Organization":"Ideas on Board","Message-ID":"<77170bb3-7772-7afd-cfa6-bedd8fb72b04@ideasonboard.com>","Date":"Thu, 6 Aug 2020 14:35:56 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.10.0","MIME-Version":"1.0","In-Reply-To":"<20200806133249.GK2712616@oden.dyn.berto.se>","Content-Language":"en-GB","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Reply-To":"kieran.bingham@ideasonboard.com","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11930,"web_url":"https://patchwork.libcamera.org/comment/11930/","msgid":"<20200806134002.rk6lumfsaw4fnv4x@uno.localdomain>","date":"2020-08-06T13:40:02","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n\nOn Thu, Aug 06, 2020 at 03:32:49PM +0200, Niklas Söderlund wrote:\n> Hi Jacopo,\n>\n> Thanks for your feedback.\n>\n> On 2020-08-06 15:28:04 +0200, Jacopo Mondi wrote:\n> > Hi Niklas,\n> >\n> > On Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n> > > Instead of only printing the camera ID which is not intended for humans\n> > > to read and parse create a more user friendly string when prating camera\n> > > names. The ID is still printed as it is one option used to select camera\n> > > using the --camera option.\n> > >\n> > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > > ---\n> > >  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n> > >  1 file changed, 37 insertions(+), 4 deletions(-)\n> > >\n> > > diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> > > index cc3facd5a5b22092..5af76f6965ef2387 100644\n> > > --- a/src/cam/main.cpp\n> > > +++ b/src/cam/main.cpp\n> > > @@ -21,6 +21,39 @@\n> > >\n> > >  using namespace libcamera;\n> > >\n> > > +std::string cameraName(const Camera *camera)\n> > > +{\n> > > +\tconst ControlList &props = camera->properties();\n> > > +\tstd::string name;\n> > > +\n> > > +\tif (props.contains(properties::Model))\n> > > +\t\tname += props.get(properties::Model) + \" \";\n> > > +\n> > > +\tif (props.contains(properties::Location)) {\n> > > +\t\tswitch (props.get(properties::Location)) {\n> > > +\t\tcase properties::CameraLocationFront:\n> > > +\t\t\tname += \"facing front \";\n> > > +\t\t\tbreak;\n> > > +\t\tcase properties::CameraLocationBack:\n> > > +\t\t\tname += \"facing back \";\n> > > +\t\t\tbreak;\n> > > +\t\tcase properties::CameraLocationExternal:\n> > > +\t\t\tname += \"external \";\n> > > +\t\t\tbreak;\n> > > +\t\t}\n> > > +\t}\n> > > +\n> > > +\tif (props.contains(properties::Rotation))\n> > > +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n> > > +\n> > > +\tif (!name.empty())\n> > > +\t\tname += \"with id \";\n> >\n> > Just a quick question while skimming through the series. cam can\n> > printout camera properties, do we need to make 'friendly' names\n> > 100 characters to repeat what's already available there ?\n>\n> I know it can print properties :-)\n>\n> I'm happy to change this to contain more or less information, my main\n> goal of throwing in everything here is to showcase with cam how\n> applications can create names.\n>\n> What properties would you like to see make up the user-friendly name?\n\nNone if not useful to distinguish between cameras with the same name ?\n\nie\n        1- ov5670 (front)\n        2- ov5670 (back)\n\nI know we could have\n        1- ov5670 (external)\n        2- ov5670 (external)\n\nbut at that point, I think we've done the best we could\n\n>\n> >\n> >\n> > > +\n> > > +\tname += camera->id();\n> > > +\n> > > +\treturn name;\n> > > +}\n> > > +\n> > >  class CamApp\n> > >  {\n> > >  public:\n> > > @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n> > >  \t\t\treturn -EINVAL;\n> > >  \t\t}\n> > >\n> > > -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n> > > +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n> > >\n> > >  \t\tret = prepareConfig();\n> > >  \t\tif (ret) {\n> > > @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n> > >\n> > >  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n> > >  {\n> > > -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n> > > +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n> > >  }\n> > >\n> > >  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n> > >  {\n> > > -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n> > > +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n> > >  }\n> > >\n> > >  int CamApp::run()\n> > > @@ -340,7 +373,7 @@ int CamApp::run()\n> > >\n> > >  \t\tunsigned int index = 1;\n> > >  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n> > > -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n> > > +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n> > >  \t\t\tindex++;\n> > >  \t\t}\n> > >  \t}\n> > > --\n> > > 2.28.0\n> > >\n> > > _______________________________________________\n> > > libcamera-devel mailing list\n> > > libcamera-devel@lists.libcamera.org\n> > > https://lists.libcamera.org/listinfo/libcamera-devel\n>\n> --\n> Regards,\n> Niklas Söderlund","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0F867BD87A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Aug 2020 13:36:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D12586098D;\n\tThu,  6 Aug 2020 15:36:23 +0200 (CEST)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4967C60552\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Aug 2020 15:36:22 +0200 (CEST)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id DAC62240004;\n\tThu,  6 Aug 2020 13:36:21 +0000 (UTC)"],"Date":"Thu, 6 Aug 2020 15:40:02 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200806134002.rk6lumfsaw4fnv4x@uno.localdomain>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>\n\t<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>\n\t<20200806133249.GK2712616@oden.dyn.berto.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200806133249.GK2712616@oden.dyn.berto.se>","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11931,"web_url":"https://patchwork.libcamera.org/comment/11931/","msgid":"<20200806134601.GL2712616@oden.dyn.berto.se>","date":"2020-08-06T13:46:01","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nOn 2020-08-06 15:40:02 +0200, Jacopo Mondi wrote:\n> Hi Niklas,\n> \n> On Thu, Aug 06, 2020 at 03:32:49PM +0200, Niklas Söderlund wrote:\n> > Hi Jacopo,\n> >\n> > Thanks for your feedback.\n> >\n> > On 2020-08-06 15:28:04 +0200, Jacopo Mondi wrote:\n> > > Hi Niklas,\n> > >\n> > > On Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n> > > > Instead of only printing the camera ID which is not intended for humans\n> > > > to read and parse create a more user friendly string when prating camera\n> > > > names. The ID is still printed as it is one option used to select camera\n> > > > using the --camera option.\n> > > >\n> > > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > > > ---\n> > > >  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n> > > >  1 file changed, 37 insertions(+), 4 deletions(-)\n> > > >\n> > > > diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> > > > index cc3facd5a5b22092..5af76f6965ef2387 100644\n> > > > --- a/src/cam/main.cpp\n> > > > +++ b/src/cam/main.cpp\n> > > > @@ -21,6 +21,39 @@\n> > > >\n> > > >  using namespace libcamera;\n> > > >\n> > > > +std::string cameraName(const Camera *camera)\n> > > > +{\n> > > > +\tconst ControlList &props = camera->properties();\n> > > > +\tstd::string name;\n> > > > +\n> > > > +\tif (props.contains(properties::Model))\n> > > > +\t\tname += props.get(properties::Model) + \" \";\n> > > > +\n> > > > +\tif (props.contains(properties::Location)) {\n> > > > +\t\tswitch (props.get(properties::Location)) {\n> > > > +\t\tcase properties::CameraLocationFront:\n> > > > +\t\t\tname += \"facing front \";\n> > > > +\t\t\tbreak;\n> > > > +\t\tcase properties::CameraLocationBack:\n> > > > +\t\t\tname += \"facing back \";\n> > > > +\t\t\tbreak;\n> > > > +\t\tcase properties::CameraLocationExternal:\n> > > > +\t\t\tname += \"external \";\n> > > > +\t\t\tbreak;\n> > > > +\t\t}\n> > > > +\t}\n> > > > +\n> > > > +\tif (props.contains(properties::Rotation))\n> > > > +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n> > > > +\n> > > > +\tif (!name.empty())\n> > > > +\t\tname += \"with id \";\n> > >\n> > > Just a quick question while skimming through the series. cam can\n> > > printout camera properties, do we need to make 'friendly' names\n> > > 100 characters to repeat what's already available there ?\n> >\n> > I know it can print properties :-)\n> >\n> > I'm happy to change this to contain more or less information, my main\n> > goal of throwing in everything here is to showcase with cam how\n> > applications can create names.\n> >\n> > What properties would you like to see make up the user-friendly name?\n> \n> None if not useful to distinguish between cameras with the same name ?\n> \n> ie\n>         1- ov5670 (front)\n>         2- ov5670 (back)\n> \n> I know we could have\n>         1- ov5670 (external)\n>         2- ov5670 (external)\n\nI like this and will use it for next version.\n\nBut I really think we need to print the id as well as it is one of two \npossible augments to --camera to select which one is used. How about\n\n    1: ov5695 (front) - /base/i2c@ff160000/camera@36\n    2: ov2685 (back) - /base/i2c@ff160000/camera@3c\n\n?\n\n> \n> but at that point, I think we've done the best we could\n\n> \n> >\n> > >\n> > >\n> > > > +\n> > > > +\tname += camera->id();\n> > > > +\n> > > > +\treturn name;\n> > > > +}\n> > > > +\n> > > >  class CamApp\n> > > >  {\n> > > >  public:\n> > > > @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n> > > >  \t\t\treturn -EINVAL;\n> > > >  \t\t}\n> > > >\n> > > > -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n> > > > +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n> > > >\n> > > >  \t\tret = prepareConfig();\n> > > >  \t\tif (ret) {\n> > > > @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n> > > >\n> > > >  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n> > > >  {\n> > > > -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n> > > > +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n> > > >  }\n> > > >\n> > > >  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n> > > >  {\n> > > > -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n> > > > +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n> > > >  }\n> > > >\n> > > >  int CamApp::run()\n> > > > @@ -340,7 +373,7 @@ int CamApp::run()\n> > > >\n> > > >  \t\tunsigned int index = 1;\n> > > >  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n> > > > -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n> > > > +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n> > > >  \t\t\tindex++;\n> > > >  \t\t}\n> > > >  \t}\n> > > > --\n> > > > 2.28.0\n> > > >\n> > > > _______________________________________________\n> > > > libcamera-devel mailing list\n> > > > libcamera-devel@lists.libcamera.org\n> > > > https://lists.libcamera.org/listinfo/libcamera-devel\n> >\n> > --\n> > Regards,\n> > Niklas Söderlund","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C2876BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Aug 2020 13:46:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 34F056098D;\n\tThu,  6 Aug 2020 15:46:05 +0200 (CEST)","from mail-lj1-x243.google.com (mail-lj1-x243.google.com\n\t[IPv6:2a00:1450:4864:20::243])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CD70360552\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Aug 2020 15:46:03 +0200 (CEST)","by mail-lj1-x243.google.com with SMTP id x9so51869456ljc.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 06 Aug 2020 06:46:03 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tm25sm2462821ljg.79.2020.08.06.06.46.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 06 Aug 2020 06:46:01 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"AEfXFi7u\"; dkim-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=2f/qM7BpD1ZGDcRj+h/FSUSOgvlT0vezQmUqpEtKr0o=;\n\tb=AEfXFi7uPb6fFKVXY3cVaiFYziDYyLqv1v0QzI1SokTXzrFDpFfS/in94lmpTQALlX\n\tZjNOShxBqHt+SvNVaiOMYY4TPxh7bpvogX3Q4OIXnfEOpLOlaafknV2Ho7kzntD24nRi\n\tZCIYrURzRt4ugTNvLAyVkJCLBjmCLnalBQXpLtFn6YzxX89KUkh5m5YwEIfj0W7MisCL\n\t7o/PgB2heq4b3lJgd1lHhqgoDTgIcqks5Zwj9yDDux54qP4N682mNcRmjCftxexx7bN1\n\t+hzcWVebfJPRQsrtCVEPRfx+dFEFEH9uTbM/DjFobCGW9Z68ULjtoVYKTUyU/UC+7Qee\n\tovOg==","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=2f/qM7BpD1ZGDcRj+h/FSUSOgvlT0vezQmUqpEtKr0o=;\n\tb=XfZobnboEYPlFHTyIVwO79V1bci1lHdj7yQiBloanIyq2RviCm6o13h073Ln5zKXqq\n\tMyijK3VWXQUHMItAFfMd4AAVDFpCfkO3qlt7Y4nfpjvGbsmUSyLsr8aR+d2Gh2HZQHI6\n\th3u/iQUmodM2liGoHdQxT+aN1DSE+dX+aTBQ4S5uxKbJ7lZi7RL/hFOFG9ojtCU6GDN9\n\tFgcwtDCJKE9J5PSHdb62hDzrl8bDCpDBZH9ml1Gnstcp19nP4u7DGoevnm83JCCFWgR3\n\tnJwhr/yfEC0lDGfJrGPYzNknXM0CiTuXUEXNE/Mll53U+2h5FDhr3a+9m9kl1KqC9Zky\n\t8n1A==","X-Gm-Message-State":"AOAM530YmLeLgBWffYG8N1eIYxymkLd2LC3iQi76ULHbCC54Kccb9S37\n\tp3h6lrTzKI1pAvIn69U+/Kce6Z+tlfg=","X-Google-Smtp-Source":"ABdhPJy3jesdzLs3bnvtDsfNC3953kCdiYfktrr7iJpoOMWaLAGgveuhRgeIkvsEl7KbuEHjw2ktqg==","X-Received":"by 2002:a2e:b619:: with SMTP id\n\tr25mr4268790ljn.220.1596721563110; \n\tThu, 06 Aug 2020 06:46:03 -0700 (PDT)","Date":"Thu, 6 Aug 2020 15:46:01 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200806134601.GL2712616@oden.dyn.berto.se>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>\n\t<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>\n\t<20200806133249.GK2712616@oden.dyn.berto.se>\n\t<20200806134002.rk6lumfsaw4fnv4x@uno.localdomain>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200806134002.rk6lumfsaw4fnv4x@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11933,"web_url":"https://patchwork.libcamera.org/comment/11933/","msgid":"<fee543a9-7f93-01c9-b0a4-41b714584f2f@ideasonboard.com>","date":"2020-08-06T14:35:34","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Niklas,\n\n\nOn 06/08/2020 14:46, Niklas Söderlund wrote:\n> Hi Jacopo,\n> \n> On 2020-08-06 15:40:02 +0200, Jacopo Mondi wrote:\n>> Hi Niklas,\n>>\n>> On Thu, Aug 06, 2020 at 03:32:49PM +0200, Niklas Söderlund wrote:\n>>> Hi Jacopo,\n>>>\n>>> Thanks for your feedback.\n>>>\n>>> On 2020-08-06 15:28:04 +0200, Jacopo Mondi wrote:\n>>>> Hi Niklas,\n>>>>\n>>>> On Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n>>>>> Instead of only printing the camera ID which is not intended for humans\n>>>>> to read and parse create a more user friendly string when prating camera\n>>>>> names. The ID is still printed as it is one option used to select camera\n>>>>> using the --camera option.\n>>>>>\n>>>>> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n>>>>> ---\n>>>>>  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n>>>>>  1 file changed, 37 insertions(+), 4 deletions(-)\n>>>>>\n>>>>> diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n>>>>> index cc3facd5a5b22092..5af76f6965ef2387 100644\n>>>>> --- a/src/cam/main.cpp\n>>>>> +++ b/src/cam/main.cpp\n>>>>> @@ -21,6 +21,39 @@\n>>>>>\n>>>>>  using namespace libcamera;\n>>>>>\n>>>>> +std::string cameraName(const Camera *camera)\n>>>>> +{\n>>>>> +\tconst ControlList &props = camera->properties();\n>>>>> +\tstd::string name;\n>>>>> +\n>>>>> +\tif (props.contains(properties::Model))\n>>>>> +\t\tname += props.get(properties::Model) + \" \";\n>>>>> +\n>>>>> +\tif (props.contains(properties::Location)) {\n>>>>> +\t\tswitch (props.get(properties::Location)) {\n>>>>> +\t\tcase properties::CameraLocationFront:\n>>>>> +\t\t\tname += \"facing front \";\n>>>>> +\t\t\tbreak;\n>>>>> +\t\tcase properties::CameraLocationBack:\n>>>>> +\t\t\tname += \"facing back \";\n>>>>> +\t\t\tbreak;\n>>>>> +\t\tcase properties::CameraLocationExternal:\n>>>>> +\t\t\tname += \"external \";\n>>>>> +\t\t\tbreak;\n>>>>> +\t\t}\n>>>>> +\t}\n>>>>> +\n>>>>> +\tif (props.contains(properties::Rotation))\n>>>>> +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n>>>>> +\n>>>>> +\tif (!name.empty())\n>>>>> +\t\tname += \"with id \";\n>>>>\n>>>> Just a quick question while skimming through the series. cam can\n>>>> printout camera properties, do we need to make 'friendly' names\n>>>> 100 characters to repeat what's already available there ?\n>>>\n>>> I know it can print properties :-)\n>>>\n>>> I'm happy to change this to contain more or less information, my main\n>>> goal of throwing in everything here is to showcase with cam how\n>>> applications can create names.\n>>>\n>>> What properties would you like to see make up the user-friendly name?\n>>\n>> None if not useful to distinguish between cameras with the same name ?\n>>\n>> ie\n>>         1- ov5670 (front)\n>>         2- ov5670 (back)\n>>\n>> I know we could have\n>>         1- ov5670 (external)\n>>         2- ov5670 (external)\n> \n> I like this and will use it for next version.\n> \n> But I really think we need to print the id as well as it is one of two \n> possible augments to --camera to select which one is used. How about\n> \n>     1: ov5695 (front) - /base/i2c@ff160000/camera@36\n>     2: ov2685 (back) - /base/i2c@ff160000/camera@3c\n\nI know we can reference cameras by index, but when referencing by name,\ndoes this mean the user would have to type/paste the whole line? or will\nit match on first unique match?\n\ncam -C -c \"ov2685 (back)\"\n\nis almost friendly enough to type ...\n\ncam -C -c \"ov2685 (back) - /base/i2c@ff160000/camera@3c\" is not\nsomething anyone is going to be willing to type by hand.\n\nMaybe that's not a problem if it's not a design consideration anyway.\n\n--\nKieran\n\n> \n> ?\n> \n>>\n>> but at that point, I think we've done the best we could\n> \n>>\n>>>\n>>>>\n>>>>\n>>>>> +\n>>>>> +\tname += camera->id();\n>>>>> +\n>>>>> +\treturn name;\n>>>>> +}\n>>>>> +\n>>>>>  class CamApp\n>>>>>  {\n>>>>>  public:\n>>>>> @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n>>>>>  \t\t\treturn -EINVAL;\n>>>>>  \t\t}\n>>>>>\n>>>>> -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n>>>>> +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n>>>>>\n>>>>>  \t\tret = prepareConfig();\n>>>>>  \t\tif (ret) {\n>>>>> @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n>>>>>\n>>>>>  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n>>>>>  {\n>>>>> -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n>>>>> +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n>>>>>  }\n>>>>>\n>>>>>  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n>>>>>  {\n>>>>> -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n>>>>> +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n>>>>>  }\n>>>>>\n>>>>>  int CamApp::run()\n>>>>> @@ -340,7 +373,7 @@ int CamApp::run()\n>>>>>\n>>>>>  \t\tunsigned int index = 1;\n>>>>>  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n>>>>> -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n>>>>> +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n>>>>>  \t\t\tindex++;\n>>>>>  \t\t}\n>>>>>  \t}\n>>>>> --\n>>>>> 2.28.0\n>>>>>\n>>>>> _______________________________________________\n>>>>> libcamera-devel mailing list\n>>>>> libcamera-devel@lists.libcamera.org\n>>>>> https://lists.libcamera.org/listinfo/libcamera-devel\n>>>\n>>> --\n>>> Regards,\n>>> Niklas Söderlund\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 84DADBD87A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Aug 2020 14:35:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0A26160C3C;\n\tThu,  6 Aug 2020 16:35:39 +0200 (CEST)","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 95DAD60495\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Aug 2020 16:35:37 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 03BB850E;\n\tThu,  6 Aug 2020 16:35:36 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"JWJAyOYS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1596724537;\n\tbh=tHOOijdrkS3BE0PskD+MLowjE3FSLviVRzKUMlc/PEA=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=JWJAyOYSqIYopNH/3nDWU2B3gj8xOKLBoMm/Qe72J+IJiSoC7ZxFq0v9uMBP0nJOt\n\tz7+jeQYbnsvvIb1goPHeRW+sOCQVUC3WG7tJC5XM8CcKpXdBj2HfiUIG1ojeKo2/uh\n\tj7s5xKGkyT/E7wCpO19tbwuj7x9kAIpEy0KMqD3A=","To":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tJacopo Mondi <jacopo@jmondi.org>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>\n\t<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>\n\t<20200806133249.GK2712616@oden.dyn.berto.se>\n\t<20200806134002.rk6lumfsaw4fnv4x@uno.localdomain>\n\t<20200806134601.GL2712616@oden.dyn.berto.se>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\t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\n\tWZw01QYHU/GUV/zHJSFk","Organization":"Ideas on Board","Message-ID":"<fee543a9-7f93-01c9-b0a4-41b714584f2f@ideasonboard.com>","Date":"Thu, 6 Aug 2020 15:35:34 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.10.0","MIME-Version":"1.0","In-Reply-To":"<20200806134601.GL2712616@oden.dyn.berto.se>","Content-Language":"en-GB","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Reply-To":"kieran.bingham@ideasonboard.com","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11934,"web_url":"https://patchwork.libcamera.org/comment/11934/","msgid":"<20200806144608.GA3387836@oden.dyn.berto.se>","date":"2020-08-06T14:46:08","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Kieran,\n\nOn 2020-08-06 15:35:34 +0100, Kieran Bingham wrote:\n> Hi Niklas,\n> \n> \n> On 06/08/2020 14:46, Niklas Söderlund wrote:\n> > Hi Jacopo,\n> > \n> > On 2020-08-06 15:40:02 +0200, Jacopo Mondi wrote:\n> >> Hi Niklas,\n> >>\n> >> On Thu, Aug 06, 2020 at 03:32:49PM +0200, Niklas Söderlund wrote:\n> >>> Hi Jacopo,\n> >>>\n> >>> Thanks for your feedback.\n> >>>\n> >>> On 2020-08-06 15:28:04 +0200, Jacopo Mondi wrote:\n> >>>> Hi Niklas,\n> >>>>\n> >>>> On Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n> >>>>> Instead of only printing the camera ID which is not intended for humans\n> >>>>> to read and parse create a more user friendly string when prating camera\n> >>>>> names. The ID is still printed as it is one option used to select camera\n> >>>>> using the --camera option.\n> >>>>>\n> >>>>> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> >>>>> ---\n> >>>>>  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n> >>>>>  1 file changed, 37 insertions(+), 4 deletions(-)\n> >>>>>\n> >>>>> diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> >>>>> index cc3facd5a5b22092..5af76f6965ef2387 100644\n> >>>>> --- a/src/cam/main.cpp\n> >>>>> +++ b/src/cam/main.cpp\n> >>>>> @@ -21,6 +21,39 @@\n> >>>>>\n> >>>>>  using namespace libcamera;\n> >>>>>\n> >>>>> +std::string cameraName(const Camera *camera)\n> >>>>> +{\n> >>>>> +\tconst ControlList &props = camera->properties();\n> >>>>> +\tstd::string name;\n> >>>>> +\n> >>>>> +\tif (props.contains(properties::Model))\n> >>>>> +\t\tname += props.get(properties::Model) + \" \";\n> >>>>> +\n> >>>>> +\tif (props.contains(properties::Location)) {\n> >>>>> +\t\tswitch (props.get(properties::Location)) {\n> >>>>> +\t\tcase properties::CameraLocationFront:\n> >>>>> +\t\t\tname += \"facing front \";\n> >>>>> +\t\t\tbreak;\n> >>>>> +\t\tcase properties::CameraLocationBack:\n> >>>>> +\t\t\tname += \"facing back \";\n> >>>>> +\t\t\tbreak;\n> >>>>> +\t\tcase properties::CameraLocationExternal:\n> >>>>> +\t\t\tname += \"external \";\n> >>>>> +\t\t\tbreak;\n> >>>>> +\t\t}\n> >>>>> +\t}\n> >>>>> +\n> >>>>> +\tif (props.contains(properties::Rotation))\n> >>>>> +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n> >>>>> +\n> >>>>> +\tif (!name.empty())\n> >>>>> +\t\tname += \"with id \";\n> >>>>\n> >>>> Just a quick question while skimming through the series. cam can\n> >>>> printout camera properties, do we need to make 'friendly' names\n> >>>> 100 characters to repeat what's already available there ?\n> >>>\n> >>> I know it can print properties :-)\n> >>>\n> >>> I'm happy to change this to contain more or less information, my main\n> >>> goal of throwing in everything here is to showcase with cam how\n> >>> applications can create names.\n> >>>\n> >>> What properties would you like to see make up the user-friendly name?\n> >>\n> >> None if not useful to distinguish between cameras with the same name ?\n> >>\n> >> ie\n> >>         1- ov5670 (front)\n> >>         2- ov5670 (back)\n> >>\n> >> I know we could have\n> >>         1- ov5670 (external)\n> >>         2- ov5670 (external)\n> > \n> > I like this and will use it for next version.\n> > \n> > But I really think we need to print the id as well as it is one of two \n> > possible augments to --camera to select which one is used. How about\n> > \n> >     1: ov5695 (front) - /base/i2c@ff160000/camera@36\n> >     2: ov2685 (back) - /base/i2c@ff160000/camera@3c\n> \n> I know we can reference cameras by index, but when referencing by name,\n> does this mean the user would have to type/paste the whole line? or will\n> it match on first unique match?\n> \n> cam -C -c \"ov2685 (back)\"\n> \n> is almost friendly enough to type ...\n> \n> cam -C -c \"ov2685 (back) - /base/i2c@ff160000/camera@3c\" is not\n> something anyone is going to be willing to type by hand.\n> \n> Maybe that's not a problem if it's not a design consideration anyway.\n\nNo the two ways we can specify cameras today using the --camera option \nare not changed in by this series, so the options are by index or id. So \nto select the \"ov2685 (back)\" from the example above there are two \noptions,\n\n    $ cam --camera 2 ...\n    $ cam --camera /base/i2c@ff160000/camera@3c ...\n\nWhere doing it by index is not stable as if we plug in a third camera \nthe ordering may change while using the id is guaranteed to be stable, \neven between reboots of the system. One of the ides of the id is that it \ncould be save to persistent storage and reread later and expect to get \nthe same camera.\n\nIn my automated tests for example I use the id to make sure I always \ntest the camera I expect to test.\n\n> \n> --\n> Kieran\n> \n> > \n> > ?\n> > \n> >>\n> >> but at that point, I think we've done the best we could\n> > \n> >>\n> >>>\n> >>>>\n> >>>>\n> >>>>> +\n> >>>>> +\tname += camera->id();\n> >>>>> +\n> >>>>> +\treturn name;\n> >>>>> +}\n> >>>>> +\n> >>>>>  class CamApp\n> >>>>>  {\n> >>>>>  public:\n> >>>>> @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n> >>>>>  \t\t\treturn -EINVAL;\n> >>>>>  \t\t}\n> >>>>>\n> >>>>> -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n> >>>>> +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n> >>>>>\n> >>>>>  \t\tret = prepareConfig();\n> >>>>>  \t\tif (ret) {\n> >>>>> @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n> >>>>>\n> >>>>>  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n> >>>>>  {\n> >>>>> -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n> >>>>> +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n> >>>>>  }\n> >>>>>\n> >>>>>  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n> >>>>>  {\n> >>>>> -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n> >>>>> +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n> >>>>>  }\n> >>>>>\n> >>>>>  int CamApp::run()\n> >>>>> @@ -340,7 +373,7 @@ int CamApp::run()\n> >>>>>\n> >>>>>  \t\tunsigned int index = 1;\n> >>>>>  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n> >>>>> -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n> >>>>> +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n> >>>>>  \t\t\tindex++;\n> >>>>>  \t\t}\n> >>>>>  \t}\n> >>>>> --\n> >>>>> 2.28.0\n> >>>>>\n> >>>>> _______________________________________________\n> >>>>> libcamera-devel mailing list\n> >>>>> libcamera-devel@lists.libcamera.org\n> >>>>> https://lists.libcamera.org/listinfo/libcamera-devel\n> >>>\n> >>> --\n> >>> Regards,\n> >>> Niklas Söderlund\n> > \n> \n> -- \n> Regards\n> --\n> Kieran","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A2C53BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Aug 2020 14:46:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2904B60CAE;\n\tThu,  6 Aug 2020 16:46:12 +0200 (CEST)","from mail-lf1-x142.google.com (mail-lf1-x142.google.com\n\t[IPv6:2a00:1450:4864:20::142])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3FA2C60552\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Aug 2020 16:46:10 +0200 (CEST)","by mail-lf1-x142.google.com with SMTP id i19so26234458lfj.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 06 Aug 2020 07:46:10 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tu21sm2519773ljl.11.2020.08.06.07.46.08\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 06 Aug 2020 07:46:08 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"fGq9jboO\"; dkim-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=n2FERkypZKwYsvHxPwfioNUHCr4rRv4TnaHuHx4WzJQ=;\n\tb=fGq9jboOPSt4kwqbgGXa8K0Wc9/PGUlwj9W8QMUi8W7EINGVOiNyw8UoBM1YU5plEP\n\tp5Vae00UUscTUZB0URtI65Ll9dfqbFyeBwgGW4i9q6Fv22BwPTZN9Ikp45HjNTnjwSU6\n\t1+4lVnpfU5KFDUlNbXWYTjGLx6r61jRSE7qpW/4EGh6pHIk8K7Q3KLpMu7lR+biO9UcY\n\tVFvGxDzx6Ia56nrAzNPPk0Jn07Ke7zuhmIwNriD5fWLZ5li27M8/xzS/LgzU3NvHoBKJ\n\tUs15WouNdGdexl5dt4e/6zpNVg4TS9J5ljtnqDOcAeZXx7X+5oJ8feDdUwXgTurkL5dK\n\trf4w==","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=n2FERkypZKwYsvHxPwfioNUHCr4rRv4TnaHuHx4WzJQ=;\n\tb=NOl5+HqAOSvwEBWj2aFf3SKbUkPBIH0y7TbdEmNLgpxLpQPeRjneFDIUcd39oQxIUX\n\tEi7x/moE1zOpYAQIkUgHHEPBVrHLHVD2vmI+IfpsMtfwgp3dYw+ZJxABOTKipFDTa2Fk\n\tKthhDHA7NQSTwzvNIwkjdM4/xEhEh3H+9DjLuYW0AYGk1BJBLaig8nBcrEPsRVMjyROr\n\tbJvPZtbImJCkEYkfQQcXQJNXjEmzWNqKMQALOsF84QlHoVM5gaOikuSO2hvvZoptWINq\n\txVgLYP64mqCRIs086z+AjWK3FsYKT+X9IzTotjgutJ07TecTOZ79UzQQXuzOlrwAA3B/\n\t+twQ==","X-Gm-Message-State":"AOAM531QXl9TYnkxalfOisqlWLyZ9tL+N+gFZDLFsWKXpREBbIAt/+UK\n\tHezVULdiX3hbpz3DASL/jDOO9A==","X-Google-Smtp-Source":"ABdhPJwjdqJvy56/f+Shpu2uIOT4elhNwBX8JU8B4HOwpPcPZyYfu9xC5bHd3XMUjeJWxn7ave8yqg==","X-Received":"by 2002:a19:8015:: with SMTP id\n\tb21mr4036429lfd.206.1596725169502; \n\tThu, 06 Aug 2020 07:46:09 -0700 (PDT)","Date":"Thu, 6 Aug 2020 16:46:08 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20200806144608.GA3387836@oden.dyn.berto.se>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>\n\t<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>\n\t<20200806133249.GK2712616@oden.dyn.berto.se>\n\t<20200806134002.rk6lumfsaw4fnv4x@uno.localdomain>\n\t<20200806134601.GL2712616@oden.dyn.berto.se>\n\t<fee543a9-7f93-01c9-b0a4-41b714584f2f@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<fee543a9-7f93-01c9-b0a4-41b714584f2f@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11936,"web_url":"https://patchwork.libcamera.org/comment/11936/","msgid":"<20200806150634.o3zqjomrorzk4tup@uno.localdomain>","date":"2020-08-06T15:06:34","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n\nOn Thu, Aug 06, 2020 at 03:46:01PM +0200, Niklas Söderlund wrote:\n> Hi Jacopo,\n>\n> On 2020-08-06 15:40:02 +0200, Jacopo Mondi wrote:\n> > Hi Niklas,\n> >\n> > On Thu, Aug 06, 2020 at 03:32:49PM +0200, Niklas Söderlund wrote:\n> > > Hi Jacopo,\n> > >\n> > > Thanks for your feedback.\n> > >\n> > > On 2020-08-06 15:28:04 +0200, Jacopo Mondi wrote:\n> > > > Hi Niklas,\n> > > >\n> > > > On Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n> > > > > Instead of only printing the camera ID which is not intended for humans\n> > > > > to read and parse create a more user friendly string when prating camera\n> > > > > names. The ID is still printed as it is one option used to select camera\n> > > > > using the --camera option.\n> > > > >\n> > > > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > > > > ---\n> > > > >  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n> > > > >  1 file changed, 37 insertions(+), 4 deletions(-)\n> > > > >\n> > > > > diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> > > > > index cc3facd5a5b22092..5af76f6965ef2387 100644\n> > > > > --- a/src/cam/main.cpp\n> > > > > +++ b/src/cam/main.cpp\n> > > > > @@ -21,6 +21,39 @@\n> > > > >\n> > > > >  using namespace libcamera;\n> > > > >\n> > > > > +std::string cameraName(const Camera *camera)\n> > > > > +{\n> > > > > +\tconst ControlList &props = camera->properties();\n> > > > > +\tstd::string name;\n> > > > > +\n> > > > > +\tif (props.contains(properties::Model))\n> > > > > +\t\tname += props.get(properties::Model) + \" \";\n> > > > > +\n> > > > > +\tif (props.contains(properties::Location)) {\n> > > > > +\t\tswitch (props.get(properties::Location)) {\n> > > > > +\t\tcase properties::CameraLocationFront:\n> > > > > +\t\t\tname += \"facing front \";\n> > > > > +\t\t\tbreak;\n> > > > > +\t\tcase properties::CameraLocationBack:\n> > > > > +\t\t\tname += \"facing back \";\n> > > > > +\t\t\tbreak;\n> > > > > +\t\tcase properties::CameraLocationExternal:\n> > > > > +\t\t\tname += \"external \";\n> > > > > +\t\t\tbreak;\n> > > > > +\t\t}\n> > > > > +\t}\n> > > > > +\n> > > > > +\tif (props.contains(properties::Rotation))\n> > > > > +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n> > > > > +\n> > > > > +\tif (!name.empty())\n> > > > > +\t\tname += \"with id \";\n> > > >\n> > > > Just a quick question while skimming through the series. cam can\n> > > > printout camera properties, do we need to make 'friendly' names\n> > > > 100 characters to repeat what's already available there ?\n> > >\n> > > I know it can print properties :-)\n> > >\n> > > I'm happy to change this to contain more or less information, my main\n> > > goal of throwing in everything here is to showcase with cam how\n> > > applications can create names.\n> > >\n> > > What properties would you like to see make up the user-friendly name?\n> >\n> > None if not useful to distinguish between cameras with the same name ?\n> >\n> > ie\n> >         1- ov5670 (front)\n> >         2- ov5670 (back)\n> >\n> > I know we could have\n> >         1- ov5670 (external)\n> >         2- ov5670 (external)\n>\n> I like this and will use it for next version.\n>\n> But I really think we need to print the id as well as it is one of two\n> possible augments to --camera to select which one is used. How about\n>\n>     1: ov5695 (front) - /base/i2c@ff160000/camera@36\n>     2: ov2685 (back) - /base/i2c@ff160000/camera@3c\n>\n> ?\n\nI now wonder if an application like cam should expose machine-friendly\nid at all. But I guess it's fine, I like the above proposal\n\n>\n> >\n> > but at that point, I think we've done the best we could\n>\n> >\n> > >\n> > > >\n> > > >\n> > > > > +\n> > > > > +\tname += camera->id();\n> > > > > +\n> > > > > +\treturn name;\n> > > > > +}\n> > > > > +\n> > > > >  class CamApp\n> > > > >  {\n> > > > >  public:\n> > > > > @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n> > > > >  \t\t\treturn -EINVAL;\n> > > > >  \t\t}\n> > > > >\n> > > > > -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n> > > > > +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n> > > > >\n> > > > >  \t\tret = prepareConfig();\n> > > > >  \t\tif (ret) {\n> > > > > @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n> > > > >\n> > > > >  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n> > > > >  {\n> > > > > -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n> > > > > +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n> > > > >  }\n> > > > >\n> > > > >  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n> > > > >  {\n> > > > > -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n> > > > > +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n> > > > >  }\n> > > > >\n> > > > >  int CamApp::run()\n> > > > > @@ -340,7 +373,7 @@ int CamApp::run()\n> > > > >\n> > > > >  \t\tunsigned int index = 1;\n> > > > >  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n> > > > > -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n> > > > > +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n> > > > >  \t\t\tindex++;\n> > > > >  \t\t}\n> > > > >  \t}\n> > > > > --\n> > > > > 2.28.0\n> > > > >\n> > > > > _______________________________________________\n> > > > > libcamera-devel mailing list\n> > > > > libcamera-devel@lists.libcamera.org\n> > > > > https://lists.libcamera.org/listinfo/libcamera-devel\n> > >\n> > > --\n> > > Regards,\n> > > Niklas Söderlund\n>\n> --\n> Regards,\n> Niklas Söderlund","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9A835BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Aug 2020 15:02:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 319F960CE7;\n\tThu,  6 Aug 2020 17:02:56 +0200 (CEST)","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 03FE96038F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Aug 2020 17:02:54 +0200 (CEST)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 762FE4000B;\n\tThu,  6 Aug 2020 15:02:54 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","Date":"Thu, 6 Aug 2020 17:06:34 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200806150634.o3zqjomrorzk4tup@uno.localdomain>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>\n\t<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>\n\t<20200806133249.GK2712616@oden.dyn.berto.se>\n\t<20200806134002.rk6lumfsaw4fnv4x@uno.localdomain>\n\t<20200806134601.GL2712616@oden.dyn.berto.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200806134601.GL2712616@oden.dyn.berto.se>","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11945,"web_url":"https://patchwork.libcamera.org/comment/11945/","msgid":"<20200808121034.GA7314@pendragon.ideasonboard.com>","date":"2020-08-08T12:10:34","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hello,\n\nOn Thu, Aug 06, 2020 at 05:06:34PM +0200, Jacopo Mondi wrote:\n> On Thu, Aug 06, 2020 at 03:46:01PM +0200, Niklas Söderlund wrote:\n> > On 2020-08-06 15:40:02 +0200, Jacopo Mondi wrote:\n> > > On Thu, Aug 06, 2020 at 03:32:49PM +0200, Niklas Söderlund wrote:\n> > > > On 2020-08-06 15:28:04 +0200, Jacopo Mondi wrote:\n> > > > > On Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n> > > > > > Instead of only printing the camera ID which is not intended for humans\n> > > > > > to read and parse create a more user friendly string when prating camera\n> > > > > > names. The ID is still printed as it is one option used to select camera\n> > > > > > using the --camera option.\n> > > > > >\n> > > > > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > > > > > ---\n> > > > > >  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n> > > > > >  1 file changed, 37 insertions(+), 4 deletions(-)\n> > > > > >\n> > > > > > diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> > > > > > index cc3facd5a5b22092..5af76f6965ef2387 100644\n> > > > > > --- a/src/cam/main.cpp\n> > > > > > +++ b/src/cam/main.cpp\n> > > > > > @@ -21,6 +21,39 @@\n> > > > > >\n> > > > > >  using namespace libcamera;\n> > > > > >\n> > > > > > +std::string cameraName(const Camera *camera)\n> > > > > > +{\n> > > > > > +\tconst ControlList &props = camera->properties();\n> > > > > > +\tstd::string name;\n> > > > > > +\n> > > > > > +\tif (props.contains(properties::Model))\n> > > > > > +\t\tname += props.get(properties::Model) + \" \";\n> > > > > > +\n> > > > > > +\tif (props.contains(properties::Location)) {\n> > > > > > +\t\tswitch (props.get(properties::Location)) {\n> > > > > > +\t\tcase properties::CameraLocationFront:\n> > > > > > +\t\t\tname += \"facing front \";\n> > > > > > +\t\t\tbreak;\n> > > > > > +\t\tcase properties::CameraLocationBack:\n> > > > > > +\t\t\tname += \"facing back \";\n> > > > > > +\t\t\tbreak;\n> > > > > > +\t\tcase properties::CameraLocationExternal:\n> > > > > > +\t\t\tname += \"external \";\n> > > > > > +\t\t\tbreak;\n> > > > > > +\t\t}\n> > > > > > +\t}\n> > > > > > +\n> > > > > > +\tif (props.contains(properties::Rotation))\n> > > > > > +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n> > > > > > +\n> > > > > > +\tif (!name.empty())\n> > > > > > +\t\tname += \"with id \";\n> > > > >\n> > > > > Just a quick question while skimming through the series. cam can\n> > > > > printout camera properties, do we need to make 'friendly' names\n> > > > > 100 characters to repeat what's already available there ?\n> > > >\n> > > > I know it can print properties :-)\n> > > >\n> > > > I'm happy to change this to contain more or less information, my main\n> > > > goal of throwing in everything here is to showcase with cam how\n> > > > applications can create names.\n> > > >\n> > > > What properties would you like to see make up the user-friendly name?\n> > >\n> > > None if not useful to distinguish between cameras with the same name ?\n> > >\n> > > ie\n> > >         1- ov5670 (front)\n> > >         2- ov5670 (back)\n> > >\n> > > I know we could have\n> > >         1- ov5670 (external)\n> > >         2- ov5670 (external)\n> >\n> > I like this and will use it for next version.\n> >\n> > But I really think we need to print the id as well as it is one of two\n> > possible augments to --camera to select which one is used. How about\n> >\n> >     1: ov5695 (front) - /base/i2c@ff160000/camera@36\n> >     2: ov2685 (back) - /base/i2c@ff160000/camera@3c\n> >\n> > ?\n> \n> I now wonder if an application like cam should expose machine-friendly\n> id at all. But I guess it's fine, I like the above proposal\n\nI'm happy to join the bikeshedding :-) Jokes aside, I think this is\nimportant.\n\nIdeally, for internal cameras, I'd like to see something along the lines\nof\n\n1: Internal front camera (/base/i2c@ff160000/camera@36)\n2. Internal back camera (/base/i2c@ff160000/camera@3c)\n\nreported by cam, or possibly\n\n1: Internal front 5MP camera (/base/i2c@ff160000/camera@36)\n2. Internal back 12MP camera (/base/i2c@ff160000/camera@3c)\n\nif we want to make this more marketing-friendly :-) I know that\ncurrently we'll get \"Internal front camera\" twice, and I think that's\nOK. I believe the ID is important to print in cam, less so in qcam.\n\nFor external camera, I've been dreaming of\n\n3: Logitech Webcam C930e on USB port 2.2 (\\_SB_.PCI0.RP05.PXSX-2.2:1.0-046d:0843)\n4: Logitech Webcam C930e on USB port 2.4 (\\_SB_.PCI0.RP05.PXSX-2.4:1.0-046d:0843)\n\nbut getting a sensible port number may be difficult (in theory we could\nget the physical location from ACPI tables, but that's really the\ntheory). I think reporting extended physical location through properties\nwould be useful, but it doesn't have to be part of this series.\n\n> > > but at that point, I think we've done the best we could\n> > >\n> > > > > > +\n> > > > > > +\tname += camera->id();\n> > > > > > +\n> > > > > > +\treturn name;\n> > > > > > +}\n> > > > > > +\n> > > > > >  class CamApp\n> > > > > >  {\n> > > > > >  public:\n> > > > > > @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n> > > > > >  \t\t\treturn -EINVAL;\n> > > > > >  \t\t}\n> > > > > >\n> > > > > > -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n> > > > > > +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n> > > > > >\n> > > > > >  \t\tret = prepareConfig();\n> > > > > >  \t\tif (ret) {\n> > > > > > @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n> > > > > >\n> > > > > >  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n> > > > > >  {\n> > > > > > -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n> > > > > > +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n> > > > > >  }\n> > > > > >\n> > > > > >  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n> > > > > >  {\n> > > > > > -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n> > > > > > +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n> > > > > >  }\n> > > > > >\n> > > > > >  int CamApp::run()\n> > > > > > @@ -340,7 +373,7 @@ int CamApp::run()\n> > > > > >\n> > > > > >  \t\tunsigned int index = 1;\n> > > > > >  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n> > > > > > -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n> > > > > > +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n> > > > > >  \t\t\tindex++;\n> > > > > >  \t\t}\n> > > > > >  \t}","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D470FBD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  8 Aug 2020 12:10:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5FB806038D;\n\tSat,  8 Aug 2020 14:10:49 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 735FB6038D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  8 Aug 2020 14:10:48 +0200 (CEST)","from pendragon.ideasonboard.com (84-253-205-16.bb.dnainternet.fi\n\t[84.253.205.16])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C0362F9;\n\tSat,  8 Aug 2020 14:10:47 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"U2WoR7cw\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1596888648;\n\tbh=IxtdPjatH6bcubk7j+oKPJFvniWZ+j6QfUAORnjY5QQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=U2WoR7cwNeFy89KM6sWUpudHaK6qYt+8pCQqvYGIbKPUwwU8S2npuJfIW6b+1f/p/\n\tLnkQagxfyaq3i6NxG/Ee037Vf3UEco2G307JtrHCGAFShYQQKtHqm4/z9QTAnYpoEi\n\taWmI3IicPcpGupCvsLR+iespOui/GtSDQ/eG05go=","Date":"Sat, 8 Aug 2020 15:10:34 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200808121034.GA7314@pendragon.ideasonboard.com>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>\n\t<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>\n\t<20200806133249.GK2712616@oden.dyn.berto.se>\n\t<20200806134002.rk6lumfsaw4fnv4x@uno.localdomain>\n\t<20200806134601.GL2712616@oden.dyn.berto.se>\n\t<20200806150634.o3zqjomrorzk4tup@uno.localdomain>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200806150634.o3zqjomrorzk4tup@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11946,"web_url":"https://patchwork.libcamera.org/comment/11946/","msgid":"<20200808122235.GG3387836@oden.dyn.berto.se>","date":"2020-08-08T12:22:35","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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 feedback.\n\nOn 2020-08-08 15:10:34 +0300, Laurent Pinchart wrote:\n> Hello,\n> \n> On Thu, Aug 06, 2020 at 05:06:34PM +0200, Jacopo Mondi wrote:\n> > On Thu, Aug 06, 2020 at 03:46:01PM +0200, Niklas Söderlund wrote:\n> > > On 2020-08-06 15:40:02 +0200, Jacopo Mondi wrote:\n> > > > On Thu, Aug 06, 2020 at 03:32:49PM +0200, Niklas Söderlund wrote:\n> > > > > On 2020-08-06 15:28:04 +0200, Jacopo Mondi wrote:\n> > > > > > On Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n> > > > > > > Instead of only printing the camera ID which is not intended for humans\n> > > > > > > to read and parse create a more user friendly string when prating camera\n> > > > > > > names. The ID is still printed as it is one option used to select camera\n> > > > > > > using the --camera option.\n> > > > > > >\n> > > > > > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > > > > > > ---\n> > > > > > >  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n> > > > > > >  1 file changed, 37 insertions(+), 4 deletions(-)\n> > > > > > >\n> > > > > > > diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> > > > > > > index cc3facd5a5b22092..5af76f6965ef2387 100644\n> > > > > > > --- a/src/cam/main.cpp\n> > > > > > > +++ b/src/cam/main.cpp\n> > > > > > > @@ -21,6 +21,39 @@\n> > > > > > >\n> > > > > > >  using namespace libcamera;\n> > > > > > >\n> > > > > > > +std::string cameraName(const Camera *camera)\n> > > > > > > +{\n> > > > > > > +\tconst ControlList &props = camera->properties();\n> > > > > > > +\tstd::string name;\n> > > > > > > +\n> > > > > > > +\tif (props.contains(properties::Model))\n> > > > > > > +\t\tname += props.get(properties::Model) + \" \";\n> > > > > > > +\n> > > > > > > +\tif (props.contains(properties::Location)) {\n> > > > > > > +\t\tswitch (props.get(properties::Location)) {\n> > > > > > > +\t\tcase properties::CameraLocationFront:\n> > > > > > > +\t\t\tname += \"facing front \";\n> > > > > > > +\t\t\tbreak;\n> > > > > > > +\t\tcase properties::CameraLocationBack:\n> > > > > > > +\t\t\tname += \"facing back \";\n> > > > > > > +\t\t\tbreak;\n> > > > > > > +\t\tcase properties::CameraLocationExternal:\n> > > > > > > +\t\t\tname += \"external \";\n> > > > > > > +\t\t\tbreak;\n> > > > > > > +\t\t}\n> > > > > > > +\t}\n> > > > > > > +\n> > > > > > > +\tif (props.contains(properties::Rotation))\n> > > > > > > +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n> > > > > > > +\n> > > > > > > +\tif (!name.empty())\n> > > > > > > +\t\tname += \"with id \";\n> > > > > >\n> > > > > > Just a quick question while skimming through the series. cam can\n> > > > > > printout camera properties, do we need to make 'friendly' names\n> > > > > > 100 characters to repeat what's already available there ?\n> > > > >\n> > > > > I know it can print properties :-)\n> > > > >\n> > > > > I'm happy to change this to contain more or less information, my main\n> > > > > goal of throwing in everything here is to showcase with cam how\n> > > > > applications can create names.\n> > > > >\n> > > > > What properties would you like to see make up the user-friendly name?\n> > > >\n> > > > None if not useful to distinguish between cameras with the same name ?\n> > > >\n> > > > ie\n> > > >         1- ov5670 (front)\n> > > >         2- ov5670 (back)\n> > > >\n> > > > I know we could have\n> > > >         1- ov5670 (external)\n> > > >         2- ov5670 (external)\n> > >\n> > > I like this and will use it for next version.\n> > >\n> > > But I really think we need to print the id as well as it is one of two\n> > > possible augments to --camera to select which one is used. How about\n> > >\n> > >     1: ov5695 (front) - /base/i2c@ff160000/camera@36\n> > >     2: ov2685 (back) - /base/i2c@ff160000/camera@3c\n> > >\n> > > ?\n> > \n> > I now wonder if an application like cam should expose machine-friendly\n> > id at all. But I guess it's fine, I like the above proposal\n> \n> I'm happy to join the bikeshedding :-) Jokes aside, I think this is\n> important.\n> \n> Ideally, for internal cameras, I'd like to see something along the lines\n> of\n> \n> 1: Internal front camera (/base/i2c@ff160000/camera@36)\n> 2. Internal back camera (/base/i2c@ff160000/camera@3c)\n> \n> reported by cam, or possibly\n> \n> 1: Internal front 5MP camera (/base/i2c@ff160000/camera@36)\n> 2. Internal back 12MP camera (/base/i2c@ff160000/camera@3c)\n> \n> if we want to make this more marketing-friendly :-) I know that\n> currently we'll get \"Internal front camera\" twice, and I think that's\n> OK. I believe the ID is important to print in cam, less so in qcam.\n> \n> For external camera, I've been dreaming of\n> \n> 3: Logitech Webcam C930e on USB port 2.2 (\\_SB_.PCI0.RP05.PXSX-2.2:1.0-046d:0843)\n> 4: Logitech Webcam C930e on USB port 2.4 (\\_SB_.PCI0.RP05.PXSX-2.4:1.0-046d:0843)\n> \n> but getting a sensible port number may be difficult (in theory we could\n> get the physical location from ACPI tables, but that's really the\n> theory). I think reporting extended physical location through properties\n> would be useful, but it doesn't have to be part of this series.\n\nI like the above but to be able to implement all of it more properties \nneeds to be added to lib camera core. As a first step to make cam \nuser-friendly again would the following output be sufficient for this \nseries in your opinion?\n\n    1: Internal front camera (/base/i2c@ff160000/camera@36)\n    2. Internal back camera (/base/i2c@ff160000/camera@3c)\n    3: Logitech Webcam C930e (\\_SB_.PCI0.RP05.PXSX-2.2:1.0-046d:0843)\n\nAs camera selection is only possible by `index` or `id` modifying the \nname as we gain more information will not break any scripts.\n\n> \n> > > > but at that point, I think we've done the best we could\n> > > >\n> > > > > > > +\n> > > > > > > +\tname += camera->id();\n> > > > > > > +\n> > > > > > > +\treturn name;\n> > > > > > > +}\n> > > > > > > +\n> > > > > > >  class CamApp\n> > > > > > >  {\n> > > > > > >  public:\n> > > > > > > @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n> > > > > > >  \t\t\treturn -EINVAL;\n> > > > > > >  \t\t}\n> > > > > > >\n> > > > > > > -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n> > > > > > > +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n> > > > > > >\n> > > > > > >  \t\tret = prepareConfig();\n> > > > > > >  \t\tif (ret) {\n> > > > > > > @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n> > > > > > >\n> > > > > > >  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n> > > > > > >  {\n> > > > > > > -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n> > > > > > > +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n> > > > > > >  }\n> > > > > > >\n> > > > > > >  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n> > > > > > >  {\n> > > > > > > -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n> > > > > > > +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n> > > > > > >  }\n> > > > > > >\n> > > > > > >  int CamApp::run()\n> > > > > > > @@ -340,7 +373,7 @@ int CamApp::run()\n> > > > > > >\n> > > > > > >  \t\tunsigned int index = 1;\n> > > > > > >  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n> > > > > > > -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n> > > > > > > +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n> > > > > > >  \t\t\tindex++;\n> > > > > > >  \t\t}\n> > > > > > >  \t}\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id EEEB5BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  8 Aug 2020 12:22:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8150E60DF1;\n\tSat,  8 Aug 2020 14:22:39 +0200 (CEST)","from mail-lj1-x230.google.com (mail-lj1-x230.google.com\n\t[IPv6:2a00:1450:4864:20::230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C103F6038D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  8 Aug 2020 14:22:37 +0200 (CEST)","by mail-lj1-x230.google.com with SMTP id z14so4939112ljm.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 08 Aug 2020 05:22:37 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tc4sm6075732lfs.27.2020.08.08.05.22.36\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 08 Aug 2020 05:22:36 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"FTqKtlSy\"; dkim-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=CPmf9JOonAwaGW6AVOzXOYPSqQoEN7K9Ns1MWobW+vQ=;\n\tb=FTqKtlSyWI1IQByLOj26VCKo6SgQMll/T7n+Xb0PMBWDuvOZsnePi/l24QDeFw+Aed\n\ta8dDgwoqqss35ehHxlQNM9ktqefpQIe2lEDArPfBaByM/hoMeNlRVeHvrlgqmhLM9wLR\n\tqXrwYOw32uCQBNEo8+pLshrsi3lNoLyPCF7aDv5HNBOQ9DyD+vycwm/1WKmWzjOqfslp\n\tv8bIT5omnDv18f9j902ASnqjD1ebgQM++5FW3jh61y+14lqF8jcT4bMC8QUs+Sc+I9M5\n\t6vPS4KoKQM8aLzfOis8lJns6l/DzmOTTRlh8uRPvGRJ4CqlK+LOseOegv6S7Z/9lJZjF\n\t3hVQ==","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=CPmf9JOonAwaGW6AVOzXOYPSqQoEN7K9Ns1MWobW+vQ=;\n\tb=UAuj9uLxCwGqXaG0VTMT/JJSR1iBqozd/2m77DS4Sh6+YThnoH4eLYTzgZKnxLfGMY\n\t5P/D0Z9S7jw5xwwDP9tr2vXeTfgqKVbAmlqEsN+Bnscw8Fa0uopNHKP02UFXa64HGtQd\n\tITYwhEUekLe9ceMgeXOevuCuccUqyMrRw+EJRxP/RiC4BFxlX1pfk37Z/rNlJKOekzzH\n\tuRDhDjptfj6FfJSv1iw+ZRoLZ9qzxIIAmKxMZUfTT3ZbohCqOLV9sXTAVRfjlOL4IGXB\n\tIrcf3QpHckiTNfWzAZcei91UndrxsII95Qd1AsaKqBW9fejzScc9j9xJ0d9cgwqK6t+0\n\t/Ohg==","X-Gm-Message-State":"AOAM530jBIHdUfBUBtB0u4OjE+rBGic5KkLoW9DuAOpy8NxOLtusjwpX\n\tubkzYI1nLtIfRx6y1JPAR0slC9SzOEY=","X-Google-Smtp-Source":"ABdhPJwHvu2bDD1o4BuYURTZvrL70DvTgRQ+I2b6mH5uKvmav2IMkb0D43AwNVBoMiL5vHt6AE7i8A==","X-Received":"by 2002:a2e:2c0e:: with SMTP id s14mr8873948ljs.28.1596889357026;\n\tSat, 08 Aug 2020 05:22:37 -0700 (PDT)","Date":"Sat, 8 Aug 2020 14:22:35 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20200808122235.GG3387836@oden.dyn.berto.se>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>\n\t<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>\n\t<20200806133249.GK2712616@oden.dyn.berto.se>\n\t<20200806134002.rk6lumfsaw4fnv4x@uno.localdomain>\n\t<20200806134601.GL2712616@oden.dyn.berto.se>\n\t<20200806150634.o3zqjomrorzk4tup@uno.localdomain>\n\t<20200808121034.GA7314@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200808121034.GA7314@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11947,"web_url":"https://patchwork.libcamera.org/comment/11947/","msgid":"<20200808201320.GA6186@pendragon.ideasonboard.com>","date":"2020-08-08T20:13:20","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nOn Sat, Aug 08, 2020 at 02:22:35PM +0200, Niklas Söderlund wrote:\n> On 2020-08-08 15:10:34 +0300, Laurent Pinchart wrote:\n> > On Thu, Aug 06, 2020 at 05:06:34PM +0200, Jacopo Mondi wrote:\n> >> On Thu, Aug 06, 2020 at 03:46:01PM +0200, Niklas Söderlund wrote:\n> >>> On 2020-08-06 15:40:02 +0200, Jacopo Mondi wrote:\n> >>>> On Thu, Aug 06, 2020 at 03:32:49PM +0200, Niklas Söderlund wrote:\n> >>>>> On 2020-08-06 15:28:04 +0200, Jacopo Mondi wrote:\n> >>>>>> On Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n> >>>>>>> Instead of only printing the camera ID which is not intended for humans\n> >>>>>>> to read and parse create a more user friendly string when prating camera\n> >>>>>>> names. The ID is still printed as it is one option used to select camera\n> >>>>>>> using the --camera option.\n> >>>>>>>\n> >>>>>>> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> >>>>>>> ---\n> >>>>>>>  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n> >>>>>>>  1 file changed, 37 insertions(+), 4 deletions(-)\n> >>>>>>>\n> >>>>>>> diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> >>>>>>> index cc3facd5a5b22092..5af76f6965ef2387 100644\n> >>>>>>> --- a/src/cam/main.cpp\n> >>>>>>> +++ b/src/cam/main.cpp\n> >>>>>>> @@ -21,6 +21,39 @@\n> >>>>>>>\n> >>>>>>>  using namespace libcamera;\n> >>>>>>>\n> >>>>>>> +std::string cameraName(const Camera *camera)\n> >>>>>>> +{\n> >>>>>>> +\tconst ControlList &props = camera->properties();\n> >>>>>>> +\tstd::string name;\n> >>>>>>> +\n> >>>>>>> +\tif (props.contains(properties::Model))\n> >>>>>>> +\t\tname += props.get(properties::Model) + \" \";\n> >>>>>>> +\n> >>>>>>> +\tif (props.contains(properties::Location)) {\n> >>>>>>> +\t\tswitch (props.get(properties::Location)) {\n> >>>>>>> +\t\tcase properties::CameraLocationFront:\n> >>>>>>> +\t\t\tname += \"facing front \";\n> >>>>>>> +\t\t\tbreak;\n> >>>>>>> +\t\tcase properties::CameraLocationBack:\n> >>>>>>> +\t\t\tname += \"facing back \";\n> >>>>>>> +\t\t\tbreak;\n> >>>>>>> +\t\tcase properties::CameraLocationExternal:\n> >>>>>>> +\t\t\tname += \"external \";\n> >>>>>>> +\t\t\tbreak;\n> >>>>>>> +\t\t}\n> >>>>>>> +\t}\n> >>>>>>> +\n> >>>>>>> +\tif (props.contains(properties::Rotation))\n> >>>>>>> +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n> >>>>>>> +\n> >>>>>>> +\tif (!name.empty())\n> >>>>>>> +\t\tname += \"with id \";\n> >>>>>>\n> >>>>>> Just a quick question while skimming through the series. cam can\n> >>>>>> printout camera properties, do we need to make 'friendly' names\n> >>>>>> 100 characters to repeat what's already available there ?\n> >>>>>\n> >>>>> I know it can print properties :-)\n> >>>>>\n> >>>>> I'm happy to change this to contain more or less information, my main\n> >>>>> goal of throwing in everything here is to showcase with cam how\n> >>>>> applications can create names.\n> >>>>>\n> >>>>> What properties would you like to see make up the user-friendly name?\n> >>>>\n> >>>> None if not useful to distinguish between cameras with the same name ?\n> >>>>\n> >>>> ie\n> >>>>         1- ov5670 (front)\n> >>>>         2- ov5670 (back)\n> >>>>\n> >>>> I know we could have\n> >>>>         1- ov5670 (external)\n> >>>>         2- ov5670 (external)\n> >>>\n> >>> I like this and will use it for next version.\n> >>>\n> >>> But I really think we need to print the id as well as it is one of two\n> >>> possible augments to --camera to select which one is used. How about\n> >>>\n> >>>     1: ov5695 (front) - /base/i2c@ff160000/camera@36\n> >>>     2: ov2685 (back) - /base/i2c@ff160000/camera@3c\n> >>>\n> >>> ?\n> >> \n> >> I now wonder if an application like cam should expose machine-friendly\n> >> id at all. But I guess it's fine, I like the above proposal\n> > \n> > I'm happy to join the bikeshedding :-) Jokes aside, I think this is\n> > important.\n> > \n> > Ideally, for internal cameras, I'd like to see something along the lines\n> > of\n> > \n> > 1: Internal front camera (/base/i2c@ff160000/camera@36)\n> > 2. Internal back camera (/base/i2c@ff160000/camera@3c)\n> > \n> > reported by cam, or possibly\n> > \n> > 1: Internal front 5MP camera (/base/i2c@ff160000/camera@36)\n> > 2. Internal back 12MP camera (/base/i2c@ff160000/camera@3c)\n> > \n> > if we want to make this more marketing-friendly :-) I know that\n> > currently we'll get \"Internal front camera\" twice, and I think that's\n> > OK. I believe the ID is important to print in cam, less so in qcam.\n> > \n> > For external camera, I've been dreaming of\n> > \n> > 3: Logitech Webcam C930e on USB port 2.2 (\\_SB_.PCI0.RP05.PXSX-2.2:1.0-046d:0843)\n> > 4: Logitech Webcam C930e on USB port 2.4 (\\_SB_.PCI0.RP05.PXSX-2.4:1.0-046d:0843)\n> > \n> > but getting a sensible port number may be difficult (in theory we could\n> > get the physical location from ACPI tables, but that's really the\n> > theory). I think reporting extended physical location through properties\n> > would be useful, but it doesn't have to be part of this series.\n> \n> I like the above but to be able to implement all of it more properties \n> needs to be added to lib camera core. As a first step to make cam \n> user-friendly again would the following output be sufficient for this \n> series in your opinion?\n> \n>     1: Internal front camera (/base/i2c@ff160000/camera@36)\n>     2. Internal back camera (/base/i2c@ff160000/camera@3c)\n>     3: Logitech Webcam C930e (\\_SB_.PCI0.RP05.PXSX-2.2:1.0-046d:0843)\n\nAbsolutely. I tried to convey that in my previous e-mail, we'll need to\nexpose more information about camera location, and it's fine to start\nwith what we have.\n\n> As camera selection is only possible by `index` or `id` modifying the \n> name as we gain more information will not break any scripts.\n> \n> >>>> but at that point, I think we've done the best we could\n> >>>>\n> >>>>>>> +\n> >>>>>>> +\tname += camera->id();\n> >>>>>>> +\n> >>>>>>> +\treturn name;\n> >>>>>>> +}\n> >>>>>>> +\n> >>>>>>>  class CamApp\n> >>>>>>>  {\n> >>>>>>>  public:\n> >>>>>>> @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n> >>>>>>>  \t\t\treturn -EINVAL;\n> >>>>>>>  \t\t}\n> >>>>>>>\n> >>>>>>> -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n> >>>>>>> +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n> >>>>>>>\n> >>>>>>>  \t\tret = prepareConfig();\n> >>>>>>>  \t\tif (ret) {\n> >>>>>>> @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n> >>>>>>>\n> >>>>>>>  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n> >>>>>>>  {\n> >>>>>>> -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n> >>>>>>> +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n> >>>>>>>  }\n> >>>>>>>\n> >>>>>>>  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n> >>>>>>>  {\n> >>>>>>> -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n> >>>>>>> +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n> >>>>>>>  }\n> >>>>>>>\n> >>>>>>>  int CamApp::run()\n> >>>>>>> @@ -340,7 +373,7 @@ int CamApp::run()\n> >>>>>>>\n> >>>>>>>  \t\tunsigned int index = 1;\n> >>>>>>>  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n> >>>>>>> -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n> >>>>>>> +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n> >>>>>>>  \t\t\tindex++;\n> >>>>>>>  \t\t}\n> >>>>>>>  \t}","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 04447BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  8 Aug 2020 20:13:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6418760DF1;\n\tSat,  8 Aug 2020 22:13:40 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 965806038D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  8 Aug 2020 22:13:39 +0200 (CEST)","from pendragon.ideasonboard.com (85-76-78-184-nat.elisa-mobile.fi\n\t[85.76.78.184])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 84DCFF9;\n\tSat,  8 Aug 2020 22:13:36 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"grnUN2Ti\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1596917619;\n\tbh=4ELSbscqy17glK+TQkQAS/kNSMtIx+jt8O3JbXmxA/4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=grnUN2TiNaWCUpwzz23mce2g1MZgQje2km0+55Gi5NIXVjbCciMn35n19wygd4hL8\n\tyclQPin8uD5jHiMK9ucwQ+suaVxJmlHQvN+Z3/b/dKouTZgHIHeVdlnLc2sywhOEvs\n\tGUb+gM/J2efZI4zQZuN2v2Vt1kqV8CX0RRt70kJY=","Date":"Sat, 8 Aug 2020 23:13:20 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200808201320.GA6186@pendragon.ideasonboard.com>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>\n\t<20200806132804.z6e3xg5sgv3p6jfj@uno.localdomain>\n\t<20200806133249.GK2712616@oden.dyn.berto.se>\n\t<20200806134002.rk6lumfsaw4fnv4x@uno.localdomain>\n\t<20200806134601.GL2712616@oden.dyn.berto.se>\n\t<20200806150634.o3zqjomrorzk4tup@uno.localdomain>\n\t<20200808121034.GA7314@pendragon.ideasonboard.com>\n\t<20200808122235.GG3387836@oden.dyn.berto.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200808122235.GG3387836@oden.dyn.berto.se>","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11951,"web_url":"https://patchwork.libcamera.org/comment/11951/","msgid":"<20200808202504.GE6186@pendragon.ideasonboard.com>","date":"2020-08-08T20:25:04","subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Thu, Aug 06, 2020 at 03:09:36PM +0200, Niklas Söderlund wrote:\n> Instead of only printing the camera ID which is not intended for humans\n> to read and parse create a more user friendly string when prating camera\n\ns/prating/printing/\n\n> names. The ID is still printed as it is one option used to select camera\n> using the --camera option.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/cam/main.cpp | 41 +++++++++++++++++++++++++++++++++++++----\n>  1 file changed, 37 insertions(+), 4 deletions(-)\n> \n> diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> index cc3facd5a5b22092..5af76f6965ef2387 100644\n> --- a/src/cam/main.cpp\n> +++ b/src/cam/main.cpp\n> @@ -21,6 +21,39 @@\n>  \n>  using namespace libcamera;\n>  \n> +std::string cameraName(const Camera *camera)\n> +{\n> +\tconst ControlList &props = camera->properties();\n> +\tstd::string name;\n> +\n> +\tif (props.contains(properties::Model))\n> +\t\tname += props.get(properties::Model) + \" \";\n> +\n> +\tif (props.contains(properties::Location)) {\n> +\t\tswitch (props.get(properties::Location)) {\n> +\t\tcase properties::CameraLocationFront:\n> +\t\t\tname += \"facing front \";\n> +\t\t\tbreak;\n> +\t\tcase properties::CameraLocationBack:\n> +\t\t\tname += \"facing back \";\n> +\t\t\tbreak;\n> +\t\tcase properties::CameraLocationExternal:\n> +\t\t\tname += \"external \";\n> +\t\t\tbreak;\n> +\t\t}\n> +\t}\n> +\n> +\tif (props.contains(properties::Rotation))\n> +\t\tname += \"rotated \" + std::to_string(props.get(properties::Rotation)) + \" degrees \";\n> +\n> +\tif (!name.empty())\n> +\t\tname += \"with id \";\n> +\n> +\tname += camera->id();\n> +\n> +\treturn name;\n> +}\n> +\n>  class CamApp\n>  {\n>  public:\n> @@ -117,7 +150,7 @@ int CamApp::init(int argc, char **argv)\n>  \t\t\treturn -EINVAL;\n>  \t\t}\n>  \n> -\t\tstd::cout << \"Using camera \" << camera_->id() << std::endl;\n> +\t\tstd::cout << \"Using camera \" << cameraName(camera_.get()) << std::endl;\n>  \n>  \t\tret = prepareConfig();\n>  \t\tif (ret) {\n> @@ -323,12 +356,12 @@ int CamApp::infoConfiguration()\n>  \n>  void CamApp::cameraAdded(std::shared_ptr<Camera> cam)\n>  {\n> -\tstd::cout << \"Camera Added: \" << cam->id() << std::endl;\n> +\tstd::cout << \"Camera Added: \" << cameraName(cam.get()) << std::endl;\n>  }\n>  \n>  void CamApp::cameraRemoved(std::shared_ptr<Camera> cam)\n>  {\n> -\tstd::cout << \"Camera Removed: \" << cam->id() << std::endl;\n> +\tstd::cout << \"Camera Removed: \" << cameraName(cam.get()) << std::endl;\n>  }\n>  \n>  int CamApp::run()\n> @@ -340,7 +373,7 @@ int CamApp::run()\n>  \n>  \t\tunsigned int index = 1;\n>  \t\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras()) {\n> -\t\t\tstd::cout << index << \": \" << cam->id() << std::endl;\n> +\t\t\tstd::cout << index << \": \" << cameraName(cam.get()) << std::endl;\n\nHere I think it makes complete sense, but above, I'd keep using id(), as\ncam is a low-level test tool. It would be different with a more\nend-user-oriented application.\n\n>  \t\t\tindex++;\n>  \t\t}\n>  \t}","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4AC1DBD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  8 Aug 2020 20:25:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B977A60DF1;\n\tSat,  8 Aug 2020 22:25:21 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 689406038D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  8 Aug 2020 22:25:20 +0200 (CEST)","from pendragon.ideasonboard.com (85-76-78-184-nat.elisa-mobile.fi\n\t[85.76.78.184])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 831BFF9;\n\tSat,  8 Aug 2020 22:25:19 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"bu2vslpo\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1596918319;\n\tbh=h178T2YI5wGyQjYC87WnRSCRQMKT9LLJ64NNBFj0It8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=bu2vslpokAShv3hEF7rVbzN8T3Jd4Vt5xW+LtORS8lGuF8O/Eg7mWhkJ1bCh9J/s1\n\tSIhGlX9y2IKjaFG98itXnCkHpsMDHLcMXh458MjcO9/EwtbpPpfDLHnQSuT4MwLlXr\n\tkWwwRD/CVccApSJPbQHHGNHH4UNZeUk1m+ffPK5g=","Date":"Sat, 8 Aug 2020 23:25:04 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200808202504.GE6186@pendragon.ideasonboard.com>","References":"<20200806130937.2991606-1-niklas.soderlund@ragnatech.se>\n\t<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200806130937.2991606-7-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH 6/7] cam: Print user-friendly camera\n\tnames","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]