{"id":16336,"url":"https://patchwork.libcamera.org/api/patches/16336/?format=json","web_url":"https://patchwork.libcamera.org/patch/16336/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20220623144410.20725-3-naush@raspberrypi.com>","date":"2022-06-23T14:44:09","name":"[libcamera-devel,2/3] ipa: raspberrypi: Add sensor temperature to DeviceStatus","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"cca3b5f2fbca6da191771b0ec409ac8db4333410","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16336/mbox/","series":[{"id":3212,"url":"https://patchwork.libcamera.org/api/series/3212/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3212","date":"2022-06-23T14:44:07","name":"Add SensorTemperature control","version":1,"mbox":"https://patchwork.libcamera.org/series/3212/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16336/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16336/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 42C01BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Jun 2022 14:44:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED17265640;\n\tThu, 23 Jun 2022 16:44:30 +0200 (CEST)","from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ECF8A6563A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jun 2022 16:44:26 +0200 (CEST)","by mail-wr1-x42a.google.com with SMTP id r20so7864595wra.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jun 2022 07:44:26 -0700 (PDT)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tv21-20020a05600c15d500b0039c96b97359sm3178578wmf.37.2022.06.23.07.44.25\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 23 Jun 2022 07:44:25 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655995471;\n\tbh=03a2ANdsxrFRWD+2YAbQ23SGmxqYgsIsFuZ86YP/8cI=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=I34OIA1c9+ew7Goxmh8zVOM8zEbezKuIjAtGh66GYNiqQjwM6RWWuVS17jZzOqt4m\n\tG95DpIrd6I9bNCiutSELKtEdgQV0CDnjjt5MagnX1gVQsqEscV1cHRgBMq1PeklLFC\n\tNUuxF/CUluLcYS8/oXUFLsPPJ5QzIBKpWPSUQVqBdgPFXqWtPXk/d0njpX3iQRZiSV\n\tpJuNjx8DWD9YwpWxVnlsy88nHn48/g0GAxC8s7wQdtZyj/WQRKdmTCUUzY8q2OoyKS\n\t5gu2XTcJsysIgxmg5jjtaRQi3PY6T6ixPg95UvFqjDBsvcb0nZFVECLoT5DkBl7i8O\n\tefRJf4o7U/kjg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=E86bYylqH36xxjXjHLA0Hj3cU2ciiltp7NwZLTqDbMI=;\n\tb=OdPY7SAhlDlrssi1T/GjJoXZcd03ROMd7MccBviNSmmbrwtft23YkN2Q/DCOG34PLz\n\tdlE/o0igMQX+AdqSgAl3/LoOmWlHqAYPqZu3CqFtdVJv2VNQiQIPoeypBFCt3N2Iqhhe\n\tHiFj7iW/M1dI62o01G97uOljcJJYp46nI/zLBakReGMKyB027XKdkRQpM2l3qNXVf4ZJ\n\t1u4VNJRIK0t97fv7rIx8l0nhXzmojvsrKNsoUk6oP0PXq6s9Y/tPej5MLxTCXj3U1PvQ\n\tanefIpIFSe19hTlJurn9AQVOfsPSXJ8FaM/0xYaqaQPtKCzQN5sGNLWXePkBf3hbmMC2\n\tJC7Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"OdPY7SAh\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=E86bYylqH36xxjXjHLA0Hj3cU2ciiltp7NwZLTqDbMI=;\n\tb=fplSZ6xEHEhN6sVm2/gTq/5BZWU6HtnnOV5xpYLgmAqKS+CTLtPY7H4rk9YBpVwD8x\n\t432f0RR0OPU9N2NzaVqes5tK2+NbhOcclw+l136mQctiO2DXx4Md4uXTMtsTCN58e9tb\n\tR3mqRloy29LF3PPNQ9lNgE05qj2EiIiafYK7kODMjqIfDVSOiCwTLo/50EDU6VUk3k0E\n\tycPhJFBjbbKW2oFG51lR7CvErAKdZAYhOd052z1NZ/RWXTerUSNnjCZvzYFWQl/93Jv/\n\tL7OmFdt1Am9dErubM2lhH3CHuXa4jVLVdG6NqG1wjF8Eck+P3Pgagcp1mVwLvhJw17fN\n\to0LA==","X-Gm-Message-State":"AJIora87LOM4zmCemYM2RmUn62UqPv7EqNEQGjki7trS7Z3mDPpGkp8a\n\t/MnCQcH3LK67x/g7qDzCPJcdu5x0jrWsq8Mc","X-Google-Smtp-Source":"AGRyM1sbocVh5BUuQyz1jsD9/cXx18hoB6RygQzqrB1tgyTO6CBBe/bGFpF4BQHCUH9t/3YuPGAHGA==","X-Received":"by 2002:adf:d1ed:0:b0:215:98d7:2a93 with SMTP id\n\tg13-20020adfd1ed000000b0021598d72a93mr8807420wrd.637.1655995466319; \n\tThu, 23 Jun 2022 07:44:26 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 23 Jun 2022 15:44:09 +0100","Message-Id":"<20220623144410.20725-3-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220623144410.20725-1-naush@raspberrypi.com>","References":"<20220623144410.20725-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 2/3] ipa: raspberrypi: Add sensor\n\ttemperature to DeviceStatus","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>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add a sensor_temperature field to the DeviceStatus structure. The default value\nof -300.0 indicates a temperature measurement is unavilable. If a temperature\nmeasurement is available for a frame, the value is returned out through the\nSensorTemperature control in the Request metadata.\n\nAdditionally, provide the sensor temperature value from the std::ostream &operator<<\noverload.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/cam_helper.cpp               | 7 ++++---\n src/ipa/raspberrypi/controller/device_status.cpp | 3 +++\n src/ipa/raspberrypi/controller/device_status.h   | 4 +++-\n src/ipa/raspberrypi/raspberrypi.cpp              | 2 ++\n 4 files changed, 12 insertions(+), 4 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\nindex 74179399e86a..046428de8545 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -185,9 +185,9 @@ void CamHelper::parseEmbeddedData(Span<const uint8_t> buffer,\n \tmetadata.Merge(parsedMetadata);\n \n \t/*\n-\t * Overwrite the exposure/gain values in the existing DeviceStatus with\n-\t * values from the parsed embedded buffer. Fetch it first in case any\n-\t * other fields were set meaningfully.\n+\t * Overwrite the exposure/gain, frame length and sensor temperature values\n+\t * in the existing DeviceStatus with values from the parsed embedded buffer.\n+\t * Fetch it first in case any other fields were set meaningfully.\n \t */\n \tDeviceStatus deviceStatus, parsedDeviceStatus;\n \tif (metadata.Get(\"device.status\", deviceStatus) ||\n@@ -199,6 +199,7 @@ void CamHelper::parseEmbeddedData(Span<const uint8_t> buffer,\n \tdeviceStatus.shutter_speed = parsedDeviceStatus.shutter_speed;\n \tdeviceStatus.analogue_gain = parsedDeviceStatus.analogue_gain;\n \tdeviceStatus.frame_length = parsedDeviceStatus.frame_length;\n+\tdeviceStatus.sensor_temperature = parsedDeviceStatus.sensor_temperature;\n \n \tLOG(IPARPI, Debug) << \"Metadata updated - \" << deviceStatus;\n \ndiff --git a/src/ipa/raspberrypi/controller/device_status.cpp b/src/ipa/raspberrypi/controller/device_status.cpp\nindex f052ea8b7bed..1a376eecb1c3 100644\n--- a/src/ipa/raspberrypi/controller/device_status.cpp\n+++ b/src/ipa/raspberrypi/controller/device_status.cpp\n@@ -17,5 +17,8 @@ std::ostream &operator<<(std::ostream &out, const DeviceStatus &d)\n \t    << \" Lens: \" << d.lens_position\n \t    << \" Flash: \" << d.flash_intensity;\n \n+\tif (d.sensor_temperature != -300)\n+\t\tout << \" Temperature: \" << d.sensor_temperature;\n+\n \treturn out;\n }\ndiff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h\nindex c4a5d9c8e8c7..53cfeedc2956 100644\n--- a/src/ipa/raspberrypi/controller/device_status.h\n+++ b/src/ipa/raspberrypi/controller/device_status.h\n@@ -19,7 +19,7 @@ struct DeviceStatus {\n \tDeviceStatus()\n \t\t: shutter_speed(std::chrono::seconds(0)), frame_length(0),\n \t\t  analogue_gain(0.0), lens_position(0.0), aperture(0.0),\n-\t\t  flash_intensity(0.0)\n+\t\t  flash_intensity(0.0), sensor_temperature(-300.0)\n \t{\n \t}\n \n@@ -36,4 +36,6 @@ struct DeviceStatus {\n \tdouble aperture;\n \t/* proportional to brightness with 0 = no flash, 1 = maximum flash */\n \tdouble flash_intensity;\n+\t/* Sensor reported temperature value (in degrees) */\n+\tdouble sensor_temperature;\n };\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 3b126bb5175e..fb91c8d11f6c 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -491,6 +491,8 @@ void IPARPi::reportMetadata()\n \t\tlibcameraMetadata_.set(controls::AnalogueGain, deviceStatus->analogue_gain);\n \t\tlibcameraMetadata_.set(controls::FrameDuration,\n \t\t\t\t       helper_->Exposure(deviceStatus->frame_length).get<std::micro>());\n+\t\tif (deviceStatus->sensor_temperature != -300)\n+\t\t\tlibcameraMetadata_.set(controls::SensorTemperature, deviceStatus->sensor_temperature);\n \t}\n \n \tAgcStatus *agcStatus = rpiMetadata_.GetLocked<AgcStatus>(\"agc.status\");\n","prefixes":["libcamera-devel","2/3"]}