Commit 740368c8 authored by lyong's avatar lyong

feat:增加读取屏幕模组信息方式

parent 675b8055
......@@ -81,7 +81,7 @@ function checkAutoFactory() {
// 获取系统信息
function updateSystemInfo() {
console.log("!updateSystemInfo");
// var total = getTotalStorageInfo();
// total.totalSizeMB
......@@ -115,7 +115,7 @@ function updateSystemInfo() {
systemInfo.wifiMac = getWifiInfo("address");
systemInfo.licenseRegistered = (checkLicense() == 1 ? "Pass" : "NG"); // 需根据实际实现
systemInfo.wifiIp = getWifiInfo("ip_address"); //前提wifi要连接
systemInfo.screenVendor = getScreenVendor(); // 需根据实际实现
systemInfo.screenVendor = getTouchVendor(); // 需根据实际实现
systemInfo.ddrFrequency = getDDRFrequency();
systemInfo.sn = handleSNDataBinFile.readStrFromBinFile() || "NG";
systemInfo.tpVersion = getTPVersion() || "NG";
......@@ -126,7 +126,7 @@ function updateSystemInfo() {
systemInfo.wifiModel = "AP62212"; // 示例值
......@@ -452,6 +452,9 @@ function getTPVersionOld() {
return "NG"; // 如果未找到有效数据,返回 "NG"
}
function getTPVersionNew() {
// 执行系统命令,将设备信息保存到临时文件
var checkVersionPath = "../../../../.." + "/sys/devices/platform/soc@3000000/2502800.twi/i2c-2/2-0055/stinform";
......@@ -502,6 +505,36 @@ function getScreenVendor() {
}
}
/**
* 获取触控模组厂商(Bus=0018 对应 Name 字段)
* 必须先写临时文件再读取
* @returns {string} 引号内原样字符串 或 "NG"
*/
function getTouchVendor() {
const procFile = '/proc/bus/input/devices';
const tmpFile = '/tmp/tp_vendor.txt';
/* ---- 1. 源文件存在性检查 ---- */
if (!fs.exists("../../../../.." + procFile)) return 'NG';
/* ---- 2. 抽 Bus=0018 段 -> 拿 Name 行 -> 解析引号内容 ---- */
const cmd =
`sed -n '/^I: Bus=0018/,/^$/p' "${procFile}" | ` +
`grep '^N: Name=' | ` +
`sed 's/.*"\\([^"]*\\)".*/\\1/' > ${tmpFile}`;
systemCtrl.executeSystemCommand(cmd);
/* ---- 3. 读临时文件 ---- */
const line = fs.read(tmpFile, 'r');
if (!line) return 'NG';
/* ---- 4. 返回原样字符串(已 trim) ---- */
return line.trim(); // 例如 "SITRONIX"
}
// 检查 License 是否注册(示例函数,需根据实际授权机制实现)
function checkLicense() {
const fs = require("@system.fs")
......
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