Commit 4ad59484 authored by lyong's avatar lyong

fix:自动化测试增加OTG

parent a8fe216e
......@@ -79,7 +79,15 @@ function doScan(fd) {
send(fd, scanList);
}
}
function doOtg(fd) { send(fd, '+OTG_OK'); }
function doOtg(fd) {
if (autoUtil.checkUsbDeviceExist() == true) {
console.log("doOtg 1")
send(fd, '+OK');
} else {
console.log("doOtg 0")
send(fd, '+FAIL');
}
}
var cntLcd = 0;
function doLcd(fd) {
cntLcd += 1;
......@@ -140,7 +148,7 @@ function doWriteLic(fd, recvBuf) {
if (ret == 1) {
send(fd, '+OK');
} else if (ret == -2) {
if (uartMode == 1) {
restartUart();
} else if (uartMode == 2) {
......@@ -242,7 +250,7 @@ function uartCarrieWave() {
console.log("!!!uart_init error");
return;
}
uart_set_mode(fd,"raw")
uart_set_mode(fd, "raw")
initEvent(fd);
console.log("uart_init ok");
idtimerAutoFactory = setInterval(function () {
......@@ -419,13 +427,13 @@ function restartUartCarrieWave() {
console.log("reset usart error");
return -1;
}
uart_set_mode(fd,"raw")
uart_set_mode(fd, "raw")
console.log("reset usart success,fd=" + fd);
return fd;
}
function uart_set_mode(fd, mode){
switch(mode){
function uart_set_mode(fd, mode) {
switch (mode) {
case "canonical": uart.uart_set_canonical(fd); break;
case "raw": uart.uart_set_raw(fd); break;
default: uart.uart_set_canonical(fd);
......
......@@ -42,6 +42,11 @@ function parseWifiScanResults(output) {
return results;
}
function checkUsbDeviceExist() {
var eUSB = require("eUSB.js");
return eUSB.isExist("/sys/devices/platform/soc@3000000/4200000.ehci1-controller/usb1/1-1");
}
function enableScan() {
console.log("!!!!!!!!!!!!Is @@@@@@@@@@@@@@@@@@@@@@@@@@#enableScan")
......@@ -452,5 +457,6 @@ module.exports = {
figureChecksum: figureChecksum,
testLicParce: testLicParce,
initUartPWM: initUartPWM,
devExist: devExist
devExist: devExist,
checkUsbDeviceExist: checkUsbDeviceExist
}
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