[libcamera-devel] [PATCH v3 2/3] libcamera: Add V4L2 Device object
Jacopo Mondi
jacopo at jmondi.org
Wed Jan 16 16:00:49 CET 2019
Hi Niklas,
On Wed, Jan 16, 2019 at 03:54:23PM +0100, Niklas Söderlund wrote:
> Hi Kieran, Jacopo
>
>
>
> On 2019-01-16 09:44:55 +0100, Jacopo Mondi wrote:
>
> [snip]
>
> > > +int V4L2Device::open()
> > > +{
> > > + int ret;
> > > +
> > > + if (isOpen()) {
> > > + LOG(Error) << "Device already open";
> > > + return -EBUSY;
> > > + }
> > > +
> > > + ret = ::open(devnode_.c_str(), O_RDWR);
> > > + if (ret < 0) {
> > > + ret = -errno;
> > > + LOG(Error) << "Failed to open V4L2 device " << devnode_
> > > + << " : " << strerror(ret);
> >
> > strerror(-ret)
> >
> > Even if in this case you could have used errno directly. Sorry, my
> > comment might has mis-lead you
>
> No you can't use errno in the call to strerror() as it might already
> have been been changed by the previous strings passed to LOG(Error),
> unfortunately it needs to be cached.
>
Right, that's why we standardized on that patter... sorry, I've been
sloppy commenting this...
Kieran, pay attention to this in the IOCTL error handling you have a
few lines below these ones...
Thanks
j
> >
> > > + return ret;
> > > + }
>
> --
> Regards,
> Niklas Söderlund
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20190116/1d972698/attachment.sig>
More information about the libcamera-devel
mailing list