[libcamera-devel,v7,5/9] libcamera: camera_sensor: Add accessors for sensor ID

Message ID 20200804161358.1628962-6-niklas.soderlund@ragnatech.se
State Superseded
Headers show
Series
  • libcamera: Generate unique and stable camera IDs
Related show

Commit Message

Niklas Söderlund Aug. 4, 2020, 4:13 p.m. UTC
Add an accessors so that the sensor ID can be used outside CameraSensor.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 include/libcamera/internal/camera_sensor.h |  1 +
 src/libcamera/camera_sensor.cpp            | 10 ++++++++++
 2 files changed, 11 insertions(+)

Comments

Laurent Pinchart Aug. 4, 2020, 6:24 p.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Tue, Aug 04, 2020 at 06:13:54PM +0200, Niklas Söderlund wrote:
> Add an accessors so that the sensor ID can be used outside CameraSensor.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

I think you could squash it with 4/9.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  include/libcamera/internal/camera_sensor.h |  1 +
>  src/libcamera/camera_sensor.cpp            | 10 ++++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
> index 0f65fca46877e89a..b9eba89f00fba882 100644
> --- a/include/libcamera/internal/camera_sensor.h
> +++ b/include/libcamera/internal/camera_sensor.h
> @@ -47,6 +47,7 @@ public:
>  	int init();
>  
>  	const std::string &model() const { return model_; }
> +	const std::string &id() const { return id_; }
>  	const MediaEntity *entity() const { return entity_; }
>  	const std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }
>  	const std::vector<Size> &sizes() const { return sizes_; }
> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> index 3952d16b053ae20e..157e1d34a03a4a8e 100644
> --- a/src/libcamera/camera_sensor.cpp
> +++ b/src/libcamera/camera_sensor.cpp
> @@ -291,6 +291,16 @@ int CameraSensor::init()
>   * \return The sensor model name
>   */
>  
> +/**
> + * \fn CameraSensor::id()
> + * \brief Retrieve the sensor ID
> + *
> + * The sensor ID is a free-form string that uniquely identifies the sensor in
> + * the system. The ID satisfy the requirements to be used as a camera ID.
> + *
> + * \return The sensor ID
> + */
> +
>  /**
>   * \fn CameraSensor::entity()
>   * \brief Retrieve the sensor media entity
Jacopo Mondi Aug. 5, 2020, 7:29 a.m. UTC | #2
Hi Niklas, Laurent,

On Tue, Aug 04, 2020 at 09:24:09PM +0300, Laurent Pinchart wrote:
> Hi Niklas,
>
> Thank you for the patch.
>
> On Tue, Aug 04, 2020 at 06:13:54PM +0200, Niklas Söderlund wrote:
> > Add an accessors so that the sensor ID can be used outside CameraSensor.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
>
> I think you could squash it with 4/9.
>

I pointed out to Niklas in v6 review that those two were actually two
changes. I know Niklas likes smaller patches, I was trying to make him
happier :D

> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> > ---
> >  include/libcamera/internal/camera_sensor.h |  1 +
> >  src/libcamera/camera_sensor.cpp            | 10 ++++++++++
> >  2 files changed, 11 insertions(+)
> >
> > diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
> > index 0f65fca46877e89a..b9eba89f00fba882 100644
> > --- a/include/libcamera/internal/camera_sensor.h
> > +++ b/include/libcamera/internal/camera_sensor.h
> > @@ -47,6 +47,7 @@ public:
> >  	int init();
> >
> >  	const std::string &model() const { return model_; }
> > +	const std::string &id() const { return id_; }
> >  	const MediaEntity *entity() const { return entity_; }
> >  	const std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }
> >  	const std::vector<Size> &sizes() const { return sizes_; }
> > diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> > index 3952d16b053ae20e..157e1d34a03a4a8e 100644
> > --- a/src/libcamera/camera_sensor.cpp
> > +++ b/src/libcamera/camera_sensor.cpp
> > @@ -291,6 +291,16 @@ int CameraSensor::init()
> >   * \return The sensor model name
> >   */
> >
> > +/**
> > + * \fn CameraSensor::id()
> > + * \brief Retrieve the sensor ID
> > + *
> > + * The sensor ID is a free-form string that uniquely identifies the sensor in
> > + * the system. The ID satisfy the requirements to be used as a camera ID.
> > + *
> > + * \return The sensor ID
> > + */
> > +
> >  /**
> >   * \fn CameraSensor::entity()
> >   * \brief Retrieve the sensor media entity
>
> --
> Regards,
>
> Laurent Pinchart
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Niklas Söderlund Aug. 5, 2020, 9:25 a.m. UTC | #3
On 2020-08-05 09:29:45 +0200, Jacopo Mondi wrote:
> Hi Niklas, Laurent,
> 
> On Tue, Aug 04, 2020 at 09:24:09PM +0300, Laurent Pinchart wrote:
> > Hi Niklas,
> >
> > Thank you for the patch.
> >
> > On Tue, Aug 04, 2020 at 06:13:54PM +0200, Niklas Söderlund wrote:
> > > Add an accessors so that the sensor ID can be used outside CameraSensor.
> > >
> > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> >
> > I think you could squash it with 4/9.
> >
> 
> I pointed out to Niklas in v6 review that those two were actually two
> changes. I know Niklas likes smaller patches, I was trying to make him
> happier :D

And I thank you for it :-)

> 
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >
> 
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
> 
> Thanks
>   j
> 
> > > ---
> > >  include/libcamera/internal/camera_sensor.h |  1 +
> > >  src/libcamera/camera_sensor.cpp            | 10 ++++++++++
> > >  2 files changed, 11 insertions(+)
> > >
> > > diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
> > > index 0f65fca46877e89a..b9eba89f00fba882 100644
> > > --- a/include/libcamera/internal/camera_sensor.h
> > > +++ b/include/libcamera/internal/camera_sensor.h
> > > @@ -47,6 +47,7 @@ public:
> > >  	int init();
> > >
> > >  	const std::string &model() const { return model_; }
> > > +	const std::string &id() const { return id_; }
> > >  	const MediaEntity *entity() const { return entity_; }
> > >  	const std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }
> > >  	const std::vector<Size> &sizes() const { return sizes_; }
> > > diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> > > index 3952d16b053ae20e..157e1d34a03a4a8e 100644
> > > --- a/src/libcamera/camera_sensor.cpp
> > > +++ b/src/libcamera/camera_sensor.cpp
> > > @@ -291,6 +291,16 @@ int CameraSensor::init()
> > >   * \return The sensor model name
> > >   */
> > >
> > > +/**
> > > + * \fn CameraSensor::id()
> > > + * \brief Retrieve the sensor ID
> > > + *
> > > + * The sensor ID is a free-form string that uniquely identifies the sensor in
> > > + * the system. The ID satisfy the requirements to be used as a camera ID.
> > > + *
> > > + * \return The sensor ID
> > > + */
> > > +
> > >  /**
> > >   * \fn CameraSensor::entity()
> > >   * \brief Retrieve the sensor media entity
> >
> > --
> > Regards,
> >
> > Laurent Pinchart
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel@lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
index 0f65fca46877e89a..b9eba89f00fba882 100644
--- a/include/libcamera/internal/camera_sensor.h
+++ b/include/libcamera/internal/camera_sensor.h
@@ -47,6 +47,7 @@  public:
 	int init();
 
 	const std::string &model() const { return model_; }
+	const std::string &id() const { return id_; }
 	const MediaEntity *entity() const { return entity_; }
 	const std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }
 	const std::vector<Size> &sizes() const { return sizes_; }
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 3952d16b053ae20e..157e1d34a03a4a8e 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -291,6 +291,16 @@  int CameraSensor::init()
  * \return The sensor model name
  */
 
+/**
+ * \fn CameraSensor::id()
+ * \brief Retrieve the sensor ID
+ *
+ * The sensor ID is a free-form string that uniquely identifies the sensor in
+ * the system. The ID satisfy the requirements to be used as a camera ID.
+ *
+ * \return The sensor ID
+ */
+
 /**
  * \fn CameraSensor::entity()
  * \brief Retrieve the sensor media entity