[libcamera-devel] [PATCH v3 2/3] libcamera: Add V4L2 Device object

Niklas Söderlund niklas.soderlund at ragnatech.se
Wed Jan 16 15:54:23 CET 2019


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.

> 
> > +		return ret;
> > +	}

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list