{"id":12853,"url":"https://patchwork.libcamera.org/api/1.1/patches/12853/?format=json","web_url":"https://patchwork.libcamera.org/patch/12853/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210707134051.2740-1-david.plowman@raspberrypi.com>","date":"2021-07-07T13:40:51","name":"[libcamera-devel] libcamera: raspberrypi: Allow the tuning file to be set by an environment variable","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"d7d59e5c62833577e11f8a6afdce78e4f5bc7ce4","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/1.1/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12853/mbox/","series":[{"id":2215,"url":"https://patchwork.libcamera.org/api/1.1/series/2215/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2215","date":"2021-07-07T13:40:51","name":"[libcamera-devel] libcamera: raspberrypi: Allow the tuning file to be set by an environment variable","version":1,"mbox":"https://patchwork.libcamera.org/series/2215/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12853/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12853/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C8330BD794\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Jul 2021 13:40:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3407768500;\n\tWed,  7 Jul 2021 15:40:57 +0200 (CEST)","from mail-wr1-x433.google.com (mail-wr1-x433.google.com\n\t[IPv6:2a00:1450:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BD70760284\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Jul 2021 15:40:55 +0200 (CEST)","by mail-wr1-x433.google.com with SMTP id t6so3091275wrm.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 07 Jul 2021 06:40:55 -0700 (PDT)","from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tw22sm6392630wmc.4.2021.07.07.06.40.54\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 07 Jul 2021 06:40:54 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"FDJSiFab\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=+WdXorh0TB0kP0yTncn8sk169AUYYS2eQE+0DopgMZM=;\n\tb=FDJSiFabmt4SCf2G0vQYmvSz9hcri+NSx9oVrN7D0gi7juOR9vgbdpOV6VDZSn8/A6\n\t10XXsoIUdKJtzDEyH7u3lyZ7MbCwK60m9K7I55Aw+ESGnP5yg4hVhH6uWczwe6Mlm9c1\n\tBDOF/FG0R2U/5JxpLTVRJ7VO1VwWFOzymIWpMd26eZNDziPJ1mUjvtL6pNJsHAB4hzpi\n\t+0wrUDyC4kVa213Ll0QbNF3Kw0a7ym6z4976YpC7BoQu5s2b8Y5dpWIT17SeWqAVvK5S\n\tVNBU/ZPE37Cxseb7W7kBNxgPv/E5Lv0oyeujIp3GmhlKFXhP2M/p6IsNTOFal0sPWYgo\n\tAmGA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=+WdXorh0TB0kP0yTncn8sk169AUYYS2eQE+0DopgMZM=;\n\tb=NSVXCEI73WOtkGVPyYtBinrt7d3YqnftIigCbPZy8OeC91DMZ+R311Xhzz6IN39ze0\n\tGusiNaUtUFRBMLoIvw3J3KoH6qlscI/DPeZoR/gys/WspfK1RMWqFIBvWA4B0/pAvp1b\n\tKe13sKD382z7EIP7P18ujFCbKsphxY2hrIvQKc+UAUo06o9NhGDFERvlVnjFqFj5UM4F\n\tRUrKgWKZNN9gOk6h8Z2Y2h7JrRPQOCQ2GyFV4n3RXL1mbBfHqn2PdrwRvKruGXyC8WNo\n\tGeEGN+ttIkVpOCKBq8lYyuloJCkTmFtO/RiDEnTYoVuMfbf3uYbRGCvyMI677zYxiV6Q\n\tSpmA==","X-Gm-Message-State":"AOAM530+Nd4tubicnn9zeSgE+u3d/tCAYFrMGstCl+w8S4YO0h6mKt30\n\tEuz92gLJmmCJJvlIZhU5kUeSOMDMPUiseg==","X-Google-Smtp-Source":"ABdhPJwLRTHFN0mCZFwmsKYozhfolilDUJxgq9rnUkw/y2m6y3c4mOGvwLrzgaDvpJyVEutL1+d8kg==","X-Received":"by 2002:adf:a74a:: with SMTP id\n\te10mr27634494wrd.185.1625665255139; \n\tWed, 07 Jul 2021 06:40:55 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  7 Jul 2021 14:40:51 +0100","Message-Id":"<20210707134051.2740-1-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.20.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] libcamera: raspberrypi: Allow the tuning\n\tfile to be set by an environment variable","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The configuration (camera tuning) file used by the Raspberry Pi comes\nby default from the sensor name. However, we now allow this to be\noverridden by the LIBCAMERA_RPI_TUNING_FILE environment variable.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 14 ++++++++++++--\n 1 file changed, 12 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 082eb1ee..a738770a 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1232,8 +1232,18 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig)\n \tipa_->setIspControls.connect(this, &RPiCameraData::setIspControls);\n \tipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls);\n \n-\tIPASettings settings(ipa_->configurationFile(sensor_->model() + \".json\"),\n-\t\t\t     sensor_->model());\n+\t/*\n+\t * The configuration (tuning file) is made from the sensor name unless\n+\t * the environment variable overrides it.\n+\t */\n+\tstd::string configurationFile;\n+\tchar const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RPI_TUNING_FILE\");\n+\tif (!configFromEnv || *configFromEnv == '\\0')\n+\t\tconfigurationFile = ipa_->configurationFile(sensor_->model() + \".json\");\n+\telse\n+\t\tconfigurationFile = std::string(configFromEnv);\n+\n+\tIPASettings settings(configurationFile, sensor_->model());\n \n \treturn ipa_->init(settings, sensorConfig);\n }\n","prefixes":["libcamera-devel"]}