File tree 2 files changed +7
-1
lines changed
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,15 @@ def is_attribute_non_volatile(source, attribute_id):
27
27
with open (source , 'r' ) as file :
28
28
content = file .read ()
29
29
30
+ print (f"source = { source } " )
31
+ print (f"attribute_id = { attribute_id } " )
30
32
soup = BeautifulSoup (content , 'lxml-xml' )
31
33
32
34
# Debug: Print the parsed XML structure (for a quick visual check)
33
35
# print("Parsed XML:", soup.prettify())
34
36
35
37
# Find the attribute with the given ID (convert hex ID from XML to integer for comparison)
36
- attribute = soup .find ('attribute' , {'id' : lambda x : int (x , 16 ) == attribute_id })
38
+ attribute = soup .find ('attribute' , {'id' : lambda x : x is not None and int (x , 16 ) == attribute_id })
37
39
38
40
# Debug: Check if the attribute was found
39
41
print ("Attribute found:" , attribute is not None )
Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ def find_ram_attributes_and_replace(data, replace=False):
50
50
cluster_name = cluster .get ('name' )
51
51
cluster_code = cluster .get ('code' )
52
52
53
+ if cluster_code > 0x7FFF : # Not standard cluster ID
54
+ continue ;
55
+
53
56
for attribute in cluster .get ('attributes' , []): # Iterate through the attributes
54
57
attribute_code = attribute .get ('code' ) # Get the attribute's code
55
58
# Filter global element
@@ -59,6 +62,7 @@ def find_ram_attributes_and_replace(data, replace=False):
59
62
60
63
attribute_name = attribute .get ('name' ) # Get the attribute's name
61
64
65
+ print (f"cluster_code = { cluster_code } , attribute_code={ attribute_code } , attribute_name = { attribute_name } " )
62
66
spec_xml = id2XmlMap [cluster_code ]['file' ]
63
67
if not is_attribute_non_volatile (spec_xml , attribute_code ):
64
68
print (f"\033 [41m Ignore cluster: { cluster_name } , name:{ attribute_name } \033 [0m" )
You can’t perform that action at this time.
0 commit comments