From 76444c032cd5e84e681236c4339006f5300d9ea7 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Tue, 26 Jul 2022 12:55:06 -0500 Subject: [PATCH] firmware/installPybricksDialog: add warning for windows/linux usb This warns the user before failure. Otherwise they will click the flash button and no devices will appear in the scan dialog. --- src/app/constants.ts | 6 +++ .../InstallPybricksDialog.tsx | 40 ++++++++++++++++++- .../translations/en.json | 5 +++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/app/constants.ts b/src/app/constants.ts index 7c0a22af..4bf20841 100644 --- a/src/app/constants.ts +++ b/src/app/constants.ts @@ -38,6 +38,12 @@ export const pybricksBluetoothTroubleshootingUrl = export const pybricksUsbDfuTroubleshootingUrl = 'https://github.com/pybricks/support/discussions/688'; +export const pybricksUsbDfuWindowsDriverInstallUrl = + 'https://github.com/pybricks/support/discussions/688#discussioncomment-3201466'; + +export const pybricksUsbLinuxUdevRulesUrl = + 'https://github.com/pybricks/support/discussions/688#discussioncomment-3239099'; + /** Pybricks copyright statement. */ export const pybricksCopyright = 'Copyright (c) 2020-2022 The Pybricks Authors'; diff --git a/src/firmware/installPybricksDialog/InstallPybricksDialog.tsx b/src/firmware/installPybricksDialog/InstallPybricksDialog.tsx index 93772705..ec29e1ec 100644 --- a/src/firmware/installPybricksDialog/InstallPybricksDialog.tsx +++ b/src/firmware/installPybricksDialog/InstallPybricksDialog.tsx @@ -4,6 +4,7 @@ import './installPybricksDialog.scss'; import { Button, + Callout, Checkbox, Classes, ControlGroup, @@ -24,7 +25,11 @@ import { Select2 } from '@blueprintjs/select'; import classNames from 'classnames'; import React, { useMemo, useState } from 'react'; import { useDispatch } from 'react-redux'; -import { appName } from '../../app/constants'; +import { + appName, + pybricksUsbDfuWindowsDriverInstallUrl, + pybricksUsbLinuxUdevRulesUrl, +} from '../../app/constants'; import HelpButton from '../../components/HelpButton'; import { Hub, @@ -37,6 +42,8 @@ import { HubPicker } from '../../components/hubPicker/HubPicker'; import { FileMetadata } from '../../fileStorage'; import { useFileStorageMetadata } from '../../fileStorage/hooks'; import { useSelector } from '../../reducers'; +import ExternalLinkIcon from '../../utils/ExternalLinkIcon'; +import { isLinux, isWindows } from '../../utils/os'; import { firmwareInstallPybricksDialogAccept, firmwareInstallPybricksDialogCancel, @@ -348,6 +355,37 @@ const BootloaderModePanel: React.VoidFunctionComponent return (
+ {hubHasUSB(hubType) && isLinux() && ( +

+ + {i18n.translate('bootloaderPanel.warning.linux')}{' '} + + {i18n.translate('bootloaderPanel.warning.learnMore')} + + + +

+ )} + {hubHasUSB(hubType) && isWindows() && ( +

+ + {i18n.translate('bootloaderPanel.warning.windows')}{' '} + + {i18n.translate('bootloaderPanel.warning.learnMore')} + + + +

+ )} +

{i18n.translate('bootloaderPanel.instruction1')}

    {hubHasUSB(hubType) && ( diff --git a/src/firmware/installPybricksDialog/translations/en.json b/src/firmware/installPybricksDialog/translations/en.json index 4da3c19d..5f00baed 100644 --- a/src/firmware/installPybricksDialog/translations/en.json +++ b/src/firmware/installPybricksDialog/translations/en.json @@ -55,6 +55,11 @@ }, "bootloaderPanel": { "title": "Place hub in bootloader mode", + "warning": { + "linux": "If you have never used Pybricks with USB on Linux, you will need to configure udev rules to allow permission before you can flash the hub firmware.", + "windows": " If you have never used Pybricks with USB on Windows, you may need to manually install a USB driver before you can flash the hub firmware.", + "learnMore": "Learn more." + }, "instruction1": "To flash the firmware, the hub must be placed in bootloader mode. Follow the steps below to do this:", "button": { "bluetooth": "Bluetooth button",