{"id":638,"url":"https://patchwork.libcamera.org/api/patches/638/?format=json","web_url":"https://patchwork.libcamera.org/patch/638/","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":"<20190226162641.12116-9-jacopo@jmondi.org>","date":"2019-02-26T16:26:41","name":"[libcamera-devel,v3,8/8] libcamera: v4l2_subdevice: Inherit from Loggable","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d961949d7d08dd87e1db92a6f230e5497cc421dc","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/638/mbox/","series":[{"id":193,"url":"https://patchwork.libcamera.org/api/series/193/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=193","date":"2019-02-26T16:26:33","name":"v4l2_(sub)dev: improvements and tests","version":3,"mbox":"https://patchwork.libcamera.org/series/193/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/638/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/638/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 2A09D610CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Feb 2019 17:26:23 +0100 (CET)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id AEDDD60002;\n\tTue, 26 Feb 2019 16:26:22 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 Feb 2019 17:26:41 +0100","Message-Id":"<20190226162641.12116-9-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190226162641.12116-1-jacopo@jmondi.org>","References":"<20190226162641.12116-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 8/8] libcamera: v4l2_subdevice: Inherit\n\tfrom Loggable","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Tue, 26 Feb 2019 16:26:23 -0000"},"content":"Prefix the V4L2Subdevice error messages with the name of the entity.\nRemove the manually printed name from log messages where it was used.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/v4l2_subdevice.h |  7 ++++++-\n src/libcamera/v4l2_subdevice.cpp       | 10 ++++------\n 2 files changed, 10 insertions(+), 7 deletions(-)","diff":"diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\nindex 6b21308d2087..dcf38d719fcb 100644\n--- a/src/libcamera/include/v4l2_subdevice.h\n+++ b/src/libcamera/include/v4l2_subdevice.h\n@@ -13,6 +13,8 @@\n \n #include \"media_object.h\"\n \n+#include \"log.h\"\n+\n namespace libcamera {\n \n struct Rectangle;\n@@ -23,7 +25,7 @@ struct V4L2SubdeviceFormat {\n \tuint32_t height;\n };\n \n-class V4L2Subdevice\n+class V4L2Subdevice : protected Loggable\n {\n public:\n \texplicit V4L2Subdevice(const MediaEntity *entity);\n@@ -44,6 +46,9 @@ public:\n \tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format);\n \tint setFormat(unsigned int pad, V4L2SubdeviceFormat *format);\n \n+protected:\n+\tstd::string logPrefix() const { return \"'\" + deviceName() + \"'\"; }\n+\n private:\n \tint listPadSizes(unsigned int pad, unsigned int mbus_code,\n \t\t\t std::vector<V4L2SubdeviceFormat> *formats);\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex a043a07ff156..20439b895b99 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -222,7 +222,7 @@ int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format)\n \t\tret = -errno;\n \t\tLOG(V4L2Subdev, Error)\n \t\t\t<< \"Unable to get format on pad \" << pad\n-\t\t\t<< \" of \" << deviceName() << \": \" << strerror(-ret);\n+\t\t\t<< \": \" << strerror(-ret);\n \t\treturn ret;\n \t}\n \n@@ -311,8 +311,7 @@ int V4L2Subdevice::listPadSizes(unsigned int pad, unsigned int mbus_code,\n \tif (ret && (errno != EINVAL && errno != ENOTTY)) {\n \t\tLOG(V4L2Subdev, Error)\n \t\t\t<< \"Unable to enumerate format on pad \" << pad\n-\t\t\t<< \" of \" << deviceName() << \": \"\n-\t\t\t<< strerror(errno);\n+\t\t\t<< \": \" << strerror(errno);\n \t\treturn ret;\n \t}\n \n@@ -340,7 +339,7 @@ std::vector<V4L2SubdeviceFormat> V4L2Subdevice::listPadFormats(unsigned int pad)\n \tif (ret && (errno != EINVAL && errno != ENOTTY)) {\n \t\tLOG(V4L2Subdev, Error)\n \t\t\t<< \"Unable to enumerate format on pad \" << pad\n-\t\t\t<< \" of \" << deviceName() << \": \" << strerror(-ret);\n+\t\t\t<< \": \" << strerror(-ret);\n \t\treturn formats;\n \t}\n \n@@ -380,8 +379,7 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n \t\tret = -errno;\n \t\tLOG(V4L2Subdev, Error)\n \t\t\t<< \"Unable to set rectangle \" << target << \" on pad \"\n-\t\t\t<< pad << \" of \" << deviceName() << \": \"\n-\t\t\t<< strerror(-ret);\n+\t\t\t<< \": \" << strerror(-ret);\n \t\treturn ret;\n \t}\n \n","prefixes":["libcamera-devel","v3","8/8"]}