mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 10:53:17 +00:00
DTS parsing improvement for phandle-array created by #define
This commit is contained in:
parent
f491a86064
commit
e960cd93c3
@ -77,6 +77,20 @@ def property_to_string(property: DeviceProperty, devices: list[Device]) -> str:
|
||||
return "{ " + ",".join(value_list) + " }"
|
||||
elif type == "phandle":
|
||||
return find_phandle(devices, property.value)
|
||||
elif type == "phandle-array":
|
||||
value_list = list()
|
||||
if isinstance(property.value, list):
|
||||
for item in property.value:
|
||||
if isinstance(item, PropertyValue):
|
||||
value_list.append(property_to_string(DeviceProperty(name="", type=item.type, value=item.value), devices))
|
||||
else:
|
||||
value_list.append(str(item))
|
||||
return "{ " + ",".join(value_list) + " }"
|
||||
elif isinstance(property.value, str):
|
||||
# If it's a string, assume it's a #define and show it as-is
|
||||
return property.value
|
||||
else:
|
||||
raise Exception(f"Unsupported phandle-array type for {property.value}")
|
||||
else:
|
||||
raise DevicetreeException(f"property_to_string() has an unsupported type: {type}")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user