From patchwork Tue May 25 05:33:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12396 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 E65E7C3201 for ; Tue, 25 May 2021 05:33:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A763F6891F; Tue, 25 May 2021 07:33:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="lecC0HPS"; dkim-atps=neutral Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2A72E602AC for ; Tue, 25 May 2021 07:33:50 +0200 (CEST) Received: by mail-pf1-x431.google.com with SMTP id q67so5656865pfb.4 for ; Mon, 24 May 2021 22:33:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zljd0JWTx6abxqSNQZ8auUlpjwYe65uXX31AdgmU3Xk=; b=lecC0HPSe+mwiApOlWe1PVi1V8+XDtHr+7Z1hf+/IFTxG9iTq4Sr33PdFCxfATbREe YwMQpziUWP+S1xxiUex1lZiYPiPYy1lDWPi8qdY8myuW9CSCYhDJdvlAwbMBKDpMPwMJ oa7rAf6TR0qO4q+OQXO9oMdsEDze8CA4Ymdfg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zljd0JWTx6abxqSNQZ8auUlpjwYe65uXX31AdgmU3Xk=; b=VM1r7OjeT9eTzkHTgr90p/uDdpLT7UdcmxNzYbvYS8DtJd1azaaPDKHGbB/ET6lm5U Fx0IXJpq3a3X2Ob/ukc9hq+D3NoNdxZ6nt2o6Cr4l3WIqXY1Xug6T1Mfo6ib4gvsieGr /RCYoVenT9GjyHnArcDq5YxenJEDiELvoDH9fM6+E/XBGEeV6VBWTt2PCmzjyOfWPmeA d75lLw07TXyXnY6sCj7U07Eacmng+GTwx0pzN8ZueDWAaf4Zgq/R02RFaNUsuflaaKjR ieLKYx8cp292IL30+YA8mxz2WeTHP7qSk7RAIEgdt9sNOWRWZVBlRIVB3yxPWtxJ865T TG0A== X-Gm-Message-State: AOAM531+sAIc6J68gaucWBR8xw8qyzW0qiWbyAW1l98Pf6romBwn0oBd j85IhvN0P7miwAeMtgcgFMplz87LJtwrqw== X-Google-Smtp-Source: ABdhPJwtQmuf5l2vpqa1RaEHoay2d8XI7x+ZMbO7COvRrVcnWhmZ+/AhfivfWfkMTCU3ZM3ZYiOF3w== X-Received: by 2002:a63:5511:: with SMTP id j17mr17621302pgb.191.1621920828533; Mon, 24 May 2021 22:33:48 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:e5df:4bf4:810e:3bcb]) by smtp.gmail.com with ESMTPSA id n6sm13279787pgm.79.2021.05.24.22.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 22:33:48 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Tue, 25 May 2021 14:33:41 +0900 Message-Id: <20210525053341.2574042-1-hiroh@chromium.org> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: V4L2Device: Fix a type mismatch of ControlValue 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" The commit (34bee5e8) of removing the controls order assumption doesn't change the update ControlValue type in V4L2Device::updateControls(). However, this is wrong because the ControlValue is set to a placeholder ControlValue in V4L2Device::getControls(), so the type is ControlTypeNone. We should rather look up the type in V4L2Device::controls_ with a specified id. Fixes: 34bee5e8 (libcamera: V4L2Device: Remove the controls order assumption in updateControls()) Signed-off-by: Hirokazu Honda --- src/libcamera/v4l2_device.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 7f7e5b8f..cc4f52bf 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -621,7 +621,11 @@ void V4L2Device::updateControls(ControlList *ctrls, const unsigned int id = v4l2Ctrl.id; ControlValue value = ctrls->get(id); - switch (value.type()) { + + auto iter = controls_.find(id); + ASSERT(iter != controls_.end()); + const ControlType type = iter->first->type(); + switch (type) { case ControlTypeInteger64: value.set(v4l2Ctrl.value64); break;