diff --git a/js/workflows/usb.js b/js/workflows/usb.js index 845211b..d3c1971 100644 --- a/js/workflows/usb.js +++ b/js/workflows/usb.js @@ -4,7 +4,7 @@ import {GenericModal, DeviceInfoModal} from '../common/dialogs.js'; import {FileOps} from '@adafruit/circuitpython-repl-js'; // Use this to determine which FileTransferClient to load import {FileTransferClient as ReplFileTransferClient} from '../common/repl-file-transfer.js'; import {FileTransferClient as FSAPIFileTransferClient} from '../common/fsapi-file-transfer.js'; -import { isChromeOs, isMicrosoftWindows } from '../common/utilities.js'; +import { isChromeOs, isLinux, isMicrosoftWindows } from '../common/utilities.js'; let btnRequestSerialDevice, btnSelectHostFolder, btnUseHostFolder, lblWorkingfolder; @@ -501,8 +501,13 @@ print(binascii.hexlify(microcontroller.cpu.uid).decode('ascii').upper())` _suggestSerialConnectActions(error) { if (error.name == "NetworkError" && error.message.includes("Failed to open serial port")) { return "The serial port could not be opened. Make sure the correct port is selected and no other program is using it. For more information, see the JavaScript console."; - } else if (error.name == "NotFoundError" && error.message.includes("No port selected")) { - return "No serial port was selected. Press the 'Connect to Device' button to try again."; + } else if (error.name == "NotFoundError") { + const retryMessage = "No serial port was selected. Press the 'Connect to Device' button to try again."; + if (isLinux() && navigator.userAgent.includes("Firefox/")) { + return retryMessage + " If the picker was empty and Firefox was installed as a Snap, try " + + `installing Firefox from Mozilla's Linux download.`; + } + return retryMessage; } else if (error.name == "SecurityError") { return "Permissions to access the serial port were not granted. Please check your browser settings and try again."; }