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 CF129C43334 for ; Wed, 13 Jul 2022 15:30:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D030A840C0; Wed, 13 Jul 2022 17:30:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1657726235; bh=iITtmjLjDul7qLW9ZqU+kKaXGxg6AW57G+9t5dvXGmg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=wJuewXWP/2AJES68RZ6Ohcc88BJf5j8TkKEe8vrSJIOlSgADhuh/d2Ae+6K5IMPv/ Kl+QLbBqkfIWe5H7yvuq5RrknVI1WobQ9dhYKEO9f9amUnmsi/dolxLxfpX5s5hESk 0DwqEALuRyJpZtcjSFRPtx0hvlGb1BaKk/9nTKwF7eXKnT5Dequ7RbSAI9ENb3Y8cH JPxo+iBxwPwUTQeXWuNmAL25eops6n0zpnwqQErM3fMbr3UtAv/FBiKkt9UlxbvDh+ Kp/zbJNP5ePfHk6FtI+qZmiKWnn3ue3JuWBE+jjFFeAwEcT2MRlBdrWzKBzCy5X6N6 1CZDkumOUeoFA== Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 9EA3D840C0; Wed, 13 Jul 2022 17:30:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1657726222; bh=iITtmjLjDul7qLW9ZqU+kKaXGxg6AW57G+9t5dvXGmg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=JKYsnGHoxftW864kadgYbzP9D7FetsOm1wb+Au/MgdcMjtO1eB/ogxpsvCYHhlcC4 ud91VZ+PVKkroL9iRHNvch17gdZeRURXSRU2g5fqOJ7S9zGl6WUy2en/4wI4Tbx8pg 75L2uF5GfoJ7aDGxyBujbUwAcAsr3V19B34rodzurqJZnOn5Mn7dX242Z14aIbO4ty peSJrzfwCi2Tlo9UhdvLCNUJz+C7cOR0QzRq5DfoismdGNgVDt6pbFv5ygpdWITWzg c+7O13Yen/c4rxV1DrAn2W0YcAy/wAPqTZRc8EWPdIewdY6jIkI3ZogaW6Oy7dlSyO BF1SFblX/hbPg== Message-ID: Date: Wed, 13 Jul 2022 17:30:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] cmd: fdt: Add support for reading stringlist property values Content-Language: en-US To: Simon Glass Cc: U-Boot Mailing List , Heinrich Schuchardt , Tom Rini References: <20220708215043.120573-1-marex@denx.de> <7861e6e7-5279-6973-ca80-373c45484cce@denx.de> From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed 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.6 at phobos.denx.de X-Virus-Status: Clean On 7/13/22 17:28, Simon Glass wrote: > Hi Marek, > > On Tue, 12 Jul 2022 at 05:47, Marek Vasut wrote: >> >> On 7/12/22 12:58, Simon Glass wrote: >>> Hi Marek, >>> >>> On Fri, 8 Jul 2022 at 15:50, Marek Vasut wrote: >>>> >>>> The fdt command currently handles stringlists as strings in 'fdt get value' >>>> subcommand. Since strings in FDT stringlists are separated by '\0', only >>>> the first value gets inserted into the environment variable passed to the >>>> 'fdt get value' command. >>>> >>>> Example, consider the following DT snippet: >>>> >>>> / { compatible = "foo", "bar" }; >>>> >>>> The following command only reports the first string in stringlist: >>>> => fdt get value var / compatible ; print var >>>> foo >>>> >>>> It is not possible to assign list of null-terminated strings into U-Boot >>>> environment variable. Add optional 'index' parameter to the subcommand >>>> 'fdt get value []' which lets user specify which >>>> string within the stringlist should be assigned into the 'var' variable. >>>> The default value of 'index' is 0 in case it is not present. This way the >>>> 'fdt' command API does not change and existing scripts are not broken. >>>> >>>> The following command now reports the Nth string in stringlist, counting >>>> from zero: >>>> => fdt get value var / compatible 1 ; print var >>>> bar >>>> >>>> Signed-off-by: Marek Vasut >>>> Cc: Heinrich Schuchardt >>>> Cc: Simon Glass >>>> Cc: Tom Rini >>>> --- >>>> cmd/fdt.c | 34 ++++++++++++++++++++++++++++------ >>>> 1 file changed, 28 insertions(+), 6 deletions(-) >>> >>> Can you please add docs and a test? >> >> I was expecting this kind of question ... there is no test for the FDT >> command. >> >>> I am happy to do a starting point for a test if you like. >> >> You can implement the test for this while at it. > > I sent a starting point for you, both docs and test. Thank you. Do I understand your remark correctly that you're blocking this particular patch from going in until there is a test ?