{"id":3070,"url":"https://patchwork.libcamera.org/api/patches/3070/?format=json","web_url":"https://patchwork.libcamera.org/patch/3070/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200309162414.720306-6-jacopo@jmondi.org>","date":"2020-03-09T16:24:08","name":"[libcamera-devel,05/11] libcamera: v4l2_controls: Fix usage of strerror()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"79ab94f5cfa5ad6589c57e7c412dc973696c8ddb","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3070/mbox/","series":[{"id":716,"url":"https://patchwork.libcamera.org/api/series/716/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=716","date":"2020-03-09T16:24:03","name":"Adda support for V4L2 array control and strings","version":1,"mbox":"https://patchwork.libcamera.org/series/716/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3070/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3070/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 14BEB6292C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Mar 2020 17:21:30 +0100 (CET)","from uno.lan (93-34-114-233.ip49.fastwebnet.it [93.34.114.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id BB22460019\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Mar 2020 16:21:29 +0000 (UTC)"],"X-Originating-IP":"93.34.114.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  9 Mar 2020 17:24:08 +0100","Message-Id":"<20200309162414.720306-6-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.25.0","In-Reply-To":"<20200309162414.720306-1-jacopo@jmondi.org>","References":"<20200309162414.720306-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 05/11] libcamera: v4l2_controls: Fix usage\n\tof strerror()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 09 Mar 2020 16:21:32 -0000"},"content":"On failure, the return code from V4L2Device::ioctl() is the negative error\ncode set by the failed ::ioctl() system call. When the return code of\nV4L2Device::ioctl() is provided to strerror() it has to be negated again\nto obtain the positive error code. Fix a few wrong usages of the return\ncode which provided to the strerror() function a negative error code.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/v4l2_device.cpp | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)","diff":"diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 98639bd0f07f..179476e9afad 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -201,13 +201,13 @@ int V4L2Device::getControls(ControlList *ctrls)\n \t\t/* Generic validation error. */\n \t\tif (errorIdx == 0 || errorIdx >= count) {\n \t\t\tLOG(V4L2, Error) << \"Unable to read controls: \"\n-\t\t\t\t\t << strerror(ret);\n+\t\t\t\t\t << strerror(-ret);\n \t\t\treturn -EINVAL;\n \t\t}\n \n \t\t/* A specific control failed. */\n \t\tLOG(V4L2, Error) << \"Unable to read control \" << errorIdx\n-\t\t\t\t << \": \" << strerror(ret);\n+\t\t\t\t << \": \" << strerror(-ret);\n \t\tcount = errorIdx - 1;\n \t\tret = errorIdx;\n \t}\n@@ -291,13 +291,13 @@ int V4L2Device::setControls(ControlList *ctrls)\n \t\t/* Generic validation error. */\n \t\tif (errorIdx == 0 || errorIdx >= count) {\n \t\t\tLOG(V4L2, Error) << \"Unable to set controls: \"\n-\t\t\t\t\t << strerror(ret);\n+\t\t\t\t\t << strerror(-ret);\n \t\t\treturn -EINVAL;\n \t\t}\n \n \t\t/* A specific control failed. */\n \t\tLOG(V4L2, Error) << \"Unable to set control \" << errorIdx\n-\t\t\t\t << \": \" << strerror(ret);\n+\t\t\t\t << \": \" << strerror(-ret);\n \t\tcount = errorIdx - 1;\n \t\tret = errorIdx;\n \t}\n","prefixes":["libcamera-devel","05/11"]}