{"id":14364,"url":"https://patchwork.libcamera.org/api/patches/14364/?format=json","web_url":"https://patchwork.libcamera.org/patch/14364/","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":"<20211027100441.18248-1-ecurtin@redhat.com>","date":"2021-10-27T10:04:41","name":"[libcamera-devel] Add option to list displays","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"309ec3a252b659cce886e16a4bcd886d2d9fdb11","submitter":{"id":101,"url":"https://patchwork.libcamera.org/api/people/101/?format=json","name":"Eric Curtin","email":"ecurtin@redhat.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14364/mbox/","series":[{"id":2661,"url":"https://patchwork.libcamera.org/api/series/2661/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2661","date":"2021-10-27T10:04:41","name":"[libcamera-devel] Add option to list displays","version":1,"mbox":"https://patchwork.libcamera.org/series/2661/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14364/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14364/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 30638BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 10:04:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 62C636487F;\n\tWed, 27 Oct 2021 12:04:52 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 67CC460123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 12:04:50 +0200 (CEST)","from mail-wr1-f69.google.com (mail-wr1-f69.google.com\n\t[209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id\n\tus-mta-322-gWhfY46AOCqLtQUxQlnVhA-1; Wed, 27 Oct 2021 06:04:48 -0400","by mail-wr1-f69.google.com with SMTP id\n\ty16-20020a5d4710000000b0017440201e67so14997wrq.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 03:04:47 -0700 (PDT)","from curtine-ThinkPad-P1-Gen-3.Home\n\t([2001:8a0:6724:4500:dc68:d331:1862:9fcb])\n\tby smtp.gmail.com with ESMTPSA id\n\tm31sm2939905wms.25.2021.10.27.03.04.45\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 27 Oct 2021 03:04:45 -0700 (PDT)"],"Authentication-Results":["lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"dyhXrimc\"; dkim-atps=neutral","relay.mimecast.com;\n\tauth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ecurtin@redhat.com"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1635329089;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding;\n\tbh=SEg20IqA7hpAe955Ml6b0M8foz2Mvi76Cv12myjT9sI=;\n\tb=dyhXrimcbval2VmdR2RMzCAx1VL6l9Kou9EAuf/JxJlnkDnAyVX+u46CEbxxCNKabG5oYm\n\tHjRLKbNszX8j1KK/sd69LHiPLDWsTptpqI/bzs2VXRQftuN3JaFGa0+7xU4cCf+r8Y2Yq3\n\tyGNT1csxDLyKnW+RWi9VCkr0e7dIHH4=","X-MC-Unique":"gWhfY46AOCqLtQUxQlnVhA-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=SEg20IqA7hpAe955Ml6b0M8foz2Mvi76Cv12myjT9sI=;\n\tb=CwNxHg/l4XDIqFhVEtCPbo4Htw6BSrnn/FI1lENHQE1ZERWzshMW7uO3uuM8/fVoqP\n\tEOVzK9XWfpONlBJKAgFHolqyM/QG0NTdiZZVrBw6p8MwJKygWuqei7ltNtcXMizHGwB8\n\tWhXnFp8rGbDkyZFwm0H8Qzr04NhkymSoqdDxFwKF2jERRqvLTh7Rx2+FbP7A6xeCQicF\n\tJ0GsWSXltSjKXENan1kB31NRtFZ8K0LM6RNTrnfXno5nYguiFV7YP2TXCg4+XiartcCa\n\tWfHI3PK5K4l75b76gSRpmADaa6VELceHlGTsc+3h4DCd2+qLwgyP1tPOwCSr5KImzk3+\n\tlSfQ==","X-Gm-Message-State":"AOAM533qwYieLfFFrpuynhCU874bmjbVzjQ6+DISTio0PplaVttc0rE6\n\tJfO4a29TWfOKx/KQ4HoyzFeRKwli5VwEe6BGN+eMZyYrWJcjnvgCO1UaEDZq7kaj+urkoKNry9k\n\thwYYn7fNcvhtk4CR1gf8g38JBawce5VOiGnlNq6NAe9p/dxmi1sM5aXX+WKi1kn0uRMcHz4ibg6\n\tXkGXgpltYG","X-Received":["by 2002:a7b:ce98:: with SMTP id q24mr4777306wmj.72.1635329086450;\n\tWed, 27 Oct 2021 03:04:46 -0700 (PDT)","by 2002:a7b:ce98:: with SMTP id q24mr4777276wmj.72.1635329086045;\n\tWed, 27 Oct 2021 03:04:46 -0700 (PDT)"],"X-Google-Smtp-Source":"ABdhPJzlg6rLMpGD4mqvgRRKHb1Cup8FTdv2hyw6LjsT2goX4QWp+QF7b9nDhkNgmvAnTtUYHuW/MQ==","From":"Eric Curtin <ecurtin@redhat.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 27 Oct 2021 11:04:41 +0100","Message-Id":"<20211027100441.18248-1-ecurtin@redhat.com>","X-Mailer":"git-send-email 2.31.1","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain; charset=\"US-ASCII\"","Subject":"[libcamera-devel] [PATCH] Add option to list displays","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"xrand --query isn't always available and does not always display all\nconneted connectors.\n\nSigned-off-by: Eric Curtin <ecurtin@redhat.com>\n---\n src/cam/main.cpp | 31 ++++++++++++++++++++++++++-----\n src/cam/main.h   |  3 +++\n 2 files changed, 29 insertions(+), 5 deletions(-)","diff":"diff --git a/src/cam/main.cpp b/src/cam/main.cpp\nindex c7f664b9..319cbf4d 100644\n--- a/src/cam/main.cpp\n+++ b/src/cam/main.cpp\n@@ -15,6 +15,11 @@\n #include <libcamera/property_ids.h>\n \n #include \"camera_session.h\"\n+\n+#ifdef HAVE_KMS\n+#include \"drm.h\"\n+#endif\n+\n #include \"event_loop.h\"\n #include \"main.h\"\n #include \"options.h\"\n@@ -137,6 +142,7 @@ int CamApp::parseOptions(int argc, char *argv[])\n \t\t\t \"Display viewfinder through DRM/KMS on specified connector\",\n \t\t\t \"display\", ArgumentOptional, \"connector\", false,\n \t\t\t OptCamera);\n+\tparser.addOption(OptListDisplays, OptionNone, \"List all displays\", \"list-displays\");\n #endif\n \tparser.addOption(OptFile, OptionString,\n \t\t\t \"Write captured frames to disk\\n\"\n@@ -202,7 +208,22 @@ int CamApp::run()\n \t\t}\n \t}\n \n-\t/* 2. Create the camera sessions. */\n+#ifdef HAVE_KMS\n+\t/* 2. List all displays. */\n+\tif (options_.isSet(OptListDisplays)) {\n+\t\tstd::cout << \"Available displays:\" << std::endl;\n+\n+\t\tDRM::Device dev;\n+\t\tdev.init();\n+\t\tfor (const DRM::Connector &conn : dev.connectors()) {\n+\t\t\tif (conn.status() == DRM::Connector::Connected) {\n+\t\t\t\tstd::cout << conn.name() << std::endl;\n+\t\t\t}\n+\t\t}\n+\t}\n+#endif\n+\n+\t/* 3. Create the camera sessions. */\n \tstd::vector<std::unique_ptr<CameraSession>> sessions;\n \n \tif (options_.isSet(OptCamera)) {\n@@ -229,7 +250,7 @@ int CamApp::run()\n \t\t}\n \t}\n \n-\t/* 3. Print camera information. */\n+\t/* 4. Print camera information. */\n \tif (options_.isSet(OptListControls) ||\n \t    options_.isSet(OptListProperties) ||\n \t    options_.isSet(OptInfo)) {\n@@ -243,7 +264,7 @@ int CamApp::run()\n \t\t}\n \t}\n \n-\t/* 4. Start capture. */\n+\t/* 5. Start capture. */\n \tfor (const auto &session : sessions) {\n \t\tif (!session->options().isSet(OptCapture))\n \t\t\tcontinue;\n@@ -257,7 +278,7 @@ int CamApp::run()\n \t\tloopUsers_++;\n \t}\n \n-\t/* 5. Enable hotplug monitoring. */\n+\t/* 6. Enable hotplug monitoring. */\n \tif (options_.isSet(OptMonitor)) {\n \t\tstd::cout << \"Monitoring new hotplug and unplug events\" << std::endl;\n \t\tstd::cout << \"Press Ctrl-C to interrupt\" << std::endl;\n@@ -271,7 +292,7 @@ int CamApp::run()\n \tif (loopUsers_)\n \t\tloop_.exec();\n \n-\t/* 6. Stop capture. */\n+\t/* 7. Stop capture. */\n \tfor (const auto &session : sessions) {\n \t\tif (!session->options().isSet(OptCapture))\n \t\t\tcontinue;\ndiff --git a/src/cam/main.h b/src/cam/main.h\nindex 1c2fab76..72050d27 100644\n--- a/src/cam/main.h\n+++ b/src/cam/main.h\n@@ -21,6 +21,9 @@ enum {\n \tOptListControls = 256,\n \tOptStrictFormats = 257,\n \tOptMetadata = 258,\n+#ifdef HAVE_KMS\n+\tOptListDisplays = 259\n+#endif\n };\n \n #endif /* __CAM_MAIN_H__ */\n","prefixes":["libcamera-devel"]}