From patchwork Thu Jul 6 11:41:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Bara X-Patchwork-Id: 18795 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 0E20CC323E for ; Thu, 6 Jul 2023 11:41:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 63F95628C1; Thu, 6 Jul 2023 13:41:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1688643690; bh=svaVgMmJeTeFlRcLFZlfCCC7WfooFhxjlxuvK2sH6l8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=wkmMiCsQtd56gKq8AKKqPBQE7+5SEI0TDoIq6O0Sntyy0NatufzF/Hn2u/xMVezuB sq0PuJa+G/RHeinjeSED7PlHfMnflr8nx4GBUy9bQD8acQkau9I/eREn7pqbyOkRsO KK4uevfN5mucNHSupZOeKvA8f786K5xRFQZYcIpl2OPOPpzKFAsGL9HGwsUdnXpdWx ZxYJzQhQDjLNbJYmYwKWREkWDh6oobbQRevEtE/T+vlC6Dd3IIMDkFJLhaQzpQ5zoz dqIUfcr7+50oq2LV115GgdiNuXLUCzVyOJh2k3IGBUGaxnNoS2m4Ots1hWkYODt0DC BUzg6ksRYACEA== Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F16C861E36 for ; Thu, 6 Jul 2023 13:41:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hkn2UnMd"; dkim-atps=neutral Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbc5d5746cso6239815e9.2 for ; Thu, 06 Jul 2023 04:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688643688; x=1691235688; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=RNiz3O1qGfnkTZawbK+OJQZhl/fxTx2O5xiq5DI9yfc=; b=hkn2UnMdka+Y2ndTZgyJssgzRJbNIBs1yZr4qPjlR+8e82bCqZyEzikq6qAgrQNAyo riALRCZXvujxeLX+dM2Z1FEzza5DG1em8SwIqiCIzMDQZuF65McgqvkYTZvV929ESXPh XwsgrvgpX55EUhPHnqJCgnlboCPSJUAXYoU8MfrEr9aYDPCduHZbP8H7FhJousSG3RNA mDV2H79SZ/eyWBjrQSKPHlzE+VQF2oOgvP3cBeXQRFRtG3LpvUu8q2n1j5qWrvlmrZsT /cCp48vf6VXlzPoJ1qbveGj2Cej8z0BXn98HM/PDRtBtWPfLru8XE/eWglQ4eBPHSt1E +NJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688643688; x=1691235688; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RNiz3O1qGfnkTZawbK+OJQZhl/fxTx2O5xiq5DI9yfc=; b=lSz5UZe3j8duK1ZV+VhZYqs14vzMQJi5mrQczcA5C7jCgRLLyd1Hm/HLKFLRXVUf+a JPqbMTp8eCYPXtSr6sPzJvNYZz/mgPXgfeCDH2YwM2I5hbfk+Pht1bO4fP5vLXzme8z5 TBI3/RACFxSw7tPaxe4Dj2BpVvrifO6qf1V5vDsddoPtuw8NOJqIVTCbtT5wxYJGl9Ns tfMix56up7cfgm8XOARZXCirSeUjfZB1lR2eFB2tDsokHQCJ6HjSAZzEpd9yB54kucX0 1txAtujxDsSW9hTS1cJMsNlj7RnSmnNP8vgTPwQkE/secaabNaYLp5jQ2KmTiMY0+Lq0 zL1Q== X-Gm-Message-State: ABy/qLaKoMIXdi8dgpqy1ROn1TOBjm2NkV7vHWfMDpuIQE7yoxv+y2FM UeTVEPeyJaSlrE1QzNyEd/KZQwe2OEU= X-Google-Smtp-Source: APBJJlGndTmxCxHcKkrGJW13azFbMTrxhnRoIeWn7fcizRBHn4NmSyycvzifkN/WrI5k47Zf15A4Jg== X-Received: by 2002:a7b:c5d3:0:b0:3fa:934c:8356 with SMTP id n19-20020a7bc5d3000000b003fa934c8356mr1261953wmk.10.1688643688082; Thu, 06 Jul 2023 04:41:28 -0700 (PDT) Received: from [127.0.1.1] ([91.230.2.244]) by smtp.gmail.com with ESMTPSA id 10-20020a05600c024a00b003fa98908014sm4867846wmj.8.2023.07.06.04.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 04:41:27 -0700 (PDT) Date: Thu, 06 Jul 2023 13:41:11 +0200 MIME-Version: 1.0 Message-Id: <20230609-empty-devnode-v3-1-c08f450ba062@skidata.com> X-B4-Tracking: v=1; b=H4sIAFaopmQC/32NQQ6DIBBFr2JYlwbQSO2q92i6GJmxkkYwYEiN8 e4Fd120yzeT99/GIgVLkV2rjQVKNlrvMtSnipkR3JO4xcxMCVWLVnScpnlZOVJyHonXLaJqG22 QBMtOD5F4H8CZsVgTxIVCecyBBvs+QvdH5tHGxYf16CZZrr8SSXLJSZlaG91rNN0tvizCAmfjJ 1a2kvrrq+xfFEhJugEY8Nvf9/0DKWKbpQUBAAA= To: libcamera-devel@lists.libcamera.org X-Mailer: b4 0.12.2 Subject: [libcamera-devel] [PATCH v3] libcamera: device_enumerator: ensure deviceNode is not empty X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Benjamin Bara via libcamera-devel From: Benjamin Bara Reply-To: Benjamin Bara Cc: Benjamin Bara Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Benjamin Bara When activating both ISP nodes on the i.MX8MP, but only connecting one camera sensor, libcamera aborts because it couldn't find the chosen entity's device node: [37:54:40.779902250] [3631] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media1: rkisp1 [37:54:40.780196750] [3631] DEBUG DeviceEnumerator device_enumerator_udev.cpp:322 All dependencies for media device /dev/media0 found [37:54:40.780237875] [3631] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media0: rkisp1 [37:54:40.780505125] [3631] DEBUG Camera camera_manager.cpp:152 Found registered pipeline handler 'PipelineHandlerRkISP1' [37:54:40.780599875] [3631] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "rkisp1" [37:54:40.780731375] [3631] ERROR V4L2 v4l2_device.cpp:93 'rkisp1_isp': Failed to open V4L2 device '': No such file or directory Fix this by skipping empty device nodes: [37:49:05.172672000] [3603] DEBUG DeviceEnumerator device_enumerator_udev.cpp:322 All dependencies for media device /dev/media1 found [37:49:05.172720625] [3603] DEBUG DeviceEnumerator device_enumerator.cpp:256 Added device /dev/media1: rkisp1 [37:49:05.172973875] [3603] DEBUG DeviceEnumerator device_enumerator_udev.cpp:322 All dependencies for media device /dev/media0 found [37:49:05.173012125] [3603] DEBUG DeviceEnumerator device_enumerator.cpp:256 Added device /dev/media0: rkisp1 [37:49:05.173281625] [3603] DEBUG Camera camera_manager.cpp:152 Found registered pipeline handler 'PipelineHandlerRkISP1' [37:49:05.173376875] [3603] DEBUG DeviceEnumerator device_enumerator.cpp:107 Skip rkisp1_isp: no device node [37:49:05.173414375] [3603] DEBUG DeviceEnumerator device_enumerator.cpp:316 Successful match for media device "rkisp1" [37:49:05.173671250] [3603] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video1[15:cap]: Opened device platform:rkisp1: rkisp1: rkisp1_stats [37:49:05.173775125] [3603] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video2[16:out]: Opened device platform:rkisp1: rkisp1: rkisp1_params [37:49:05.173880500] [3603] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video0[18:cap]: Opened device platform:rkisp1: rkisp1: rkisp1 Reviewed-by: Kieran Bingham Signed-off-by: Benjamin Bara Reviewed-by: Laurent Pinchart --- Hi! The dots look like this: /dev/media0: digraph board { rankdir=TB n00000001 [label="{{ 0 | 1} | rkisp1_isp\n | { 2 | 3}}", shape=Mrecord, style=filled, fillcolor=green] n00000001:port2 -> n00000006:port0 n00000001:port3 -> n0000000d [style=bold] n00000006 [label="{{ 0} | rkisp1_resizer_mainpath\n | { 1}}", shape=Mrecord, style=filled, fillcolor=green] n00000006:port1 -> n00000009 [style=bold] n00000009 [label="rkisp1_mainpath\n/dev/video0", shape=box, style=filled, fillcolor=yellow] n0000000d [label="rkisp1_stats\n/dev/video1", shape=box, style=filled, fillcolor=yellow] n00000011 [label="rkisp1_params\n/dev/video2", shape=box, style=filled, fillcolor=yellow] n00000011 -> n00000001:port1 [style=bold] n0000001d [label="{{ 0} | csis-32e40000.csi\n | { 1}}", shape=Mrecord, style=filled, fillcolor=green] n0000001d:port1 -> n00000001:port0 } /dev/media1: digraph board { rankdir=TB n00000001 [label="{{ 0 | 1} | rkisp1_isp\n/dev/v4l-subdev0 | { 2 | 3}}", shape=Mrecord, style=filled, fillcolor=green] n00000001:port2 -> n00000006:port0 n00000001:port3 -> n0000000d [style=bold] n00000006 [label="{{ 0} | rkisp1_resizer_mainpath\n/dev/v4l-subdev1 | { 1}}", shape=Mrecord, style=filled, fillcolor=green] n00000006:port1 -> n00000009 [style=bold] n00000009 [label="rkisp1_mainpath\n/dev/video3", shape=box, style=filled, fillcolor=yellow] n0000000d [label="rkisp1_stats\n/dev/video4", shape=box, style=filled, fillcolor=yellow] n00000011 [label="rkisp1_params\n/dev/video5", shape=box, style=filled, fillcolor=yellow] n00000011 -> n00000001:port1 [style=bold] n0000001d [label="{{ 0} | csis-32e50000.csi\n/dev/v4l-subdev2 | { 1}}", shape=Mrecord, style=filled, fillcolor=green] n0000001d:port1 -> n00000001:port0 n00000022 [label="{{} | imx327 8-001a\n/dev/v4l-subdev3 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] n00000022:port0 -> n0000001d:port0 } --- Changes in v3: - adapt check (thx to Kieran) - Link to v2: https://lists.libcamera.org/pipermail/libcamera-devel/2023-June/038182.html Changes in v2: - adapt commit message - Link to v1: https://lists.libcamera.org/pipermail/libcamera-devel/2023-June/038181.html --- src/libcamera/device_enumerator.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- base-commit: 0ee9339331c648232e87d2de2ccd5a92cc61cab2 change-id: 20230609-empty-devnode-36dd2647cde0 Best regards, diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp index f2e055de..42b5ba6c 100644 --- a/src/libcamera/device_enumerator.cpp +++ b/src/libcamera/device_enumerator.cpp @@ -101,8 +101,14 @@ bool DeviceMatch::match(const MediaDevice *device) const for (const MediaEntity *entity : device->entities()) { if (name == entity->name()) { - found = true; - break; + if (!entity->deviceNode().empty()) { + found = true; + break; + } else { + LOG(DeviceEnumerator, Debug) + << "Skip " << entity->name() + << ": no device node"; + } } }