From 7379fb9b63c8b2abbb023520a97900b2d2408f00 Mon Sep 17 00:00:00 2001 From: Tomas Chmelevskij Date: Fri, 12 Apr 2024 08:34:11 +0200 Subject: [PATCH] feat: fix cli and presets tab on 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 46bc14ee3f0..e39f0059746 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 23b77304ff2..042c2785821 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) {