[libcamera-devel,01/14] libcamera: device_enumerator: Print media device name in error message

Message ID 20190818011329.14499-2-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Assorted fixes for Android camera HAL
Related show

Commit Message

Laurent Pinchart Aug. 18, 2019, 1:13 a.m. UTC
The device enumerator logs an error message when a media device is
removed while still in use. Add the device name to the message to help
debugging.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/device_enumerator.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jacopo Mondi Aug. 19, 2019, 8:57 a.m. UTC | #1
Hi Laurent,

On Sun, Aug 18, 2019 at 04:13:16AM +0300, Laurent Pinchart wrote:
> The device enumerator logs an error message when a media device is
> removed while still in use. Add the device name to the message to help
> debugging.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/libcamera/device_enumerator.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp
> index 6fcbae76b64e..60c918f0e26f 100644
> --- a/src/libcamera/device_enumerator.cpp
> +++ b/src/libcamera/device_enumerator.cpp
> @@ -166,7 +166,8 @@ DeviceEnumerator::~DeviceEnumerator()
>  	for (std::shared_ptr<MediaDevice> media : devices_) {
>  		if (media->busy())
>  			LOG(DeviceEnumerator, Error)
> -				<< "Removing media device while still in use";
> +				<< "Removing media device " << media->deviceNode()
> +				<< " while still in use";

just wondering if we want quotes around the media device name.

Apart for this minor
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

>  	}
>  }
>
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart Aug. 19, 2019, 3:07 p.m. UTC | #2
Hi Jacopo,

On Mon, Aug 19, 2019 at 10:57:01AM +0200, Jacopo Mondi wrote:
> On Sun, Aug 18, 2019 at 04:13:16AM +0300, Laurent Pinchart wrote:
> > The device enumerator logs an error message when a media device is
> > removed while still in use. Add the device name to the message to help
> > debugging.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  src/libcamera/device_enumerator.cpp | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp
> > index 6fcbae76b64e..60c918f0e26f 100644
> > --- a/src/libcamera/device_enumerator.cpp
> > +++ b/src/libcamera/device_enumerator.cpp
> > @@ -166,7 +166,8 @@ DeviceEnumerator::~DeviceEnumerator()
> >  	for (std::shared_ptr<MediaDevice> media : devices_) {
> >  		if (media->busy())
> >  			LOG(DeviceEnumerator, Error)
> > -				<< "Removing media device while still in use";
> > +				<< "Removing media device " << media->deviceNode()
> > +				<< " while still in use";
> 
> just wondering if we want quotes around the media device name.

I tend to use quotes only when the string can be empty or can include
spaces. In this case I think they're not needed.

> Apart for this minor
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
> 
> >  	}
> >  }
> >

Patch

diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp
index 6fcbae76b64e..60c918f0e26f 100644
--- a/src/libcamera/device_enumerator.cpp
+++ b/src/libcamera/device_enumerator.cpp
@@ -166,7 +166,8 @@  DeviceEnumerator::~DeviceEnumerator()
 	for (std::shared_ptr<MediaDevice> media : devices_) {
 		if (media->busy())
 			LOG(DeviceEnumerator, Error)
-				<< "Removing media device while still in use";
+				<< "Removing media device " << media->deviceNode()
+				<< " while still in use";
 	}
 }