From patchwork Thu Mar 2 00:54:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sophie Friedrich X-Patchwork-Id: 18328 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 E026DBF415 for ; Thu, 2 Mar 2023 09:29:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 331C4626A7; Thu, 2 Mar 2023 10:29:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1677749396; bh=nM2SqAdZc0Z3exhMfgR7Fe3ZU+jCrvo06hOA144rSzo=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=2n4J9i/iL5T4QAflyfF1VgxY4sCAPfrqYY1pjGHwo7gNv9vQ+V8J7MYvXTK+axIDv KMyZU8VBBT59XLaT375HI44F1kAddT3+3bS4ozSQvbYrXpjnzc0YCPXJCy4sgE5lpQ D2KliHRZhuY4/lGDlaeby4fpjB1SpLosaPzVqXUSzqW+pp3L2rn1Qz1UYuXGSXyHRB WDRFmRXiNSZe0OgxXeGCoDe5TSuof+vJOiDCwQgL2yhKzjJLFXxFHwJoKxhEhA/fxy RGGmshswhI1+XNiyoPFPBbkb19utmK0sfW68q5F6cdhaOfRKJLEKo6YTWwSf+MSne3 yrbZJG02zEMGA== Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7943D62668 for ; Thu, 2 Mar 2023 01:54:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=flowerpot.me header.i=@flowerpot.me header.b="1A0JuSaP"; dkim-atps=neutral Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4PRt0f2GFCz9sTV; Thu, 2 Mar 2023 01:54:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flowerpot.me; s=MBO0001; t=1677718466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=aTb0zQ1XJV6SG0Xx6Am8oQec0Hg/YuFPjAduKijneuw=; b=1A0JuSaPu2uLI0jnTFsub6lia9hIQcbHwhpfp9h+kWHVQdvi+J6grP7FL+qMN13CCmlVl4 QxOETTh9871DXD7Jpm1OgscOAXY9UoSM49orBsqO0+kIc5EWuxkYYtmAVASlGxJ0f+Beus RSM68MlojTcpYaYKZucVEkN5nEiP3USBAxejQRCyn3AL+tS3pvbqI2tAwEqYYgbAyL6sB+ 6tOaG9y6EHwbEGtDHZ0NXi/lZets1MRaWHD2HRdxB6TtjM/mvaUJ/tVLO8ySFv25hwBPXm R4/P+ALU+uXes04aIAvXJLuVcndReiUBS9KwGRi7HSlwn76/AMT2N/+C9NCUHg== To: libcamera-devel@lists.libcamera.org Date: Thu, 2 Mar 2023 01:54:14 +0100 Message-Id: <20230302005415.1789544-1-dev@flowerpot.me> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4PRt0f2GFCz9sTV X-Mailman-Approved-At: Thu, 02 Mar 2023 10:29:54 +0100 Subject: [libcamera-devel] [PATCH 0/1] Generalized DeviceMatch 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: Sophie Friedrich via libcamera-devel From: Sophie Friedrich Reply-To: Sophie Friedrich Cc: Sophie Friedrich Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In preparation for introducing libusb support into libcamera, we need to generalize the matching functionality. The `MediaEntity` class was never meant to handle the cases required for e.g. libusb. Additionally the current way matching is handled is insufficient for (future) `MediaDevices` in which a specific key/value relationship exists for properties (e.g. USB vid and pid). To solve these two problems I've abstracted away the requirements for entities that `DeviceMatch` requires in `DeviceMatchEntityInterface` and extended `DeviceMatch` to handle key/value pairs. Using "*" as a key is currently a catch all for the presumably keyless property of V4L2 `MediaEntity`. Sophie Friedrich (1): libcamera: enumeration: Generalize DeviceMatch .../libcamera/internal/device_enumerator.h | 16 +-- include/libcamera/internal/device_match.h | 46 +++++++ include/libcamera/internal/media_device.h | 1 + include/libcamera/internal/media_object.h | 7 +- include/libcamera/internal/meson.build | 1 + src/libcamera/device_enumerator.cpp | 73 ---------- src/libcamera/device_match.cpp | 126 ++++++++++++++++++ src/libcamera/meson.build | 1 + 8 files changed, 183 insertions(+), 88 deletions(-) create mode 100644 include/libcamera/internal/device_match.h create mode 100644 src/libcamera/device_match.cpp