feat(cube : create_nicsensor.sh) 添加tmp112生成逻辑
This commit is contained in:
parent
a9031564dc
commit
91bb900ff1
@ -359,6 +359,18 @@ REG_tmp468="0x80"
|
||||
|
||||
def load_tmp112_feature(data):
|
||||
dbg_print("info", ">>> Start load tmp112 feature ...")
|
||||
tmp112_name = data['tmp112_name']
|
||||
|
||||
tmp112_channel_name_context = f"""
|
||||
TMP112_Sensor_name="{tmp112_name}"
|
||||
"""
|
||||
try:
|
||||
with open (output_path, 'a+', encoding='utf-8') as file:
|
||||
file.write(tmp112_channel_name_context)
|
||||
dbg_print("info", "Success to load tmp112 feature!")
|
||||
except Exception as e:
|
||||
dbg_print("Error", f"An error ouccuer when load tmp112 feature")
|
||||
|
||||
|
||||
def load_fru_feature(data):
|
||||
dbg_print("info", ">>> Start load fru feature ...")
|
||||
@ -1202,7 +1214,21 @@ fi
|
||||
except Exception as e:
|
||||
dbg_print("Error", f"An error ouccuer when load default function")
|
||||
|
||||
def replace_crlf_with_lf(input_file_path, output_file_path):
|
||||
try:
|
||||
with open(input_file_path, 'r', encoding='utf-8') as input_file:
|
||||
content = input_file.read()
|
||||
# 将 CRLF 替换为 LF
|
||||
content = content.replace('\r\n', '\n')
|
||||
|
||||
with open(output_file_path, 'w', encoding='utf-8') as output_file:
|
||||
output_file.write(content)
|
||||
|
||||
dbg_print("info", f"成功将 {input_file_path} 中的 CRLF 替换为 LF, 并保存到 {output_file_path}")
|
||||
except FileNotFoundError:
|
||||
dbg_print("Error", f"错误: 文件 {input_file_path} 未找到。")
|
||||
except Exception as e:
|
||||
dbg_print("Error", f"发生未知错误: {e}")
|
||||
|
||||
# =====================================================
|
||||
# Start execute script
|
||||
@ -1212,3 +1238,4 @@ process_nic_feature()
|
||||
load_public_function()
|
||||
process_hw_topo()
|
||||
load_default_function()
|
||||
replace_crlf_with_lf(output_path, output_path)
|
||||
Loading…
Reference in New Issue
Block a user