{"id":15696,"url":"https://patchwork.libcamera.org/api/1.1/patches/15696/?format=json","web_url":"https://patchwork.libcamera.org/patch/15696/","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":"<mailman.202.1650534820.20186.libcamera-devel@lists.libcamera.org>","date":"2022-04-21T09:53:20","name":"[libcamera-devel,v2] libcamera: Test sensor's ability to discover ancillary devices","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"5e80f549099f6f83585e826837f41d1523a2a434","submitter":{"id":119,"url":"https://patchwork.libcamera.org/api/1.1/people/119/?format=json","name":"Yunke Cao","email":"yunkec@google.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15696/mbox/","series":[{"id":3063,"url":"https://patchwork.libcamera.org/api/1.1/series/3063/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3063","date":"2022-04-21T09:53:20","name":"[libcamera-devel,v2] libcamera: Test sensor's ability to discover ancillary devices","version":2,"mbox":"https://patchwork.libcamera.org/series/3063/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15696/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15696/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 54604C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Apr 2022 09:53:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8A50665646;\n\tThu, 21 Apr 2022 11:53:41 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1650534821;\n\tbh=ouWoPtX3SoW1qnwMdzIIoQAkFwRLeKv59jj9/+2VY3I=;\n\th=Date:In-Reply-To:References:To:List-Id:List-Post:From:Cc:\n\tList-Subscribe:List-Unsubscribe:List-Archive:Reply-To:List-Help:\n\tSubject:From;\n\tb=Z9NQD7Gu8S18EsTizYv/Q2lP7XZqzW8l18uqzAo8sj0KHxPhZIfWbVJclmAeRrhFM\n\tVfhazD84sDnnv/tuNcoLXxZoVIMMb93arXZl5ostWjGF+12HTHREbuH5nLLWTMVYeJ\n\tDmWn9nowgfZ/lyU/ixdr8/5AXO7FHZ5qHDKZglk/oErirxLAs4LVzHztcT8IvkUZwL\n\t1GQOqWGQf4Z8HEZAmnWSfN+gleStOWuyr0n/d8uP2tltTDm/zUrNhwfv30xMhlHaQG\n\tXH64mRd1efzVJTHpavkUSMuWS8i/CCShBpKAqMjAEfXb6zNzI7BoWZ2oyQn2dKt+7W\n\trWm51AX766/YA==","Date":"Thu, 21 Apr 2022 18:53:20 +0900","In-Reply-To":"<165052542462.3002092.9959330002688816513@Monstersaurus>","References":"<165052542462.3002092.9959330002688816513@Monstersaurus>","To":"Han-lin Chen <hanlinchen@google.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Message-ID":"<mailman.202.1650534820.20186.libcamera-devel@lists.libcamera.org>","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","From":"Yunke Cao via libcamera-devel <libcamera-devel@lists.libcamera.org>","Precedence":"list","Cc":"Tomasz Figa <tfiga@google.com>, libcamera-devel@lists.libcamera.org,\n\tYunke Cao <yunkec@google.com>","X-Mailman-Version":"2.1.29","X-BeenThere":"libcamera-devel@lists.libcamera.org","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","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/>","Reply-To":"Yunke Cao <yunkec@google.com>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","Subject":"[libcamera-devel] [PATCH v2] libcamera: Test sensor's ability to\n\tdiscover ancillary devices","Content-Type":"message/rfc822","Content-Disposition":"inline","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Use vimc lens to test sensor's ability to discover ancillary lens.\n\nTested with/without the recent kernel patch for vimc lens:\nhttps://lore.kernel.org/linux-media/20220415023855.2568366-1-yunkec@google.com/\n\nSigned-off-by: Yunke Cao <yunkec@google.com>\n---\nChangelog since v1:\n - Dont fail test when lens is not present.\n - Remove lens from dm.\n - Tested on both kernels with/without the vimc lens patch.\n\n src/libcamera/camera_sensor.cpp |  5 +++++\n test/camera-sensor.cpp          | 12 ++++++++++++\n 2 files changed, 17 insertions(+)","diff":"diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex eaa2da6b..fe366267 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -152,6 +152,11 @@ int CameraSensor::init()\n \t */\n \tif (entity_->device()->driver() == \"vimc\") {\n \t\tinitVimcDefaultProperties();\n+\n+\t\tret = discoverAncillaryDevices();\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n \t\treturn initProperties();\n \t}\n \ndiff --git a/test/camera-sensor.cpp b/test/camera-sensor.cpp\nindex 372ee4af..d1bb639a 100644\n--- a/test/camera-sensor.cpp\n+++ b/test/camera-sensor.cpp\n@@ -12,6 +12,7 @@\n \n #include <libcamera/base/utils.h>\n \n+#include \"libcamera/internal/camera_lens.h\"\n #include \"libcamera/internal/camera_sensor.h\"\n #include \"libcamera/internal/device_enumerator.h\"\n #include \"libcamera/internal/media_device.h\"\n@@ -57,6 +58,11 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\tlens_ = sensor_->focusLens();\n+\t\tif (lens_) {\n+\t\t\tcout << \"Found lens\" << endl;\n+\t\t}\n+\n \t\treturn TestPass;\n \t}\n \n@@ -104,6 +110,11 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\tif (lens_ && lens_->setFocusPosition(10)) {\n+\t\t\tcerr << \"Failed to set lens focus position\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\treturn TestPass;\n \t}\n \n@@ -116,6 +127,7 @@ private:\n \tstd::unique_ptr<DeviceEnumerator> enumerator_;\n \tstd::shared_ptr<MediaDevice> media_;\n \tCameraSensor *sensor_;\n+\tCameraLens *lens_;\n };\n \n TEST_REGISTER(CameraSensorTest)\n","prefixes":["libcamera-devel","v2"]}