libcamera: v4l2_controls: Fix usage of strerror()
On failure, the return code from V4L2Device::ioctl() is the negative error code set by the failed ::ioctl() system call. When the return code of V4L2Device::ioctl() is provided to strerror() it has to be negated again to obtain the positive error code. Fix a few wrong usages of the return code which provided to the strerror() function a negative error code. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
ad5d123578
commit
e0808528d8
1 changed files with 4 additions and 4 deletions
|
@ -201,13 +201,13 @@ int V4L2Device::getControls(ControlList *ctrls)
|
||||||
/* Generic validation error. */
|
/* Generic validation error. */
|
||||||
if (errorIdx == 0 || errorIdx >= count) {
|
if (errorIdx == 0 || errorIdx >= count) {
|
||||||
LOG(V4L2, Error) << "Unable to read controls: "
|
LOG(V4L2, Error) << "Unable to read controls: "
|
||||||
<< strerror(ret);
|
<< strerror(-ret);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A specific control failed. */
|
/* A specific control failed. */
|
||||||
LOG(V4L2, Error) << "Unable to read control " << errorIdx
|
LOG(V4L2, Error) << "Unable to read control " << errorIdx
|
||||||
<< ": " << strerror(ret);
|
<< ": " << strerror(-ret);
|
||||||
count = errorIdx - 1;
|
count = errorIdx - 1;
|
||||||
ret = errorIdx;
|
ret = errorIdx;
|
||||||
}
|
}
|
||||||
|
@ -291,13 +291,13 @@ int V4L2Device::setControls(ControlList *ctrls)
|
||||||
/* Generic validation error. */
|
/* Generic validation error. */
|
||||||
if (errorIdx == 0 || errorIdx >= count) {
|
if (errorIdx == 0 || errorIdx >= count) {
|
||||||
LOG(V4L2, Error) << "Unable to set controls: "
|
LOG(V4L2, Error) << "Unable to set controls: "
|
||||||
<< strerror(ret);
|
<< strerror(-ret);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A specific control failed. */
|
/* A specific control failed. */
|
||||||
LOG(V4L2, Error) << "Unable to set control " << errorIdx
|
LOG(V4L2, Error) << "Unable to set control " << errorIdx
|
||||||
<< ": " << strerror(ret);
|
<< ": " << strerror(-ret);
|
||||||
count = errorIdx - 1;
|
count = errorIdx - 1;
|
||||||
ret = errorIdx;
|
ret = errorIdx;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue