On Mon, 27 Feb 2023 at 12:55, Marek Vasut <[email protected]> wrote: > > Import is_printable_string() implementation from DTC 1.7.0 as of > DTC commit 039a994 ("Bump version to v1.7.0") . This fixes a print > of u32 property which so far used to be printed as string by U-Boot > fdt print command. > > We might see the case where the parsed property value, in this case > it is a 32-bit integer, identified as a printable string or a null byte > (concatenated strings) because of its last character happens to be: > 0x00 (null character), 0xB (vertical tab character) or > 0x10 (line feed character) > In this situation, if the string is identified as printable string, > it will be displayed as character instead of hex value > > When the isprint() condition is true, there are two possibilities: > 1) The character is ASCII character (except the first 32) > 2) The character is extended ASCII character > > For example, > NG property in device tree: > clock-frequency = <16640000>; > by default, would be displayed as > clock-frequency = "", "ýè"; > and with this patch applied, would be displayed as > clock-frequency = <0x00fde800>; > > Full investigation was done by Nam and Hai, patch reworked by Marek > to use common code from DTC. > > Signed-off-by: Hai Pham <[email protected]> > Signed-off-by: Nam Nguyen <[email protected]> > Signed-off-by: Marek Vasut <[email protected]> > --- > Cc: Heinrich Schuchardt <[email protected]> > Cc: Simon Glass <[email protected]> > Cc: Tom Rini <[email protected]> > --- > cmd/fdt.c | 36 ++++++++++++++---------------------- > 1 file changed, 14 insertions(+), 22 deletions(-)
Reviewed-by: Simon Glass <[email protected]>

