Commit 19128819 authored by lyong's avatar lyong

feat:增加TP版本号读取兼容老屏幕读取方式

parent b4ab2c66
......@@ -140,7 +140,7 @@
touchedYesButton: function (node, topNode, x, y) {
// globalThis.factoryTest.tvoc = 1;
this.clearTimer();
this.clearTimer();
var global = require("factory_dataStorage.js");
global.setFactoryData("tvoc", 1);
var yesJumpPage = require("factoryYesJumpPage.js");
......
......@@ -64,7 +64,7 @@ function setTextColorByValue(that, fullKey, value) {
if (checkedCount == textValueKeys.length) {
that.factoryTestSystemCheck = (ngCount == 0) ? 1 : 2;
if(that.factoryTestSystemCheck == 1){
if (that.factoryTestSystemCheck == 1) {
checkAutoFactory();
}
// 重置计数器,方便下次调用
......@@ -106,6 +106,7 @@ function updateSystemInfo() {
systemInfo.screenVendor = "";
systemInfo.ddrFrequency = "NG";
systemInfo.sn = userData.aboutSNValue || "NG";
systemInfo.tpVersion = userData.tpFirmwareVersion || "NG"; // 示例值
} else {
systemInfo.cpuTemperature = getCPUTemperature();
......@@ -117,10 +118,11 @@ function updateSystemInfo() {
systemInfo.screenVendor = getScreenVendor(); // 需根据实际实现
systemInfo.ddrFrequency = getDDRFrequency();
systemInfo.sn = handleSNDataBinFile.readStrFromBinFile() || "NG";
systemInfo.tpVersion = getTPVersion() || "NG";
}
// systemInfo.sn = userData.aboutSNValue || "NG";
// systemInfo.sn = userData.aboutInnerSNValue || "NG";
systemInfo.tpVersion = userData.tpFirmwareVersion; // 示例值
systemInfo.wifiModel = "AP62212"; // 示例值
......@@ -412,8 +414,82 @@ function getCPUFrequency() {
}
function getTPVersion() {
var versionVal = getTPVersionNew();
console.log("getTPVersion 1: " + versionVal);
if (versionVal == "NG") {
versionVal = getTPVersionOld();
console.log("getTPVersion 2: " + versionVal);
}
return versionVal;
}
function getTPVersionOld() {
// 执行系统命令,将设备信息保存到临时文件
var checkVersionPath = "../../../../.." + "/proc/gt1x_debug";
console.log("checkVersionPath: " + checkVersionPath);
if (!fs.exists(checkVersionPath)) {
return "NG";
}
console.log("getTPVersion 1");
systemCtrl.executeSystemCommand("cat " + checkVersionPath + " > /tmp/gt1x_debug.txt");
// 读取临时文件内容
const debugStr = fs.read("/tmp/gt1x_debug.txt", "r");
if (debugStr) {
// 按行分割文件内容
const debugLines = debugStr.split('\n');
for (let i = 0; i < debugLines.length; i++) {
const line = debugLines[i].trim();
// 检查是否包含有效数据
if (line.startsWith("0x")) {
// 提取第一个值
const firstValue = line.split(',')[0].trim();
const decimalValue = parseInt(firstValue, 16);
return decimalValue.toString();
}
}
}
return "NG"; // 如果未找到有效数据,返回 "NG"
}
function getTPVersionNew() {
// 执行系统命令,将设备信息保存到临时文件
var checkVersionPath = "../../../../.." + "/sys/devices/platform/soc@3000000/2502800.twi/i2c-2/2-0055/stinform";
console.log("checkVersionPath: " + checkVersionPath);
if (!fs.exists(checkVersionPath)) {
return "NG";
}
systemCtrl.executeSystemCommand("cat " + checkVersionPath + " > /tmp/tp_version1.txt");
// 读取临时文件内容
const infoStr = fs.read("/tmp/tp_version1.txt", "r");
if (infoStr) {
// 按行分割文件内容
const infoLines = infoStr.split('\n');
for (let i = 0; i < infoLines.length; i++) {
const line = infoLines[i].trim();
// 检查是否包含 "FW Version" 信息
if (line.startsWith("FW Version")) {
// 提取版本号
const version = line.split('=')[1].trim();
// 转换为10进制
const decimalValue = parseInt(version, 16);
return decimalValue.toString();
}
}
}
return "NG"; // 如果未找到版本信息,返回 "NG"
}
function getScreenVendor() {
systemCtrl.executeSystemCommand("cat /sys/devices/platform/soc@3000000/2502800.twi/i2c-2/2-0014/id > /tmp/tp_id.txt");
var checkVersionPath = "/sys/devices/platform/soc@3000000/2502800.twi/i2c-2/2-0014/id";
if (!fs.exists(checkVersionPath)) {
return "NG";
}
// cf1133
systemCtrl.executeSystemCommand("cat " + checkVersionPath + " > /tmp/tp_id.txt");
const vendorStr = fs.read("/tmp/tp_id.txt", "r");
if (vendorStr) {
......
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