mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
fdtdump: properly handle multi-string properties
Device tree can store multiple strings in a single property. We didn't handle that case properly. Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com> Acked-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
e4b497f367
commit
94a4799b20
1 changed files with 11 additions and 1 deletions
12
fdtdump.c
12
fdtdump.c
|
@ -21,13 +21,23 @@ static void print_data(const char *data, int len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char *p = data;
|
const char *p = data;
|
||||||
|
const char *s;
|
||||||
|
|
||||||
/* no data, don't print */
|
/* no data, don't print */
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (util_is_printable_string(data, len)) {
|
if (util_is_printable_string(data, len)) {
|
||||||
printf(" = \"%s\"", (const char *)data);
|
printf(" = ");
|
||||||
|
|
||||||
|
s = data;
|
||||||
|
do {
|
||||||
|
printf("\"%s\"", s);
|
||||||
|
s += strlen(s) + 1;
|
||||||
|
if (s < data + len)
|
||||||
|
printf(", ");
|
||||||
|
} while (s < data + len);
|
||||||
|
|
||||||
} else if ((len % 4) == 0) {
|
} else if ((len % 4) == 0) {
|
||||||
printf(" = <");
|
printf(" = <");
|
||||||
for (i = 0; i < len; i += 4)
|
for (i = 0; i < len; i += 4)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue