Skip to content

Commit

Permalink
chore(suite): unreadable device tips improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 committed Oct 1, 2024
1 parent 3e1d4df commit 9f73375
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
TROUBLESHOOTING_TIP_CABLE,
TROUBLESHOOTING_TIP_USB,
TROUBLESHOOTING_TIP_DIFFERENT_COMPUTER,
TROUBLESHOOTING_TIP_UNREADABLE_HID,
} from 'src/components/suite/troubleshooting/tips';
import { useDispatch } from 'src/hooks/suite';
import { notificationsActions } from '@suite-common/toast-notifications';
Expand Down Expand Up @@ -102,20 +103,7 @@ interface DeviceUnreadableProps {
isWebUsbTransport: boolean;
}

// We don't really know what happened, show some generic help and provide link to contact a support
export const DeviceUnreadable = ({ device, isWebUsbTransport }: DeviceUnreadableProps) => {
if (isWebUsbTransport) {
// only install bridge will help (webusb + HID device)
return (
<TroubleshootingTips
label={<Translation id="TR_TROUBLESHOOTING_UNREADABLE_WEBUSB" />}
items={[TROUBLESHOOTING_TIP_BRIDGE_STATUS, TROUBLESHOOTING_TIP_SUITE_DESKTOP]}
offerWebUsb
data-testid="@connect-device-prompt/unreadable-hid"
/>
);
}

// this error is dispatched by trezord when udev rules are missing
if (isLinux() && device?.error === 'LIBUSB_ERROR_ACCESS') {
return <> {isDesktop() ? <UdevDesktop /> : <UdevWeb />}</>;
Expand All @@ -130,6 +118,9 @@ export const DeviceUnreadable = ({ device, isWebUsbTransport }: DeviceUnreadable
/>
}
items={[
// typically this error happens for old HID devices. Historically we were only unable to read them using WebUSB but with the advent of
// node-bridge we can't read them either. The only way out of this is to install the old bridge which should be explained in a knowledge base article
TROUBLESHOOTING_TIP_UNREADABLE_HID,
TROUBLESHOOTING_TIP_CABLE,
TROUBLESHOOTING_TIP_USB,
TROUBLESHOOTING_TIP_DIFFERENT_COMPUTER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ export const TROUBLESHOOTING_TIP_WEBUSB_ENVIRONMENT = {
hide: isWebUsb() || !isWeb(),
};

export const TROUBLESHOOTING_TIP_UNREADABLE_HID = {
key: 'unreadable-hid',
heading: <Translation id="TR_TROUBLESHOOTING_TIP_UNREADABLE_HID_TITLE" />,
description: <Translation id="TR_TROUBLESHOOTING_TIP_UNREADABLE_HID_DESCRIPTION" />,
};

export const TROUBLESHOOTING_TIP_SUITE_DESKTOP = {
key: 'suite-desktop',
heading: <Translation id="TR_TROUBLESHOOTING_TIP_SUITE_DESKTOP_TITLE" />,
Expand Down
11 changes: 10 additions & 1 deletion packages/suite/src/support/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7197,6 +7197,15 @@ export default defineMessages({
'Only Chromium-based browsers currently allow direct communication with USB devices',
id: 'TR_TROUBLESHOOTING_TIP_BROWSER_WEBUSB_DESCRIPTION',
},
TR_TROUBLESHOOTING_TIP_UNREADABLE_HID_TITLE: {
defaultMessage: 'You may be using a very old Trezor model',
id: 'TR_TROUBLESHOOTING_TIP_BROWSER_WEBUSB_TITLE',
},
TR_TROUBLESHOOTING_TIP_UNREADABLE_HID_DESCRIPTION: {
defaultMessage:
'If you are using a very old Trezor model 2017 and earlier please follow innstructions in <a>the knowledge base</a>',
id: 'TR_TROUBLESHOOTING_TIP_BROWSER_WEBUSB_DESCRIPTION',
},
TR_TROUBLESHOOTING_TIP_SUITE_DESKTOP_TITLE: {
id: 'TR_TROUBLESHOOTING_TIP_SUITE_DESKTOP_TITLE',
defaultMessage: 'Use the Trezor Suite desktop app',
Expand Down Expand Up @@ -7259,7 +7268,7 @@ export default defineMessages({
TR_TROUBLESHOOTING_UNREADABLE_WEBUSB: {
id: 'TR_TROUBLESHOOTING_UNREADABLE_WEBUSB',
defaultMessage:
"Your device is connected properly, but your browser can't communicate with it at the moment. You need to install Trezor Bridge.",
"Your device is connected properly, but your browser can't communicate with it at the moment.",
},
TR_TROUBLESHOOTING_UNREADABLE_UDEV: {
id: 'TR_TROUBLESHOOTING_UNREADABLE_UDEV',
Expand Down

0 comments on commit 9f73375

Please sign in to comment.