[U-Boot] [PATCH] cmd_fdt.c: fix parse of byte streams and strings

Ken MacLeod ken at bitsko.slc.ut.us
Fri Sep 11 19:50:35 CEST 2009


On Fri, Sep 11, 2009 at 11:30 AM, Jerry Van Baren <gerald.vanbaren at ge.com>wrote:

> Scott Wood wrote:
> > On Thu, Sep 10, 2009 at 08:23:27PM -0400, Jerry Van Baren wrote:
> >>    fdt set /ethernet at f00 interrupts "this is a string"
> >> can now handle multiple strings (words) by concatenating them with
> >> spaces (quoted strings still work the same as before because of hush's
> >> argument parsing)
> >>    fdt set /ethernet at f00 interrupts this is a string
> >
> > How do you set a string list, then?
>

The original code did not support string lists and this patch does not
address string lists.


> I'm more concerned with the [] form because that really is a syntax
> change.  The original syntax with a single quoted argument will no
> longer be parsed if I understand the change (I need to apply the patch
> and confirm this):
> Old:
>     fdt set /ethernet at f00 interrupts "[33 2 34 2 36 2]"
> becomes
>     fdt set /ethernet at f00 interrupts [ 33 2 34 2 36 2 ]
> Note that the *must* be a space between "[" and "33" and between "2" and
> "]" because the "[" and "]" now have to be separate arguments.  This is
> what Andy did with "<" and ">" with no public outcry, so it is probably OK.
>
> --------------------------------------------------------------
> ==== Does anybody have a problem with this syntax change? ====
> --------------------------------------------------------------
>
>
There is no change in syntax as far as I can tell, it should parse byte
strings the same as one argument with spaces or as multiple arguments.
There remains a side effect (bug?) that if the the '[' and the next value
are separate arguments, a 0x00 gets inserted into the data.  The original
code either didn't parse the complete byte list (incrementing stridx early)
or hung in an endless loop.  This patch fixes that case.

The fix on strings is that in the original code if there were multiple
arguments then only the last argument was stored, at least now it stores
multiple arguments (collapsing inter-argument space, if any).

I don't have Hush enabled right now and the non-Hush quoting rules are still
a little fuzzy for me right now.  The 'fdt set' wasn't working at all for me
without this patch.

  -- Ken


More information about the U-Boot mailing list