[v17,06/12] config: Look up pipelines match list in configuration file
diff mbox series

Message ID 20250911092945.16517-7-mzamazal@redhat.com
State Superseded
Headers show
Series
  • Add global configuration file
Related show

Commit Message

Milan Zamazal Sept. 11, 2025, 9:29 a.m. UTC
Let's add a configuration file item for the pipelines match list.

The configuration snippet:

  configuration:
    pipelines_match_list: rkisp1,simple

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 src/libcamera/camera_manager.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Paul Elder Sept. 12, 2025, 8:52 a.m. UTC | #1
Hi Milan,

Thanks for the patch.

Quoting Milan Zamazal (2025-09-11 18:29:36)
> Let's add a configuration file item for the pipelines match list.
> 
> The configuration snippet:
> 
>   configuration:
>     pipelines_match_list: rkisp1,simple
> 
> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>

In the commit message, s/config:/camera_manager:/

With that changes,

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/libcamera/camera_manager.cpp | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
> index 64df62444..c203b08f7 100644
> --- a/src/libcamera/camera_manager.cpp
> +++ b/src/libcamera/camera_manager.cpp
> @@ -111,14 +111,16 @@ void CameraManager::Private::createPipelineHandlers()
>          * file and only fallback on environment variable or all handlers, if
>          * there is no configuration file.
>          */
> -       const char *pipesList =
> -               utils::secure_getenv("LIBCAMERA_PIPELINES_MATCH_LIST");
> -       if (pipesList) {
> +       const auto pipesList =
> +               configuration().envListOption("LIBCAMERA_PIPELINES_MATCH_LIST",
> +                                             { "pipelines_match_list" },
> +                                             ",");
> +       if (pipesList.has_value()) {
>                 /*
>                  * When a list of preferred pipelines is defined, iterate
>                  * through the ordered list to match the enumerated devices.
>                  */
> -               for (const auto &pipeName : utils::split(pipesList, ",")) {
> +               for (const auto &pipeName : pipesList.value()) {
>                         const PipelineHandlerFactoryBase *factory;
>                         factory = PipelineHandlerFactoryBase::getFactoryByName(pipeName);
>                         if (!factory)
> -- 
> 2.51.0
>

Patch
diff mbox series

diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index 64df62444..c203b08f7 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -111,14 +111,16 @@  void CameraManager::Private::createPipelineHandlers()
 	 * file and only fallback on environment variable or all handlers, if
 	 * there is no configuration file.
 	 */
-	const char *pipesList =
-		utils::secure_getenv("LIBCAMERA_PIPELINES_MATCH_LIST");
-	if (pipesList) {
+	const auto pipesList =
+		configuration().envListOption("LIBCAMERA_PIPELINES_MATCH_LIST",
+					      { "pipelines_match_list" },
+					      ",");
+	if (pipesList.has_value()) {
 		/*
 		 * When a list of preferred pipelines is defined, iterate
 		 * through the ordered list to match the enumerated devices.
 		 */
-		for (const auto &pipeName : utils::split(pipesList, ",")) {
+		for (const auto &pipeName : pipesList.value()) {
 			const PipelineHandlerFactoryBase *factory;
 			factory = PipelineHandlerFactoryBase::getFactoryByName(pipeName);
 			if (!factory)