From 1772929fffb8a30187137a6af9140490d0007572 Mon Sep 17 00:00:00 2001 From: danghongquan Date: Fri, 30 May 2025 10:47:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=E6=89=A9=E5=B1=95=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=8C=87=E5=AE=9ASN=E4=B8=8B=E5=8F=91=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: danghongquan --- record/record.js | 6 +++--- usb/usb.js | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/record/record.js b/record/record.js index 610314f..f98d2c5 100644 --- a/record/record.js +++ b/record/record.js @@ -938,9 +938,9 @@ function mkdirForSnapshot() { tmpTimeName = new Date().getTime(); imageFileName = tmpTimeName; logger.info(`创建截图文件夹指令,tmpTimeName:${tmpTimeName}`); - let cmd = `hdc shell mkdir /data/local/tmp/snapshot_${tmpTimeName}`; + let cmd = `hdc -t ${serialNum} shell mkdir /data/local/tmp/snapshot_${tmpTimeName}`; logger.info(`创建截图文件夹指令,cmd:${cmd}`); - exec(`hdc shell mkdir /data/local/tmp/snapshot_${tmpTimeName}`, (error, stdout, stderr) => { + exec(cmd, (error, stdout, stderr) => { logger.info(`mkdirForSnapshot : ${error, stdout, stderr}`) if (error || (stderr && stderr.length > 0) || stdout.includes('[Fail]')) { const errorMsg = new Uint8Array(encoder.encode(stdout || error || stderr)); @@ -977,7 +977,7 @@ function snapshotImages() { //执行截图命令 function snapshot(snapshotName) { - let command = `hdc -t ${serialNum} shell snapshot_display -f /data/local/tmp/snapshot_${tmpTimeName}/${snapshotName}.jpeg -w 500 -h 1000`; + let command = `hdc -t ${serialNum} shell snapshot_display -f /data/local/tmp/snapshot_${tmpTimeName}/${snapshotName}.jpeg`; try { exec(command, (error, stdout, stderr) => { if (error || (stderr && stderr.length > 0) || stdout.includes('[Fail]')) { diff --git a/usb/usb.js b/usb/usb.js index f7a619b..7485406 100644 --- a/usb/usb.js +++ b/usb/usb.js @@ -54,7 +54,7 @@ function process(session_id, cmd, data) { break; case GET_APP_CMD: logger.info(`to get APP name.type:${TypeManage.TypeConfig.USB_TYPE},sessionId:${session_id},cmd:${cmd}`); - getApp(session_id, cmd); + getApp(session_id, data, cmd); break; case GET_VERSION: logger.info(`to get device version.type:${TypeManage.TypeConfig.USB_TYPE},sessionId:${session_id},cmd:${cmd}`); @@ -112,7 +112,7 @@ function sendMsg(session_id, cmd, message) { } // 获取指定设备的CPU数 -function getCpuCunt(session_id, data) { +function getCpuCunt(session_id, data, cmd) { const decoder = new TextDecoder(); let sendSerialNum = decoder.decode(data).trim(); console.log(`hdc -t ${sendSerialNum} shell grep -c 'processor' /proc/cpuinfo`) @@ -130,7 +130,7 @@ function getCpuCunt(session_id, data) { } // 获取指定设备中关于hiperf的事件列表 -function getEvent(session_id, data) { +function getEvent(session_id, data, cmd) { const decoder = new TextDecoder(); let sendSerialNum = decoder.decode(data).trim(); exec(`hdc -t ${sendSerialNum} shell hiperf list`, (error, stdout, stderr) => { @@ -146,8 +146,10 @@ function getEvent(session_id, data) { }) } -function getApp(session_id) { - exec(`hdc shell bm dump -a`, (error, stdout, stderr) => { +function getApp(session_id, data, cmd) { + const decoder = new TextDecoder(); + let sendSerialNum = decoder.decode(data).trim(); + exec(`hdc -t ${sendSerialNum} shell bm dump -a`, (error, stdout, stderr) => { if (error || (stderr && stderr.length > 0)) { logger.error(`Failed to obtain app.${TypeManage.TypeConfig.USB_TYPE},sessionId:${session_id},cmd:${cmd}`) return; @@ -161,7 +163,7 @@ function getApp(session_id) { } // 获取设备版本号 -function getVersion(session_id, data) { +function getVersion(session_id, data, cmd) { const decoder = new TextDecoder(); let sendSerialNum = decoder.decode(data).trim(); exec(`hdc -t ${sendSerialNum} shell param get const.product.software.version`, (error, stdout, stderr) => { -- Gitee From 8ab229140a4472082c8d43a58d295473ffe759be Mon Sep 17 00:00:00 2001 From: danghongquan Date: Fri, 30 May 2025 10:50:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E6=B1=87=E7=BC=96=E8=8E=B7=E5=8F=96an?= =?UTF-8?q?=E7=9A=84=E8=99=9A=E6=8B=9F=E5=9C=B0=E5=9D=80=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: danghongquan --- disassembly/disassembly.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disassembly/disassembly.js b/disassembly/disassembly.js index 4d35574..03afdd2 100644 --- a/disassembly/disassembly.js +++ b/disassembly/disassembly.js @@ -290,7 +290,7 @@ function extractInfoFromAnTxt(func, elf_name, vaddr, session_id, anFilePath) { let textName = ''; for (let i of outerStdOut.split('\n')) { let coms = i.split(/\s+/g); - if (coms[5] === func) { + if (coms[5] === func && parseInt(coms[4], 16) !== 0) { eaddr = parseInt(coms[0], 16) + parseInt(coms[4], 16); textName = coms[3]; break; -- Gitee