Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions js/workflows/usb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 " +
`<a href="https://support.mozilla.org/en-US/kb/install-firefox-linux#w_local-firefox-installation-in-users-account" target="_blank" rel="noopener noreferrer">installing Firefox from Mozilla's Linux download</a>.`;
}
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.";
}
Expand Down