From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7DFC0C433EF for ; Thu, 3 Mar 2022 21:14:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3FC1F83BAE; Thu, 3 Mar 2022 22:14:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RbFKtEk1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 34E6B839FD; Thu, 3 Mar 2022 22:14:46 +0100 (CET) Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 536ED83A34 for ; Thu, 3 Mar 2022 22:14:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alpernebiyasak@gmail.com Received: by mail-ej1-x62a.google.com with SMTP id gb39so13370969ejc.1 for ; Thu, 03 Mar 2022 13:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject:to:cc :references:content-language:in-reply-to:content-transfer-encoding; bh=Wnp4cW4wYCFKDtGsgiHsLuWils/kMJAJNbKlchwa2BY=; b=RbFKtEk1nOmriYpxNd63po6Qs5YYlhEnp7JylmKxFnYxAO2jJsY/uL5smgDshFHkz8 QVZ1ZsWPQByrjVRMTzmXWZmDYWJ39QKN1kNLU1ZtDv7BSmtuumU2nIp766PSY2DgzNAk /zuWo+CZiWM1MmZ1Djj2joq7mQd4mDaujZWDXEKRuypPG87FwvWK0WNjpyW+ikfn2i1p wirrwf8eG6CbGOTCPeauQck00FxiuSwj0S+GYSOKTY9xsJFjqmcYVMcvnpelpiyh/Me9 /BhF5rjpniTR077Rh3mzJQNM4nhbe0w1PuC0pEsr/XB8/faOE0WY3JM7jOyM6Tlilu75 2ITg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:to:cc:references:content-language:in-reply-to :content-transfer-encoding; bh=Wnp4cW4wYCFKDtGsgiHsLuWils/kMJAJNbKlchwa2BY=; b=OVq+q4gCEbXgu+sEEIF5UTVIMMAUB+olQtHOMXfpwpld6gi41idqzOfUBSPEmVgNOu wo1hU436fPE5VxKvESJL+fmjTww1EWiQf0/oAcbYWJKaXXMd5cpVR4x2pdUqDU9t7KTG C2+kLYbZa2VSK8Xb/vIedQYfvCm8Bq4/7AGyR+e4Efp4wUKwzg5oEVTBht/MYMMCfbGz cq9A9YnWlrnUK4j3YZ+v7NtWE5Enh79e0NRdDKzVqreP6F1294ohLWMhDuTSbqUI/rWy i+gvFkShiKN5FGaRvHm4XyFNPvb52dEsmwetX+y+YDgb4Ns1N3HmvPDpddTYlrXnVn4u JRAw== X-Gm-Message-State: AOAM5300YvcoCFc4cNA/HuB2W1x/5T9B6uR5tj5HfyttY/VroCvoTi2g iAouqBuiQUZbrKl16BL+ur8= X-Google-Smtp-Source: ABdhPJzoriSP9Fg89xnM+fQLb+8wq84mLb67GfbH0OxQbrRLkJycAbv6IIYAGjnGjbaZdAPiWGzAzw== X-Received: by 2002:a17:906:6a04:b0:6cf:db6:bda6 with SMTP id qw4-20020a1709066a0400b006cf0db6bda6mr28583438ejc.738.1646342081862; Thu, 03 Mar 2022 13:14:41 -0800 (PST) Received: from [192.168.0.74] ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id n3-20020a1709061d0300b006da94efcc7esm865851ejh.204.2022.03.03.13.14.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Mar 2022 13:14:41 -0800 (PST) Message-ID: <28373ff8-591e-11d6-af4e-5a76ce142dac@gmail.com> Date: Fri, 4 Mar 2022 00:07:13 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 From: Alper Nebi Yasak Subject: Re: [PATCH 06/24] dtoc: Support adding a string list to a device tree To: Simon Glass Cc: U-Boot Mailing List , huang lin , Jeffy Chen , Kever Yang , Tom Rini , Philippe Reynes , Ivan Mikhaylov , Walter Lozano References: <20220208185008.35843-1-sjg@chromium.org> <20220208185008.35843-5-sjg@chromium.org> <029862ba-f3d7-51a1-f7dc-3567bf5a0ff9@gmail.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On 24/02/2022 01:58, Simon Glass wrote: > On Tue, 15 Feb 2022 at 04:53, Alper Nebi Yasak wrote: >> On 08/02/2022 21:49, Simon Glass wrote: >>> diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py >>> index 32a7aa9829..e7197f8f12 100644 >>> --- a/tools/dtoc/fdt.py >>> +++ b/tools/dtoc/fdt.py >>> @@ -501,6 +501,24 @@ class Node: >>> val = bytes(val, 'utf-8') >>> return self.AddData(prop_name, val + b'\0') >>> >>> + def AddStringList(self, prop_name, val): >>> + """Add a new string-list property to a node >>> + >>> + The device tree is marked dirty so that the value will be written to >>> + the blob on the next sync. >>> + >>> + Args: >>> + prop_name: Name of property to add >>> + val (list of str): List of strings to add >>> + >>> + Returns: >>> + Prop added >>> + """ >>> + out = b'' >>> + for string in val: >>> + out += bytes(string, 'utf-8') + b'\0' >>> + return self.AddData(prop_name, out) >> >> If val is an empty list this would try to set a zero-byte data, but then >> the Prop class considers that a boolean True. > > Yes, but I believe that is correct, isn't it? I did propose a change > to DT bool props but it has not got anywhere. I just wasn't sure about the semantics and wanted to highlight what might be an edge case. Looking again, I think this is binary-wise correct, but GetString and GetStringList would return True and [True] for these boolean props where I'd want None and [].