{"id":17744,"url":"https://patchwork.libcamera.org/api/1.1/patches/17744/?format=json","web_url":"https://patchwork.libcamera.org/patch/17744/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20221102103804.3933874-1-kieran.bingham@ideasonboard.com>","date":"2022-11-02T10:38:04","name":"[libcamera-devel,v2] libcamera: v4l2_device: Workaround faulty control menus","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"bb6fe80df580509d6c98c833da90e2d4a6df3b0f","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17744/mbox/","series":[{"id":3592,"url":"https://patchwork.libcamera.org/api/1.1/series/3592/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3592","date":"2022-11-02T10:38:04","name":"[libcamera-devel,v2] libcamera: v4l2_device: Workaround faulty control menus","version":2,"mbox":"https://patchwork.libcamera.org/series/3592/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17744/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17744/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B0956BDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Nov 2022 10:38:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F21C463075;\n\tWed,  2 Nov 2022 11:38:10 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6C2F063009\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Nov 2022 11:38:09 +0100 (CET)","from Monstersaurus.tail69b4.ts.net\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C377F1226;\n\tWed,  2 Nov 2022 11:38:08 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1667385491;\n\tbh=/gTK0r37EM7Ngj4dcICt+WRXKLmfvvvE/AB/YRWN0y8=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=i+NHXmVccjvIQRa5cIcdNcQXmHQsMJAogB2z1tlWPBRo7TggD9EI5Gv6Ahafbdk5p\n\tuQUdO8FRj78DVvPc3UwucDjHk0idggJlIVRVIxWgMqc2WYJopfbaniM+SuxZooj3S7\n\tHJk9/g0pu6d+Pjkhvyx4tPFGtYYSHsTVDDs9Kj8PNn4WoFrLEn2Mak/ISQXVphgYks\n\tkCoeiayd1PtHwSfEAAS/aY6f+F6GVqJ2AzjcEy8F4pLwdP4uZCXdtN0OhqbwOMWKhx\n\thTuOK88tQ43MA5v+XryOCBwS0NXg7eOvo4icgKjVCxTv9XfjkjEScaKnuldxRAGfZA\n\tirB68XYzda1Nw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1667385489;\n\tbh=/gTK0r37EM7Ngj4dcICt+WRXKLmfvvvE/AB/YRWN0y8=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=RCl5GN/jPmA3Iz1bYwNJ5v0gWpD64FkNsa2qkJ7H0MJU5/RCE6Goi43xMISOg/2AC\n\tgioj5gU/SF75ZAMeFGwotobOoZ6KakLa7+Jb1fUg8ff5b3nTJIhCcWEGG/Y9EHYOIK\n\tB9mTwAVhFq3E2oG3shZ8B2N28BCDzDA4O+8UoXkM="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"RCl5GN/j\"; dkim-atps=neutral","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Wed,  2 Nov 2022 10:38:04 +0000","Message-Id":"<20221102103804.3933874-1-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2] libcamera: v4l2_device: Workaround\n\tfaulty control menus","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Marian Buschsieweke <marian.buschsieweke@ovgu.de>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Some UVC cameras have been identified that can provide V4L2 menu\ncontrols without any menu items.\n\nThis leads to a segfault where we try to construct a\nControlInfo(Span<>,default) with an empty span.\n\nReturning ControlInfo(); instead results in a Fatal log error due to the\ncontrol validation failing.\n\nProvide the default value as the only acceptable menu control item, and\nreport the issue on the debug log.\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=167\nReported-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\nv2:\n - Sigh, I forgot the SoB/Trailers in the commit message.\n\n src/libcamera/v4l2_device.cpp | 10 ++++++++++\n 1 file changed, 10 insertions(+)","diff":"diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex c17b323f8af0..f35820271f51 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -583,6 +583,16 @@ ControlInfo V4L2Device::v4l2MenuControlInfo(const struct v4l2_query_ext_ctrl &ct\n \t\tindices.push_back(index);\n \t}\n \n+\t/*\n+\t * Some faulty UVC drivers are known to return an empty menu control.\n+\t * In that event, populate the indicies with the default value only.\n+\t */\n+\tif (indices.size() == 0) {\n+\t\tLOG(V4L2, Debug)\n+\t\t\t<< \"Menu control '\" << ctrl.name << \"' has no entries\";\n+\t\tindices.push_back(static_cast<int32_t>(ctrl.default_value));\n+\t}\n+\n \treturn ControlInfo(indices,\n \t\t\t   ControlValue(static_cast<int32_t>(ctrl.default_value)));\n }\n","prefixes":["libcamera-devel","v2"]}