Update: 更新Mixly.Electron.Serial
This commit is contained in:
@@ -1464,6 +1464,7 @@
|
|||||||
"Mixly.Env",
|
"Mixly.Env",
|
||||||
"Mixly.Msg",
|
"Mixly.Msg",
|
||||||
"Mixly.Debug",
|
"Mixly.Debug",
|
||||||
|
"Mixly.MArray",
|
||||||
"Mixly.Electron"
|
"Mixly.Electron"
|
||||||
],
|
],
|
||||||
"provide": [
|
"provide": [
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ goog.require('Mixly.Serial');
|
|||||||
goog.require('Mixly.Env');
|
goog.require('Mixly.Env');
|
||||||
goog.require('Mixly.Msg');
|
goog.require('Mixly.Msg');
|
||||||
goog.require('Mixly.Debug');
|
goog.require('Mixly.Debug');
|
||||||
|
goog.require('Mixly.MArray');
|
||||||
goog.require('Mixly.Electron');
|
goog.require('Mixly.Electron');
|
||||||
goog.provide('Mixly.Electron.Serial');
|
goog.provide('Mixly.Electron.Serial');
|
||||||
|
|
||||||
@@ -22,6 +23,7 @@ const {
|
|||||||
Env,
|
Env,
|
||||||
Msg,
|
Msg,
|
||||||
Debug,
|
Debug,
|
||||||
|
MArray,
|
||||||
Electron
|
Electron
|
||||||
} = Mixly;
|
} = Mixly;
|
||||||
|
|
||||||
@@ -45,8 +47,8 @@ class ElectronSerial extends Serial {
|
|||||||
this.getPorts = async function () {
|
this.getPorts = async function () {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (Env.currentPlatform === 'linux') {
|
if (Env.currentPlatform === 'linux') {
|
||||||
child_process.exec('ls /dev/ttyACM* /dev/ttyUSB* /dev/tty*USB*', (err, stdout, stderr) => {
|
child_process.exec('ls /dev/ttyACM* /dev/tty*USB*', (err, stdout, stderr) => {
|
||||||
let portsName = stdout.split('\n');
|
let portsName = MArray.unique(stdout.split('\n'));
|
||||||
let newPorts = [];
|
let newPorts = [];
|
||||||
for (let i = 0; i < portsName.length; i++) {
|
for (let i = 0; i < portsName.length; i++) {
|
||||||
if (!portsName[i]) {
|
if (!portsName[i]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user