From patchwork Wed Jun 25 15:53:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 23652 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 B7A67C3237 for ; Wed, 25 Jun 2025 15:53:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 884BE68DE6; Wed, 25 Jun 2025 17:53:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hdFTAqtd"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E593261533 for ; Wed, 25 Jun 2025 17:53:26 +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 7FFE342B; Wed, 25 Jun 2025 17:53:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1750866788; bh=2OYcTjinuul4yW1zeiNbtTX5Z84vad5zWteQL0YGB7Q=; h=From:To:Cc:Subject:Date:From; b=hdFTAqtdMUIXtahNfCj+5n9YCS9A56o3gJ54fSZLbkeeQVugiaqlkJi7YlqgdXOVD MIaxEAt2pSWZqiluPFeb1aSoH34Lkzp8aXByzy50/kZfKFdPbkNMoiLNn3lFAAedel Cm0ASeSq+WpNviOCLLqj5RCfKT3WVtfPVx/ucVc4= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally Subject: [PATCH v1 0/2] Use regular expressions for entity name matching Date: Wed, 25 Jun 2025 16:53:06 +0100 Message-Id: <20250625155308.2325438-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 use regex matching when searching for a MediaEntity by name. Existing call sites which just pass a normal string should work unaffected, but new call sites could use a string that builds a valid regular expression instead. Daniel Scally (2): libcamera: device_enumerator: Use regex to match entity names libcamera: media_device: Use a regex to match entity name .../libcamera/internal/device_enumerator.h | 3 ++- src/libcamera/device_enumerator.cpp | 27 ++++++++++--------- src/libcamera/media_device.cpp | 12 ++++++--- src/libcamera/v4l2_subdevice.cpp | 4 +-- 4 files changed, 26 insertions(+), 20 deletions(-)