lkml.org 
[lkml]   [2013]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subjectfdtdump: properly handle multi-string properties
Date
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>
---
fdtdump.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/fdtdump.c b/fdtdump.c
index 207a46d..d4fa6d7 100644
--- a/fdtdump.c
+++ b/fdtdump.c
@@ -21,13 +21,23 @@ static void print_data(const char *data, int len)
{
int i;
const char *p = data;
+ const char *s;

/* no data, don't print */
if (len == 0)
return;

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) {
printf(" = <");
for (i = 0; i < len; i += 4)
--
1.7.12


\
 
 \ /
  Last update: 2013-01-04 21:01    [W:0.072 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site