Commit 85262834 authored by waterword's avatar waterword

feat(factoryTest): 更新系统信息获取逻辑

- 在系统信息中新增 screenVendor 字段,并在更新系统信息时获取屏幕厂商信息
- 修改 getScreenVendor 函数,通过读取系统文件获取真实的屏幕厂商信息
- 优化系统信息更新流程,确保在获取屏幕厂商信息之前完成其他信息的更新
- 注释掉系统信息输出部分,以避免不必要的控制台日志输出
parent 8700e8c9
...@@ -94,6 +94,7 @@ function updateSystemInfo() { ...@@ -94,6 +94,7 @@ function updateSystemInfo() {
systemInfo.wifiMac = "NG"; systemInfo.wifiMac = "NG";
systemInfo.licenseRegistered = "NG"; systemInfo.licenseRegistered = "NG";
systemInfo.wifiIp = "NG"; systemInfo.wifiIp = "NG";
systemInfo.screenVendor = "";
} else { } else {
systemInfo.cpuTemperature = getCPUTemperature(); systemInfo.cpuTemperature = getCPUTemperature();
...@@ -102,10 +103,11 @@ function updateSystemInfo() { ...@@ -102,10 +103,11 @@ function updateSystemInfo() {
systemInfo.wifiMac = getWifiInfo("address"); systemInfo.wifiMac = getWifiInfo("address");
systemInfo.licenseRegistered = (checkLicense() == 1 ? "Pass" : "NG"); // 需根据实际实现 systemInfo.licenseRegistered = (checkLicense() == 1 ? "Pass" : "NG"); // 需根据实际实现
systemInfo.wifiIp = getWifiInfo("ip_address"); //前提wifi要连接 systemInfo.wifiIp = getWifiInfo("ip_address"); //前提wifi要连接
systemInfo.screenVendor = getScreenVendor(); // 需根据实际实现
} }
systemInfo.sn = userData.aboutSNValue || "NG"; systemInfo.sn = userData.aboutSNValue || "NG";
systemInfo.tpVersion = "V5A"; // 示例值 systemInfo.tpVersion = "V5A"; // 示例值
systemInfo.screenVendor = getScreenVendor(); // 需根据实际实现
systemInfo.wifiModel = "AP62212"; // 示例值 systemInfo.wifiModel = "AP62212"; // 示例值
...@@ -153,22 +155,22 @@ function updateSystemInfo() { ...@@ -153,22 +155,22 @@ function updateSystemInfo() {
}); });
console.log(` // console.log(`
系统信息已更新: // 系统信息已更新:
固件版本: ${systemInfo.softwareVersion} // 固件版本: ${systemInfo.softwareVersion}
硬件版本: ${systemInfo.hardwareVersion} // 硬件版本: ${systemInfo.hardwareVersion}
产测版本: ${systemInfo.factorywareVersion} // 产测版本: ${systemInfo.factorywareVersion}
CPU温度: ${systemInfo.cpuTemperature} // CPU温度: ${systemInfo.cpuTemperature} ℃
CPU频率: ${systemInfo.cpuFrequency} MHz // CPU频率: ${systemInfo.cpuFrequency} MHz
存储总容量: ${systemInfo.storageInfo.totalSizeMB} MB // 存储总容量: ${systemInfo.storageInfo.totalSizeMB} MB
存储剩余空间: ${systemInfo.storageInfo.totalAvailableMB} MB // 存储剩余空间: ${systemInfo.storageInfo.totalAvailableMB} MB
WiFi MAC地址: ${systemInfo.wifiMac} // WiFi MAC地址: ${systemInfo.wifiMac}
SN序列号: ${systemInfo.sn} // SN序列号: ${systemInfo.sn}
TP固件版本: ${systemInfo.tpVersion} // TP固件版本: ${systemInfo.tpVersion}
屏厂家名: ${systemInfo.screenVendor} // 屏厂家名: ${systemInfo.screenVendor}
WiFi型号: ${systemInfo.wifiModel} // WiFi型号: ${systemInfo.wifiModel}
License注册状态: ${systemInfo.licenseRegistered} // License注册状态: ${systemInfo.licenseRegistered}
`); // `);
} }
// 启动定时器 // 启动定时器
...@@ -319,6 +321,7 @@ function getCPUTemperature() { ...@@ -319,6 +321,7 @@ function getCPUTemperature() {
function getCPUFrequency() { function getCPUFrequency() {
systemCtrl.executeSystemCommand("cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq > /tmp/cpu_freq.txt"); systemCtrl.executeSystemCommand("cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq > /tmp/cpu_freq.txt");
const freqStr = fs.read("/tmp/cpu_freq.txt", "r"); const freqStr = fs.read("/tmp/cpu_freq.txt", "r");
...@@ -334,9 +337,17 @@ function getCPUFrequency() { ...@@ -334,9 +337,17 @@ function getCPUFrequency() {
function getScreenVendor() { function getScreenVendor() {
// 示例:读取某个 I2C 设备寄存器或配置文件 systemCtrl.executeSystemCommand("cat /sys/devices/platform/soc@3000000/2502800.twi/i2c-2/2-0014/id > /tmp/tp_id.txt");
// 这里仅返回示例值 const vendorStr = fs.read("/tmp/tp_id.txt", "r");
return "未知屏厂家"; if (vendorStr) {
const trimmedVendorStr = vendorStr.trim();
console.log(`Screen Vendor: ${trimmedVendorStr}`);
return trimmedVendorStr;
} else {
console.log("无法读取屏幕厂商信息");
return "NG";
}
} }
// 检查 License 是否注册(示例函数,需根据实际授权机制实现) // 检查 License 是否注册(示例函数,需根据实际授权机制实现)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment