[libcamera-devel] [PATCH] libcamera: v4l2_device: Report device node on failure

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Sep 3 15:47:58 CEST 2022


On Sat, Sep 03, 2022 at 04:37:55PM +0300, Laurent Pinchart via libcamera-devel wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Sat, Sep 03, 2022 at 12:50:42PM +0100, Kieran Bingham via libcamera-devel wrote:
> > When the V4L2Device fails to open, it is not clear what device
> > caused the failure. The Entity name is presented, but not the device
> > node.
> > 
> > Provide it.
> > 
> > Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> > ---
> >  src/libcamera/v4l2_device.cpp | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> > index 1d899657bf7d..29a800a5cee3 100644
> > --- a/src/libcamera/v4l2_device.cpp
> > +++ b/src/libcamera/v4l2_device.cpp
> > @@ -90,6 +90,7 @@ int V4L2Device::open(unsigned int flags)
> >  	if (!fd.isValid()) {
> >  		int ret = -errno;
> >  		LOG(V4L2, Error) << "Failed to open V4L2 device: "
> 
> You can drop the colon at the end of this line.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Actually, as I suspect deviceNode_ to be an empty string in the case
you're trying to address, this would print

[0:23:47.240792321] [8216] ERROR V4L2 v4l2_device.cpp:92 'dw9719 2-000c': Failed to open V4L2 device : No such file or directory

which isn't great. Adding quotes would help

  		LOG(V4L2, Error) << "Failed to open V4L2 device `"
				 << deviceNode_ << "': "
				 << strerror(-ret);

as it would turn the message into

[0:23:47.240792321] [8216] ERROR V4L2 v4l2_device.cpp:92 'dw9719 2-000c': Failed to open V4L2 device `': No such file or directory

> > +				 << deviceNode_ << ": "
> >  				 << strerror(-ret);
> >  		return ret;
> >  	}

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list