[{"id":4873,"web_url":"https://patchwork.libcamera.org/comment/4873/","msgid":"<20200520103848.GA5852@pendragon.ideasonboard.com>","date":"2020-05-20T10:38:48","subject":"Re: [libcamera-devel] [PATCH v2 2/2] libcamera: properties: Re-name\n\tlocation to orientation","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, May 20, 2020 at 12:03:20PM +0200, Jacopo Mondi wrote:\n> Adapt the libcamera property name to match the V4L2 control name in the\n> properties definition and in the property collection routine.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/camera_sensor.cpp | 32 ++++++++++++++++----------------\n>  src/libcamera/property_ids.yaml | 10 +++++-----\n>  2 files changed, 21 insertions(+), 21 deletions(-)\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index 174df17cfaef..db65e154f985 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -209,32 +209,32 @@ int CameraSensor::init()\n>  \tconst ControlInfoMap &controls = subdev_->controls();\n>  \tint32_t propertyValue;\n>  \n> -\t/* Camera Location: default is front location. */\n> -\tconst auto &locationControl = controls.find(V4L2_CID_CAMERA_SENSOR_LOCATION);\n> -\tif (locationControl != controls.end()) {\n> -\t\tint32_t v4l2Location =\n> -\t\t\tlocationControl->second.def().get<int32_t>();\n> +\t/* Camera Orientation: default is front orientation. */\n> +\tconst auto &orientationControl = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n> +\tif (orientationControl != controls.end()) {\n> +\t\tint32_t v4l2Orientation =\n> +\t\t\torientationControl->second.def().get<int32_t>();\n>  \n> -\t\tswitch (v4l2Location) {\n> +\t\tswitch (v4l2Orientation) {\n>  \t\tdefault:\n>  \t\t\tLOG(CameraSensor, Warning)\n> -\t\t\t\t<< \"Unsupported camera location \"\n> -\t\t\t\t<< v4l2Location << \", setting to Front\";\n> +\t\t\t\t<< \"Unsupported camera orientation \"\n> +\t\t\t\t<< v4l2Orientation << \", setting to Front\";\n>  \t\t\t/* Fall-through */\n> -\t\tcase V4L2_LOCATION_FRONT:\n> -\t\t\tpropertyValue = properties::CameraLocationFront;\n> +\t\tcase V4L2_CAMERA_ORIENTATION_FRONT:\n> +\t\t\tpropertyValue = properties::CameraOrientationFront;\n>  \t\t\tbreak;\n> -\t\tcase V4L2_LOCATION_BACK:\n> -\t\t\tpropertyValue = properties::CameraLocationBack;\n> +\t\tcase V4L2_CAMERA_ORIENTATION_BACK:\n> +\t\t\tpropertyValue = properties::CameraOrientationBack;\n>  \t\t\tbreak;\n> -\t\tcase V4L2_LOCATION_EXTERNAL:\n> -\t\t\tpropertyValue = properties::CameraLocationExternal;\n> +\t\tcase V4L2_CAMERA_ORIENTATION_EXTERNAL:\n> +\t\t\tpropertyValue = properties::CameraOrientationExternal;\n>  \t\t\tbreak;\n>  \t\t}\n>  \t} else {\n> -\t\tpropertyValue = properties::CameraLocationFront;\n> +\t\tpropertyValue = properties::CameraOrientationFront;\n>  \t}\n> -\tproperties_.set(properties::Location, propertyValue);\n> +\tproperties_.set(properties::Orientation, propertyValue);\n>  \n>  \t/* Camera Rotation: default is 0 degrees. */\n>  \tconst auto &rotationControl = controls.find(V4L2_CID_CAMERA_SENSOR_ROTATION);\n> diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml\n> index ce627fa042ba..9cce8b2c9552 100644\n> --- a/src/libcamera/property_ids.yaml\n> +++ b/src/libcamera/property_ids.yaml\n> @@ -5,22 +5,22 @@\n>  %YAML 1.2\n>  ---\n>  controls:\n> -  - Location:\n> +  - Orientation:\n>        type: int32_t\n>        description: |\n> -        Camera mounting location\n> +        The camera orientation, defined by the camera mounting position.\n\nLet's not import the V4L2 mistakes in libcamera :-) Location is a better\nname than Orientation. What we describe here is where the camera is\nlocated, not how it's orientated.\n\n>        enum:\n> -        - name: CameraLocationFront\n> +        - name: CameraOrientationFront\n>            value: 0\n>            description: |\n>              The camera is mounted on the front side of the device, facing the\n>              user\n> -        - name: CameraLocationBack\n> +        - name: CameraOrientationBack\n>            value: 1\n>            description: |\n>              The camera is mounted on the back side of the device, facing away\n>              from the user\n> -        - name: CameraLocationExternal\n> +        - name: CameraOrientationExternal\n>            value: 2\n>            description: |\n>              The camera is attached to the device in a way that allows it to","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 87F92603F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 May 2020 12:38:59 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 04627253;\n\tWed, 20 May 2020 12:38:58 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"TTum5Snd\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1589971139;\n\tbh=xyPWAzycs3DOHWdcPoCYHPHHzJM1Kb87/fVqqGH20aE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=TTum5SndnLSG1IUbB/saiYGrX05t6TYb89BpWJ8DsOqNimU6ZX2HrM4DWSPdZq2Qo\n\tKsWoeRo+VAnzAO0rWQxjvPpvvg1pVAdTnUa3ENXz1T2mJrd3vxtrU1sQosJWI+uPQ8\n\tPP8buzghazccH0d87vfksHtVT5JcfZn7MkPlFw1Q=","Date":"Wed, 20 May 2020 13:38:48 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200520103848.GA5852@pendragon.ideasonboard.com>","References":"<20200520100320.436430-1-jacopo@jmondi.org>\n\t<20200520100320.436430-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200520100320.436430-2-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v2 2/2] libcamera: properties: Re-name\n\tlocation to orientation","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 20 May 2020 10:38:59 -0000"}},{"id":4876,"web_url":"https://patchwork.libcamera.org/comment/4876/","msgid":"<20200520104836.bkihy5uu2t5obo5b@uno.localdomain>","date":"2020-05-20T10:48:36","subject":"Re: [libcamera-devel] [PATCH v2 2/2] libcamera: properties: Re-name\n\tlocation to orientation","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Wed, May 20, 2020 at 01:38:48PM +0300, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Wed, May 20, 2020 at 12:03:20PM +0200, Jacopo Mondi wrote:\n> > Adapt the libcamera property name to match the V4L2 control name in the\n> > properties definition and in the property collection routine.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/camera_sensor.cpp | 32 ++++++++++++++++----------------\n> >  src/libcamera/property_ids.yaml | 10 +++++-----\n> >  2 files changed, 21 insertions(+), 21 deletions(-)\n> >\n> > diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> > index 174df17cfaef..db65e154f985 100644\n> > --- a/src/libcamera/camera_sensor.cpp\n> > +++ b/src/libcamera/camera_sensor.cpp\n> > @@ -209,32 +209,32 @@ int CameraSensor::init()\n> >  \tconst ControlInfoMap &controls = subdev_->controls();\n> >  \tint32_t propertyValue;\n> >\n> > -\t/* Camera Location: default is front location. */\n> > -\tconst auto &locationControl = controls.find(V4L2_CID_CAMERA_SENSOR_LOCATION);\n> > -\tif (locationControl != controls.end()) {\n> > -\t\tint32_t v4l2Location =\n> > -\t\t\tlocationControl->second.def().get<int32_t>();\n> > +\t/* Camera Orientation: default is front orientation. */\n> > +\tconst auto &orientationControl = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n> > +\tif (orientationControl != controls.end()) {\n> > +\t\tint32_t v4l2Orientation =\n> > +\t\t\torientationControl->second.def().get<int32_t>();\n> >\n> > -\t\tswitch (v4l2Location) {\n> > +\t\tswitch (v4l2Orientation) {\n> >  \t\tdefault:\n> >  \t\t\tLOG(CameraSensor, Warning)\n> > -\t\t\t\t<< \"Unsupported camera location \"\n> > -\t\t\t\t<< v4l2Location << \", setting to Front\";\n> > +\t\t\t\t<< \"Unsupported camera orientation \"\n> > +\t\t\t\t<< v4l2Orientation << \", setting to Front\";\n> >  \t\t\t/* Fall-through */\n> > -\t\tcase V4L2_LOCATION_FRONT:\n> > -\t\t\tpropertyValue = properties::CameraLocationFront;\n> > +\t\tcase V4L2_CAMERA_ORIENTATION_FRONT:\n> > +\t\t\tpropertyValue = properties::CameraOrientationFront;\n> >  \t\t\tbreak;\n> > -\t\tcase V4L2_LOCATION_BACK:\n> > -\t\t\tpropertyValue = properties::CameraLocationBack;\n> > +\t\tcase V4L2_CAMERA_ORIENTATION_BACK:\n> > +\t\t\tpropertyValue = properties::CameraOrientationBack;\n> >  \t\t\tbreak;\n> > -\t\tcase V4L2_LOCATION_EXTERNAL:\n> > -\t\t\tpropertyValue = properties::CameraLocationExternal;\n> > +\t\tcase V4L2_CAMERA_ORIENTATION_EXTERNAL:\n> > +\t\t\tpropertyValue = properties::CameraOrientationExternal;\n> >  \t\t\tbreak;\n> >  \t\t}\n> >  \t} else {\n> > -\t\tpropertyValue = properties::CameraLocationFront;\n> > +\t\tpropertyValue = properties::CameraOrientationFront;\n> >  \t}\n> > -\tproperties_.set(properties::Location, propertyValue);\n> > +\tproperties_.set(properties::Orientation, propertyValue);\n> >\n> >  \t/* Camera Rotation: default is 0 degrees. */\n> >  \tconst auto &rotationControl = controls.find(V4L2_CID_CAMERA_SENSOR_ROTATION);\n> > diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml\n> > index ce627fa042ba..9cce8b2c9552 100644\n> > --- a/src/libcamera/property_ids.yaml\n> > +++ b/src/libcamera/property_ids.yaml\n> > @@ -5,22 +5,22 @@\n> >  %YAML 1.2\n> >  ---\n> >  controls:\n> > -  - Location:\n> > +  - Orientation:\n> >        type: int32_t\n> >        description: |\n> > -        Camera mounting location\n> > +        The camera orientation, defined by the camera mounting position.\n>\n> Let's not import the V4L2 mistakes in libcamera :-) Location is a better\n> name than Orientation. What we describe here is where the camera is\n> located, not how it's orientated.\n\nhttps://en.wikipedia.org/wiki/The_Servant_of_Two_Masters\n\nI'll drop this, let me know if 1/2 is ok in this form\n\n>\n> >        enum:\n> > -        - name: CameraLocationFront\n> > +        - name: CameraOrientationFront\n> >            value: 0\n> >            description: |\n> >              The camera is mounted on the front side of the device, facing the\n> >              user\n> > -        - name: CameraLocationBack\n> > +        - name: CameraOrientationBack\n> >            value: 1\n> >            description: |\n> >              The camera is mounted on the back side of the device, facing away\n> >              from the user\n> > -        - name: CameraLocationExternal\n> > +        - name: CameraOrientationExternal\n> >            value: 2\n> >            description: |\n> >              The camera is attached to the device in a way that allows it to\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A3B2603F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 May 2020 12:45:17 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 816CA60002;\n\tWed, 20 May 2020 10:45:16 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Wed, 20 May 2020 12:48:36 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200520104836.bkihy5uu2t5obo5b@uno.localdomain>","References":"<20200520100320.436430-1-jacopo@jmondi.org>\n\t<20200520100320.436430-2-jacopo@jmondi.org>\n\t<20200520103848.GA5852@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200520103848.GA5852@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/2] libcamera: properties: Re-name\n\tlocation to orientation","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 20 May 2020 10:45:17 -0000"}}]