[libcamera-devel] [PATCH 2/2] libcamera: v4l2_videodevice: Print fd value in log prefix
paul.elder at ideasonboard.com
paul.elder at ideasonboard.com
Thu Mar 4 05:21:47 CET 2021
Hi Laurent,
On Wed, Mar 03, 2021 at 07:16:31PM +0200, Laurent Pinchart wrote:
> Hi Kieran,
>
> On Wed, Mar 03, 2021 at 04:41:47PM +0000, Kieran Bingham wrote:
> > On 03/03/2021 16:37, Laurent Pinchart wrote:
> > > When opening a V4L2VideoDevice multiple times, for instance to run
> > > multiple jobs on a M2M device, it's useful to attribute log messages to
> > > a particular instance. Include the device fd in the log prefix.
> >
> > An example of how the change looks in the output might have been nice here.
> >
> > It looks like it goes from
> >
> > [out] or [cap]
> > to
> > [234:out] or [234:cap]
>
> Good point. I'll add
>
> This turns the existing output
>
> [1:43:01.958321522] [277] DEBUG V4L2 v4l2_videodevice.cpp:1440 /dev/video0[cap]: Queueing buffer 0
> [1:43:01.958350060] [277] DEBUG V4L2 v4l2_videodevice.cpp:1440 /dev/video0[cap]: Queueing buffer 1
> [1:43:01.958365137] [277] DEBUG V4L2 v4l2_videodevice.cpp:1440 /dev/video0[cap]: Queueing buffer 2
>
> into
>
> [1:43:01.958321522] [277] DEBUG V4L2 v4l2_videodevice.cpp:1440 /dev/video0[14:cap]: Queueing buffer 0
> [1:43:01.958350060] [277] DEBUG V4L2 v4l2_videodevice.cpp:1440 /dev/video0[14:cap]: Queueing buffer 1
> [1:43:01.958365137] [277] DEBUG V4L2 v4l2_videodevice.cpp:1440 /dev/video0[14:cap]: Queueing buffer 2
>
With this,
Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
> > Which is fine by me, and gives each context a unique reference.
> >
> > We could choose to do that only on M2M nodes if those are the only ones
> > that are possible to open multiple times ... but maybe that's overkill
> > and would require more processing in this code path.
>
> That, and it may make it more difficult for scripts to process the log,
> if needed.
>
> > Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> >
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > > ---
> > > src/libcamera/v4l2_videodevice.cpp | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> > > index c77e1aff7978..cb52d4cea3f6 100644
> > > --- a/src/libcamera/v4l2_videodevice.cpp
> > > +++ b/src/libcamera/v4l2_videodevice.cpp
> > > @@ -711,7 +711,8 @@ void V4L2VideoDevice::close()
> > >
> > > std::string V4L2VideoDevice::logPrefix() const
> > > {
> > > - return deviceNode() + (V4L2_TYPE_IS_OUTPUT(bufferType_) ? "[out]" : "[cap]");
> > > + return deviceNode() + "[" + std::to_string(fd()) +
> > > + (V4L2_TYPE_IS_OUTPUT(bufferType_) ? ":out]" : ":cap]");
> > > }
> > >
> > > /**
>
> --
> Regards,
>
> Laurent Pinchart
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
More information about the libcamera-devel
mailing list