Modify CPLD name to more detail

This commit is contained in:
jostar-yang 2023-02-10 15:02:21 +08:00
parent 045a8df6f0
commit 122fd258b0
3 changed files with 20 additions and 18 deletions

View File

@ -3,19 +3,19 @@
"name": "7726-32X", "name": "7726-32X",
"components": [ "components": [
{ {
"name": "MB CPLD1" "name": "MB_CPLD1"
}, },
{ {
"name": "MB CPLD2" "name": "MB_CPLD2"
}, },
{ {
"name": "MB CPLD3" "name": "MB_CPLD3"
}, },
{ {
"name": "FAN CPLD" "name": "FAN_CPLD"
}, },
{ {
"name": "CPU CPLD" "name": "CPU_CPLD"
}, },
{ {
"name": "BIOS" "name": "BIOS"

View File

@ -12,20 +12,20 @@ except ImportError as e:
raise ImportError(str(e) + "- required module not found") raise ImportError(str(e) + "- required module not found")
CPLD_ADDR_MAPPING = { CPLD_ADDR_MAPPING = {
"MB CPLD1": ['11', '0x60'], "MB_CPLD1": ['11', '0x60'],
"MB CPLD2": ['12', '0x62'], "MB_CPLD2": ['12', '0x62'],
"MB CPLD3": ['13', '0x64'], "MB_CPLD3": ['13', '0x64'],
"FAN CPLD": ['54', '0x66'], "FAN_CPLD": ['54', '0x66'],
"CPU CPLD": ['0', '0x65'], "CPU_CPLD": ['0', '0x65'],
} }
SYSFS_PATH = "/sys/bus/i2c/devices/" SYSFS_PATH = "/sys/bus/i2c/devices/"
BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version"
COMPONENT_LIST= [ COMPONENT_LIST= [
("MB CPLD1", "Mainboard CPLD 1"), ("MB_CPLD1", "Mainboard CPLD(0x60)"),
("MB CPLD2", "Mainboard CPLD 2"), ("MB_CPLD2", "Mainboard CPLD(0x62)"),
("MB CPLD3", "Mainboard CPLD 3"), ("MB_CPLD3", "Mainboard CPLD(0x64)"),
("FAN CPLD", "Fan board CPLD"), ("FAN_CPLD", "Fan board CPLD(0x66)"),
("CPU CPLD", "CPU CPLD"), ("CPU_CPLD", "CPU CPLD(0x65)"),
("BIOS", "Basic Input/Output System") ("BIOS", "Basic Input/Output System")
] ]

View File

@ -37,7 +37,9 @@ class APIHelper():
try: try:
with open(file_path, 'r', errors='replace') as fd: with open(file_path, 'r', errors='replace') as fd:
data = fd.read() data = fd.read()
return data.strip() ret = data.strip()
if len(ret) > 0:
return ret
except IOError: except IOError:
pass pass
return None return None