scripts/dts: fix support for uint8-array property values
uint8-array is the name for what the devicetree specification calls a
bytestring.
The original parsing code treated square brackets as equivalent to
quotes or angle brackets, failing to interpret elements as hex-encoded.
This was a bug, corrected in this patch by processing content as a
sequence of hex-encoded bytes with arbitrary whitespace.
The original generating code emitted the property as individual
elements. Replace that with generation of a single structure
initializer, which is more useful in cases where the length of a
property value may vary between nodes.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
diff --git a/scripts/dts/devicetree.py b/scripts/dts/devicetree.py
index 67202d6..eddbfd1 100755
--- a/scripts/dts/devicetree.py
+++ b/scripts/dts/devicetree.py
@@ -114,7 +114,7 @@
if value[0] == '"':
return parse_values(value, '"', '"', ',')
if value[0] == '[':
- return parse_values(value, '[', ']', ' ')
+ return list(bytes.fromhex(value[1:value.find(']')]))
if value[0] == '&':
return {'ref': value[1:]}