From patchwork Thu Jul 17 12:48:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 23833 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 17D01BE175 for ; Thu, 17 Jul 2025 12:49:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1681068F83; Thu, 17 Jul 2025 14:49:04 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uaH501T0"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E795A61517 for ; Thu, 17 Jul 2025 14:49:01 +0200 (CEST) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C60CD1AE2; Thu, 17 Jul 2025 14:48:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1752756507; bh=y9h/+w1K2ZmC+HUYooOf6HZ/weinC+7UUTNHrvgJBe8=; h=From:To:Cc:Subject:Date:From; b=uaH501T0kWvLRxQLFk3dkXoI0K9N+DJhVeNHhxZrUzh0GVw4vbNQ1d7oS53iEZNZY jpZiqQfrTkePx1z8eRabCAZZruv4E8XvsuLXtPAup/dycDIh7KJL2AKZ36rv+g6/L+ HWGbWtlxpZoAwWosJ6sBGoQzN4Se4x3js4JGguFM= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally Subject: [PATCH v2 0/4] Use regular expressions for entity name matching Date: Thu, 17 Jul 2025 13:48:49 +0100 Message-Id: <20250717124853.2317191-1-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" There are a couple of places in libcamera that fetch a MediaEntity from a MediaDevice using the entity's name. This has raised an issue lately on the RZ/V2H platforms, as the drivers for some of the hardware give the entities that they create names that incorporate things like the memory address for the hardware's registers. If we simply use those names as-is then the pipeline handler would only work for the instance of the hardware that's at the hard-coded address and not any of the others. To work around the issue, this series updates libcamera to add overloads for the entity matching functions that accept a regex instead of a string. Existing call sites which just pass a normal string should work unaffected, but new call sites could pass a std::regex instead that then matches for entities using the pattern instead of direct matches only. Thanks Dan Daniel Scally (4): libcamera: base: Wrap libcamera: device_enumerator: Support regex to match entity names libcamera: media_device: Allow for a regex to match entity name libcamera: V4L2Subdevice: Allow for a regex to match entity name include/libcamera/base/meson.build | 1 + include/libcamera/base/regex.h | 13 +++++++ .../libcamera/internal/device_enumerator.h | 4 +- include/libcamera/internal/media_device.h | 2 + include/libcamera/internal/v4l2_subdevice.h | 3 ++ src/libcamera/device_enumerator.cpp | 37 ++++++++++++++++++- src/libcamera/media_device.cpp | 25 +++++++++++++ src/libcamera/v4l2_subdevice.cpp | 27 ++++++++++---- 8 files changed, 103 insertions(+), 9 deletions(-) create mode 100644 include/libcamera/base/regex.h