From 2ab33f1c89bab38791cf1ee5c1dea280a42a878b Mon Sep 17 00:00:00 2001 From: Tomas Chmelevskij Date: Tue, 14 May 2024 00:11:27 +0200 Subject: [PATCH] Cli on web (#3913) feat: cli on the web --- src/js/tabs/cli.js | 6 ++++-- src/tabs/presets/CliEngine.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/js/tabs/cli.js b/src/js/tabs/cli.js index 46bc14ee3f..e39f005974 100644 --- a/src/js/tabs/cli.js +++ b/src/js/tabs/cli.js @@ -6,13 +6,15 @@ import BuildApi from '../BuildApi'; import { tracking } from '../Analytics'; import { reinitializeConnection } from "../serial_backend"; import CONFIGURATOR from "../data_storage"; -import serial from "../serial"; import CliAutoComplete from "../CliAutoComplete"; import UI_PHONES from "../phones_ui"; import { gui_log } from "../gui_log"; import jBox from "jbox"; import { checkChromeRuntimeError } from "../utils/common"; import $ from 'jquery'; +import { serialShim } from "../serial_shim"; + +const serial = serialShim(); const cli = { lineDelayMs: 15, @@ -446,7 +448,7 @@ cli.read = function (readInfo) { Windows understands (both) CRLF Chrome OS currently unknown */ - const data = new Uint8Array(readInfo.data); + const data = new Uint8Array(readInfo.data ?? readInfo); let validateText = ""; let sequenceCharsToSkip = 0; diff --git a/src/tabs/presets/CliEngine.js b/src/tabs/presets/CliEngine.js index 23b77304ff..042c278582 100644 --- a/src/tabs/presets/CliEngine.js +++ b/src/tabs/presets/CliEngine.js @@ -1,9 +1,11 @@ import GUI from "../../js/gui"; import { i18n } from "../../js/localization"; import CONFIGURATOR from "../../js/data_storage"; -import serial from "../../js/serial"; import { reinitializeConnection } from "../../js/serial_backend"; import { gui_log } from "../../js/gui_log"; +import { serialShim } from "../../js/serial_shim"; + +const serial = serialShim(); export default class CliEngine { @@ -186,7 +188,7 @@ export default class CliEngine Windows understands (both) CRLF Chrome OS currently unknown */ - const data = new Uint8Array(readInfo.data); + const data = new Uint8Array(readInfo.data ?? readInfo); let validateText = ""; let sequenceCharsToSkip = 0; for (const charCode of data) {