{"id":9413,"url":"https://patchwork.libcamera.org/api/patches/9413/?format=json","web_url":"https://patchwork.libcamera.org/patch/9413/","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":"<20200828062520.1110800-1-djrscally@gmail.com>","date":"2020-08-28T06:25:20","name":"[libcamera-devel,v3] MediaLink: Make MediaLink::setEnabled account for existing","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"1cd696cb5ce53a78a4b7dd3be93e509daa515c14","submitter":{"id":67,"url":"https://patchwork.libcamera.org/api/people/67/?format=json","name":"Daniel Scally","email":"djrscally@googlemail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9413/mbox/","series":[{"id":1248,"url":"https://patchwork.libcamera.org/api/series/1248/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1248","date":"2020-08-28T06:25:20","name":"[libcamera-devel,v3] MediaLink: Make MediaLink::setEnabled account for existing","version":3,"mbox":"https://patchwork.libcamera.org/series/1248/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9413/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9413/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 86020BF019\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Aug 2020 08:26:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D327A6291C;\n\tFri, 28 Aug 2020 10:26:23 +0200 (CEST)","from mail-wr1-x444.google.com (mail-wr1-x444.google.com\n\t[IPv6:2a00:1450:4864:20::444])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9CDD06037D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Aug 2020 08:27:12 +0200 (CEST)","by mail-wr1-x444.google.com with SMTP id k15so179979wrn.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Aug 2020 23:27:12 -0700 (PDT)","from valhalla.home ([2.29.208.34])\n\tby smtp.gmail.com with ESMTPSA id\n\th7sm406594wmf.43.2020.08.27.23.27.11\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 27 Aug 2020 23:27:11 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=googlemail.com header.i=@googlemail.com\n\theader.b=\"eDzGdQOY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=googlemail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=ivACTbkXKN/xMjT4G5kzszSOg4qybyUXUQfxFzyT3Gg=;\n\tb=eDzGdQOYkjsKWkP6Zui6JF5N0EJtEJue9ksZw9Jf5b8H508zFF4oWmEKeL3YX7+RW8\n\tfdxywqdIQRWRemkmUA4axa65bdnZ9VvDPC7VL6+fCdBEnUyfKnkL4/5k3xHc/CrPCk/r\n\txRnXj+MRi/bDSVQmhFUVpX3n/kaoCi2JMSSdeBlH3eCCUL+pT3x2DeH8vcFemZL5x83b\n\t3P+mrSwxDZlVyUg/Sec1rO9ngRwrJzUua9+O7m3K04FV2GaR25ngADR3brebC64huVLZ\n\tpefIN8mOBV+dvqQ9CX8qMvScfVmRoPjc4TtuuCoSHKmzqVJdh8BMEKJHf2QvLDQ4yuOW\n\tjXZA==","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=ivACTbkXKN/xMjT4G5kzszSOg4qybyUXUQfxFzyT3Gg=;\n\tb=E7VHkLyu3MvYOdRuIplgOhhV2EqPOxpz/c3JrcxXaTbCe9zEyMBzLCyVRZi367DF5d\n\tfPJwuhtV6niuxM87Rg3WL+IRDC9NGa36iAis+ALvK92q4TkcC8/VEQffVfl7vTdQuBq/\n\twGSK9/M78p8cXnRxNGwSl+tKiho1i3A2WzkbhlSb/eYAIUFaeNwsYoRk+cTWt8XsGJyj\n\thQ0s4KOYwhksA8RripzGpywVZaJXbTmUpDPPW0XrnJTEd0fn7y94gdw4wCmzyFfctjmo\n\twvG6xJ6FoFaxEUweI+IQ6g9KNzQYc52oYe+uiAITrUWy3pJfSKBByZawprmSTUPHNU3h\n\tQ91Q==","X-Gm-Message-State":"AOAM530fLrzEzDG1Dr8J+ypvtLPGqpFt2Z/KAZSO9EHid0rxfUTtOort\n\t8SRXnBTyT4P8Blga5U8Pt+dOcIDYIqi0sA==","X-Google-Smtp-Source":"ABdhPJxkeCNLameH01r7F63ZZCrgDNxrhqwpUSqSaYO7hhUHuVAFCALhIgsmreBFVn6ZasCN71JayQ==","X-Received":"by 2002:adf:ef45:: with SMTP id c5mr1440711wrp.37.1598596032087; \n\tThu, 27 Aug 2020 23:27:12 -0700 (PDT)","From":"Dan Scally <djrscally@googlemail.com>","X-Google-Original-From":"Dan Scally <djrscally@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 28 Aug 2020 07:25:20 +0100","Message-Id":"<20200828062520.1110800-1-djrscally@gmail.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","X-Mailman-Approved-At":"Fri, 28 Aug 2020 10:26:22 +0200","Subject":"[libcamera-devel] [PATCH v3] MediaLink: Make MediaLink::setEnabled\n\taccount for existing","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The setupLink function fails (ioctl returns EINVAL) when it passes the\nMEDIA_LNK_FL_ENABLE flag to a link that is already flagged with\nMEDIA_LNK_FL_ENABLE and MEDIA_LNK_FL_IMMUTABLE. Contrast to media-ctl's\nequivalent media_setup_link() which ORs the new flags with the existing\nvalues. This patch modifies the behaviour of setupLink() to behave the\nsame as media_setup_link() in media-ctl.\n\nSigned-off-by: Dan Scally <djrscally@gmail.com>\n---\n\nChangelog:\n\n\tv3 - Moved the change to MediaLink::setEnabled()\n\n\tv2 - Simplified by removing the call to link() to fetch a link that's\n\t\talready passed as a parameter to the function.\n\n src/libcamera/media_object.cpp | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\nindex ce77a72..a2e6a0d 100644\n--- a/src/libcamera/media_object.cpp\n+++ b/src/libcamera/media_object.cpp\n@@ -115,7 +115,8 @@ LOG_DECLARE_CATEGORY(MediaDevice)\n  */\n int MediaLink::setEnabled(bool enable)\n {\n-\tunsigned int flags = enable ? MEDIA_LNK_FL_ENABLED : 0;\n+\tunsigned int flags = (flags_ & ~MEDIA_LNK_FL_ENABLED)\n+\t\t\t   \t\t\t| (enable ? MEDIA_LNK_FL_ENABLED : 0);\n \n \tint ret = dev_->setupLink(this, flags);\n \tif (ret)\n","prefixes":["libcamera-devel","v3"]}