From patchwork Wed Jan 5 08:55:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 15248 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 B9162BE080 for ; Wed, 5 Jan 2022 08:56:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1141460115; Wed, 5 Jan 2022 09:56:12 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="puIg60in"; dkim-atps=neutral Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6158460115 for ; Wed, 5 Jan 2022 09:56:10 +0100 (CET) Received: by mail-wr1-x42b.google.com with SMTP id v6so19771205wra.8 for ; Wed, 05 Jan 2022 00:56:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u2r3xEi0YzrKc72HdK90OSSw8ISFH/rPRO4NU4VKhDM=; b=puIg60insYPIiQxdEJcy1j1MaKtlkVV4pGZ48gSgezso90gpDN/SokRBHHQ515HT0u 4bttYP10tYxXBJE4ty3Slcvw+F8J85sznCGJFb24c+7LQe18UWCFhFiukyVmMz4XUZby HhQ18zvDlCT1wpnnbdxg6DqztIGvODOIN8Ury0gYQOwNyjgw61b0wSnqQYudD/F31cOY +plP7HPcSjD5ZfbZy1ynUEQYA46dwvtoKGJa+A1NSIkgY1eCG3+YHNAUx9oQaepaFtiT hfgxlvRfRvRq0Jx58oiV/WbDhLL52GmMEJYk8kYomRj5bjtjJAvq+od6m07GPgq5L2sU xGIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u2r3xEi0YzrKc72HdK90OSSw8ISFH/rPRO4NU4VKhDM=; b=vSOaj2sL2VA+gy3l5ciGQqeRh6KCYk85K4ZmwNPpP2bCSkHiDgUOQ1cwq5ZN5Clg8z FLsDg4NG8lq36yYAVEF7kCaOEi+NJTTa2FSLZ9prDOR7nRB7NZ7Bjs1VkkQ2SjWiAJGj S9ZQKKIzRrG4ehBrCX312fYK2WLLOOPlcOgEDjw0NoynDIpMF8wbP+WoAv7pcHfEcTdE hUIuwMZToZjejDwnHmSnB7fEtgaWijqzqTd4L231wDcxScEbCYtNRoMT9Y1Ab8egoTKW sM4RgbqVDz0hyRu73/+VJ8afbq8pdp0I2/Xp7RVmX1UFohxO1UDZzFJwjzuLSveEf8kg BUAQ== X-Gm-Message-State: AOAM531g86sdR4F1DZ6eBTq+XRve+7dPa6ts3EcrU3zNTWGe1q5aKYhO T4dZqR8vtNedRQayPUz/b2xZ7tYA+g2F+KCB X-Google-Smtp-Source: ABdhPJwTxNzuF5wk2Mb1Ng6xoyWlYYpzyWhcFFfF+9+Azyicu8DmJ5D5T19u/EXSlrZPoIl4KZFH2g== X-Received: by 2002:a05:6000:186e:: with SMTP id d14mr47195769wri.205.1641372969989; Wed, 05 Jan 2022 00:56:09 -0800 (PST) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id g8sm1902149wmh.17.2022.01.05.00.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 00:56:09 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Wed, 5 Jan 2022 08:55:52 +0000 Message-Id: <20220105085553.12092-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220105085553.12092-1-david.plowman@raspberrypi.com> References: <20220105085553.12092-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/3] libcamera: v4l2_device: Add support for integer array controls 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" V4L2Device::setControl and V4L2Device::updateControl are both updated to handle ControlTypeInteger32 array controls. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart --- src/libcamera/v4l2_device.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 62c91779..3fc8438f 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -297,6 +297,18 @@ int V4L2Device::setControls(ControlList *ctrls) /* Set the v4l2_ext_control value for the write operation. */ ControlValue &value = ctrl->second; switch (iter->first->type()) { + case ControlTypeInteger32: { + if (value.isArray()) { + Span data = value.data(); + v4l2Ctrl.p_u32 = reinterpret_cast(data.data()); + v4l2Ctrl.size = data.size(); + } else { + v4l2Ctrl.value = value.get(); + } + + break; + } + case ControlTypeInteger64: v4l2Ctrl.value64 = value.get(); break; @@ -671,6 +683,14 @@ void V4L2Device::updateControls(ControlList *ctrls, const unsigned int id = v4l2Ctrl.id; ControlValue value = ctrls->get(id); + if (value.isArray()) { + /* + * No action required, the VIDIOC_[GS]_EXT_CTRLS ioctl + * accessed the ControlValue storage directly for array + * controls. + */ + continue; + } const auto iter = controls_.find(id); ASSERT(iter != controls_.end()); @@ -680,19 +700,10 @@ void V4L2Device::updateControls(ControlList *ctrls, value.set(v4l2Ctrl.value64); break; - case ControlTypeInteger32: - value.set(v4l2Ctrl.value); - break; - - case ControlTypeByte: - /* - * No action required, the VIDIOC_[GS]_EXT_CTRLS ioctl - * accessed the ControlValue storage directly. - */ - break; - default: /* + * Note: this catches the ControlTypeInteger32 case. + * * \todo To be changed when support for string controls * will be added. */