Browse Source

Merge pull request #808 from valpinkman/feat/resume-firmare-update

firmware update + resume update from any step
master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
85472f9b82
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/commands/index.js
  2. 14
      src/commands/shouldFlashMcu.js
  3. 7
      src/components/GenuineCheck.js
  4. 4
      src/components/ManagerPage/Dashboard.js
  5. 86
      src/components/ManagerPage/FirmwareUpdate.js
  6. 2
      src/components/base/Progress/index.js
  7. 46
      src/components/modals/UpdateFirmware/index.js
  8. 89
      src/components/modals/UpdateFirmware/steps/01-step-install-full-firmware.js
  9. 58
      src/components/modals/UpdateFirmware/steps/02-step-flash-mcu.js
  10. 2
      src/components/modals/UpdateFirmware/steps/03-step-confirmation.js
  11. 4
      src/helpers/devices/getLatestFirmwareForDevice.js
  12. 4
      src/helpers/devices/getOsuFirmware.js
  13. 55
      src/helpers/devices/shouldFlashMcu.js
  14. 4
      src/helpers/firmware/getNextMCU.js
  15. 23
      src/helpers/firmware/installFinalFirmware.js
  16. 2
      src/helpers/firmware/installOsuFirmware.js
  17. 3
      static/i18n/en/app.yml

2
src/commands/index.js

@ -26,6 +26,7 @@ import listAppVersions from 'commands/listAppVersions'
import listCategories from 'commands/listCategories'
import listenDevices from 'commands/listenDevices'
import ping from 'commands/ping'
import shouldFlashMcu from 'commands/shouldFlashMcu'
import signTransaction from 'commands/signTransaction'
import testApdu from 'commands/testApdu'
import testCrash from 'commands/testCrash'
@ -56,6 +57,7 @@ const all: Array<Command<any, any>> = [
listCategories,
listenDevices,
ping,
shouldFlashMcu,
signTransaction,
testApdu,
testCrash,

14
src/commands/shouldFlashMcu.js

@ -0,0 +1,14 @@
// @flow
import { createCommand, Command } from 'helpers/ipc'
import { fromPromise } from 'rxjs/observable/fromPromise'
import type { DeviceInfo } from 'helpers/devices/getDeviceInfo'
import shouldFlashMcu from 'helpers/devices/shouldFlashMcu'
type Result = boolean
const cmd: Command<DeviceInfo, Result> = createCommand('shouldFlashMcu', data =>
fromPromise(shouldFlashMcu(data)),
)
export default cmd

7
src/components/GenuineCheck.js

@ -30,9 +30,9 @@ const DeviceNotGenuineError = createCustomErrorClass('DeviceNotGenuine')
type Props = {
t: T,
onSuccess: void => void,
onFail?: Error => void,
onUnavailable?: Error => void,
onSuccess: (*) => void,
device: ?Device,
}
@ -72,6 +72,11 @@ class GenuineCheck extends PureComponent<Props> {
device: Device,
deviceInfo: DeviceInfo,
}) => {
if (deviceInfo.isOSU || deviceInfo.isBootloader) {
logger.log('device is in update mode. skipping genuine')
return true
}
if (genuineDevices.has(device)) {
logger.log("genuine was already checked. don't check again")
await delay(GENUINE_CACHE_DELAY)

4
src/components/ManagerPage/Dashboard.js

@ -33,7 +33,9 @@ const Dashboard = ({ device, deviceInfo, t }: Props) => (
<FirmwareUpdate deviceInfo={deviceInfo} device={device} />
</Box>
<Box mt={5}>
<AppsList device={device} deviceInfo={deviceInfo} />
{deviceInfo.isOSU || deviceInfo.isBootloader ? null : (
<AppsList device={device} deviceInfo={deviceInfo} />
)}
</Box>
</Box>
)

86
src/components/ManagerPage/FirmwareUpdate.js

@ -6,13 +6,14 @@ import { translate } from 'react-i18next'
import isEqual from 'lodash/isEqual'
import isEmpty from 'lodash/isEmpty'
import invariant from 'invariant'
import logger from 'logger'
import type { Device, T } from 'types/common'
import type { LedgerScriptParams } from 'helpers/common'
import type { StepId } from 'components/modals/UpdateFirmware'
import getLatestFirmwareForDevice from 'commands/getLatestFirmwareForDevice'
import shouldFlashMcu from 'commands/shouldFlashMcu'
import installOsuFirmware from 'commands/installOsuFirmware'
import installFinalFirmware from 'commands/installFinalFirmware'
import installMcu from 'commands/installMcu'
@ -40,23 +41,32 @@ type Props = {
}
type State = {
latestFirmware: ?LedgerScriptParams & ?{ shouldUpdateMcu: boolean },
latestFirmware: ?LedgerScriptParams & ?{ shouldFlashMcu: boolean },
modal: ModalStatus,
stepId: ?StepId,
shouldFlash: boolean,
ready: boolean,
}
const intializeState = ({ deviceInfo }): State => ({
latestFirmware: null,
modal: 'closed',
stepId: deviceInfo.isBootloader ? 'updateMCU' : 'idCheck',
shouldFlash: false,
ready: false,
})
class FirmwareUpdate extends PureComponent<Props, State> {
state = {
latestFirmware: null,
modal: 'closed',
}
state = intializeState(this.props)
componentDidMount() {
this.fetchLatestFirmware()
}
componentDidUpdate() {
if (isEmpty(this.state.latestFirmware)) {
const { deviceInfo } = this.props
if (!deviceInfo.isOSU && !deviceInfo.isBootloader) {
this.fetchLatestFirmware()
} else if (deviceInfo.isOSU) {
this.shouldFlashMcu()
} else if (deviceInfo.isBootloader) {
this.handleInstallModal('updateMCU', true)
}
}
@ -74,35 +84,33 @@ class FirmwareUpdate extends PureComponent<Props, State> {
!isEqual(this.state.latestFirmware, latestFirmware) &&
!this._unmounting
) {
this.setState({ latestFirmware })
this.setState({ latestFirmware, ready: true })
}
}
installOsuFirmware = async (device: Device) => {
try {
const { latestFirmware } = this.state
const { deviceInfo } = this.props
invariant(latestFirmware, 'did not find a new firmware or firmware is not set')
this.setState({ modal: 'install' })
const { success } = await installOsuFirmware
.send({ devicePath: device.path, firmware: latestFirmware, targetId: deviceInfo.targetId })
.toPromise()
return success
} catch (err) {
logger.log(err)
throw err
shouldFlashMcu = async () => {
const { deviceInfo } = this.props
const shouldFlash = await shouldFlashMcu.send(deviceInfo).toPromise()
if (!this._unmounting) {
this.setState({ shouldFlash, modal: 'install', stepId: 'idCheck', ready: true })
}
}
installOsuFirmware = async (device: Device) => {
const { latestFirmware } = this.state
const { deviceInfo } = this.props
invariant(latestFirmware, 'did not find a new firmware or firmware is not set')
this.setState({ modal: 'install' })
const { success } = await installOsuFirmware
.send({ devicePath: device.path, firmware: latestFirmware, targetId: deviceInfo.targetId })
.toPromise()
return success
}
installFinalFirmware = async (device: Device) => {
try {
const { success } = await installFinalFirmware.send({ devicePath: device.path }).toPromise()
return success
} catch (err) {
logger.log(err)
throw err
}
const { success } = await installFinalFirmware.send({ devicePath: device.path }).toPromise()
return success
}
flashMCU = async (device: Device) => {
@ -112,11 +120,13 @@ class FirmwareUpdate extends PureComponent<Props, State> {
handleCloseModal = () => this.setState({ modal: 'closed' })
handleDisclaimerModal = () => this.setState({ modal: 'disclaimer' })
handleInstallModal = () => this.setState({ modal: 'install' })
handleInstallModal = (stepId: StepId = 'idCheck', shouldFlash?: boolean) =>
this.setState({ modal: 'install', stepId, shouldFlash, ready: true })
render() {
const { deviceInfo, t } = this.props
const { latestFirmware, modal } = this.state
const { latestFirmware, modal, stepId, shouldFlash, ready } = this.state
return (
<Card p={4}>
<Box horizontal align="center" flow={2}>
@ -142,7 +152,7 @@ class FirmwareUpdate extends PureComponent<Props, State> {
</Box>
<UpdateFirmwareButton firmware={latestFirmware} onClick={this.handleDisclaimerModal} />
</Box>
{latestFirmware && (
{ready ? (
<Fragment>
<DisclaimerModal
firmware={latestFirmware}
@ -152,14 +162,16 @@ class FirmwareUpdate extends PureComponent<Props, State> {
/>
<UpdateModal
status={modal}
stepId={stepId}
onClose={this.handleCloseModal}
firmware={latestFirmware}
shouldFlashMcu={shouldFlash}
installOsuFirmware={this.installOsuFirmware}
installFinalFirmware={this.installFinalFirmware}
flashMCU={this.flashMCU}
/>
</Fragment>
)}
) : null}
</Card>
)
}

2
src/components/base/Progress/index.js

@ -71,7 +71,7 @@ type State = {}
class Progress extends Component<Props, State> {
static defaultProps = {
infinite: false,
timing: 3000,
timing: 2500,
color: 'wallet',
}

46
src/components/modals/UpdateFirmware/index.js

@ -16,19 +16,7 @@ import StepFullFirmwareInstall from './steps/01-step-install-full-firmware'
import StepFlashMcu from './steps/02-step-flash-mcu'
import StepConfirmation, { StepConfirmFooter } from './steps/03-step-confirmation'
export type Firmware = LedgerScriptParams & { shouldUpdateMcu: boolean }
export type StepProps = DefaultStepProps & {
firmware: Firmware,
onCloseModal: () => void,
installOsuFirmware: (device: Device) => void,
installFinalFirmware: (device: Device) => void,
flashMCU: (device: Device) => void,
}
type StepId = 'idCheck' | 'updateMCU' | 'finish'
const createSteps = ({ t, firmware }: { t: T, firmware: Firmware }): Array<*> => {
const createSteps = ({ t, shouldFlashMcu }: { t: T, shouldFlashMcu: boolean }): Array<*> => {
const updateStep = {
id: 'idCheck',
label: t('app:manager.modal.steps.idCheck'),
@ -58,7 +46,7 @@ const createSteps = ({ t, firmware }: { t: T, firmware: Firmware }): Array<*> =>
const steps = [updateStep]
if (firmware.shouldUpdateMcu) {
if (shouldFlashMcu) {
steps.push(mcuStep)
}
@ -67,11 +55,25 @@ const createSteps = ({ t, firmware }: { t: T, firmware: Firmware }): Array<*> =>
return steps
}
export type Firmware = LedgerScriptParams & { shouldFlashMcu: boolean }
export type StepProps = DefaultStepProps & {
firmware: Firmware,
onCloseModal: () => void,
installOsuFirmware: (device: Device) => void,
installFinalFirmware: (device: Device) => void,
flashMCU: (device: Device) => void,
shouldFlashMcu: boolean,
}
export type StepId = 'idCheck' | 'updateMCU' | 'finish'
type Props = {
t: T,
status: ModalStatus,
onClose: () => void,
firmware: Firmware,
shouldFlashMcu: boolean,
installOsuFirmware: (device: Device) => void,
installFinalFirmware: (device: Device) => void,
flashMCU: (device: Device) => void,
@ -83,15 +85,16 @@ type State = {
}
class UpdateModal extends PureComponent<Props, State> {
static defaultProps = {
stepId: 'idCheck',
}
state = {
stepId: this.props.stepId,
}
STEPS = createSteps({ t: this.props.t, firmware: this.props.firmware })
STEPS = createSteps({
t: this.props.t,
shouldFlashMcu: this.props.firmware
? this.props.firmware.shouldFlashMcu
: this.props.shouldFlashMcu,
})
handleStepChange = (step: Step) => this.setState({ stepId: step.id })
@ -110,11 +113,12 @@ class UpdateModal extends PureComponent<Props, State> {
onClose={onClose}
isOpened={status === 'install'}
refocusWhenChange={stepId}
preventBackdropClick={false}
preventBackdropClick={stepId !== 'finish'}
render={() => (
<Stepper
onStepChange={this.handleStepChange}
title={t('app:manager.firmware.update')}
initialStepId="idCheck"
initialStepId={stepId}
steps={this.STEPS}
{...additionalProps}
>

89
src/components/modals/UpdateFirmware/steps/01-step-install-full-firmware.js

@ -9,7 +9,7 @@ import { DEVICE_INFOS_TIMEOUT } from 'config/constants'
import getDeviceInfo from 'commands/getDeviceInfo'
import { getCurrentDevice } from 'reducers/devices'
import { createCancelablePolling } from 'helpers/promise'
import { createCancelablePolling, delay } from 'helpers/promise'
import Box from 'components/base/Box'
import Text from 'components/base/Text'
@ -46,13 +46,7 @@ const Address = styled(Box).attrs({
cursor: text;
user-select: text;
width: 325px;
`
const Ellipsis = styled.span`
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
text-align: center;
`
type Props = StepProps & {
@ -69,7 +63,7 @@ class StepFullFirmwareInstall extends PureComponent<Props, State> {
}
componentDidMount() {
this.install()
// this.install()
}
componentWillUnmount() {
@ -94,55 +88,66 @@ class StepFullFirmwareInstall extends PureComponent<Props, State> {
}
install = async () => {
const { installOsuFirmware, installFinalFirmware } = this.props
const {
installOsuFirmware,
installFinalFirmware,
firmware,
shouldFlashMcu,
transitionTo,
} = this.props
const { device, deviceInfo } = await this.ensureDevice()
// When device is connected, if in OSU, install Final Firmware
if (deviceInfo.isOSU) {
this.setState({ installing: true })
const finalSuccess = await installFinalFirmware(device)
if (finalSuccess) this.transitionTo()
}
const success = await installOsuFirmware(device)
if (success) {
await installFinalFirmware(device)
transitionTo('finish')
} else {
await installOsuFirmware(device)
this.setState({ installing: true })
if (this._unsubConnect) this._unsubConnect()
const { device: cleanDevice } = await this.ensureDevice()
const finalSuccess = await installFinalFirmware(cleanDevice)
if (finalSuccess) {
this.transitionTo()
if ((firmware && firmware.shouldFlashMcu) || shouldFlashMcu) {
delay(1000)
transitionTo('updateMCU')
} else {
const { device: freshDevice } = await this.ensureDevice()
await installFinalFirmware(freshDevice)
transitionTo('finish')
}
}
}
transitionTo = () => {
const { firmware, transitionTo } = this.props
if (firmware.shouldUpdateMcu) {
transitionTo('updateMCU')
} else {
transitionTo('finish')
formatHashName = (hash: string): string[] => {
if (!hash) {
return []
}
const length = hash.length
const half = Math.ceil(length / 2)
const start = hash.slice(0, half)
const end = hash.slice(half)
return [start, end]
}
renderBody = () => {
const { installing } = this.state
const { firmware, t } = this.props
const { t, firmware } = this.props
if (installing) {
return (
<Box mx={7}>
<Progress infinite style={{ width: '100%' }} />
</Box>
)
}
return (
return installing ? (
<Box mx={7} mt={5} style={{ width: '100%' }}>
<Progress infinite />
</Box>
) : (
<Fragment>
<Text ff="Open Sans|Regular" align="center" color="smoke">
{t('app:manager.modal.confirmIdentifierText')}
</Text>
<Box mx={7} mt={5}>
<Text ff="Open Sans|SemiBold" align="center" color="smoke">
{t('app:manager.modal.identifier')}
</Text>
<Address>
<Ellipsis>{firmware && firmware.hash}</Ellipsis>
{firmware && firmware.hash && this.formatHashName(firmware.hash).join('\n')}
</Address>
</Box>
<Box mt={5}>
@ -155,13 +160,15 @@ class StepFullFirmwareInstall extends PureComponent<Props, State> {
_unsubConnect: *
render() {
const { installing } = this.state
const { t } = this.props
return (
<Container>
<Title>{t('app:manager.modal.confirmIdentifier')}</Title>
<Text ff="Open Sans|Regular" align="center" color="smoke">
{t('app:manager.modal.confirmIdentifierText')}
</Text>
<Title>
{installing
? t('app:manager.modal.installing')
: t('app:manager.modal.confirmIdentifier')}
</Title>
{this.renderBody()}
</Container>
)

58
src/components/modals/UpdateFirmware/steps/02-step-flash-mcu.js

@ -60,7 +60,7 @@ class StepFlashMcu extends PureComponent<Props, State> {
}
componentDidMount() {
this.install()
// this.install()
}
componentWillUnmount() {
@ -68,7 +68,7 @@ class StepFlashMcu extends PureComponent<Props, State> {
if (this._unsubDeviceInfo) this._unsubDeviceInfo()
}
waitForDeviceInBootloader = () => {
getDeviceInfo = () => {
const { unsubscribe, promise } = createCancelablePolling(async () => {
const { device } = this.props
if (!device) {
@ -78,16 +78,14 @@ class StepFlashMcu extends PureComponent<Props, State> {
.send({ devicePath: device.path })
.pipe(timeout(DEVICE_INFOS_TIMEOUT))
.toPromise()
if (!deviceInfo.isBootloader) {
throw new Error('Device is not in bootloader')
}
return { device, deviceInfo }
})
this._unsubConnect = unsubscribe
this._unsubDeviceInfo = unsubscribe
return promise
}
getDeviceInfo = () => {
waitForDeviceInBootloader = () => {
const { unsubscribe, promise } = createCancelablePolling(async () => {
const { device } = this.props
if (!device) {
@ -97,9 +95,13 @@ class StepFlashMcu extends PureComponent<Props, State> {
.send({ devicePath: device.path })
.pipe(timeout(DEVICE_INFOS_TIMEOUT))
.toPromise()
if (!deviceInfo.isBootloader) {
throw new Error('Device is not in bootloader')
}
return { device, deviceInfo }
})
this._unsubDeviceInfo = unsubscribe
this._unsubConnect = unsubscribe
return promise
}
@ -113,29 +115,38 @@ class StepFlashMcu extends PureComponent<Props, State> {
}
install = async () => {
const { transitionTo } = this.props
this.flash()
const deviceInfo = await this.getDeviceInfo()
const { transitionTo, installFinalFirmware } = this.props
const { deviceInfo, device } = await this.getDeviceInfo()
if (deviceInfo.isBootloader) {
this.flash()
} else {
await this.flash()
this.install()
} else if (deviceInfo.isOSU) {
await installFinalFirmware(device)
transitionTo('finish')
}
}
firstFlash = async () => {
await this.flash()
this.install()
}
renderBody = () => {
const { installing } = this.state
const { t } = this.props
if (installing) {
return (
<Box mx={7}>
<Progress infinite style={{ width: '100%' }} />
return installing ? (
<Fragment>
<Box mx={7} style={{ width: '100%' }}>
<Progress infinite />
</Box>
)
}
return (
<Box mx={7} mt={4}>
<Text ff="Open Sans|Regular" align="center" color="smoke">
{t('app:manager.modal.mcuPin')}
</Text>
</Box>
</Fragment>
) : (
<Fragment>
<Box mx={7}>
<Text ff="Open Sans|Regular" align="center" color="smoke">
@ -169,9 +180,12 @@ class StepFlashMcu extends PureComponent<Props, State> {
render() {
const { t } = this.props
const { installing } = this.state
return (
<Container>
<Title>{t('app:manager.modal.mcuTitle')}</Title>
<Title>
{installing ? t('app:manager.modal.flashing') : t('app:manager.modal.mcuTitle')}
</Title>
{this.renderBody()}
</Container>
)

2
src/components/modals/UpdateFirmware/steps/03-step-confirmation.js

@ -31,7 +31,7 @@ function StepConfirmation({ t }: StepProps) {
<CheckCircle size={44} />
</Box>
<Title>{t('app:manager.modal.successTitle')}</Title>
<Box mt={2} mb={8}>
<Box mt={2} mb={5}>
<Text ff="Open Sans|Regular" fontSize={4} color="graphite">
{t('app:manager.modal.successText')}
</Text>

4
src/helpers/devices/getLatestFirmwareForDevice.js

@ -49,11 +49,11 @@ export default async (deviceInfo: DeviceInfo) => {
if (!seFirmwareFinalVersion.mcu_versions.includes(...currentMcuVersionId)) {
return {
...se_firmware_osu_version,
shouldUpdateMcu: true,
shouldFlashMcu: true,
}
}
return { ...se_firmware_osu_version, shouldUpdateMcu: false }
return { ...se_firmware_osu_version, shouldFlashMcu: false }
} catch (err) {
const error = Error(err.message)
error.stack = err.stack

4
src/helpers/devices/getOsuFirmware.js

@ -6,17 +6,17 @@ import { GET_CURRENT_OSU } from 'helpers/urls'
type Input = {
version: string,
deviceId: string | number,
provider: number,
}
export default async (input: Input): Promise<*> => {
const provider = 1
const { data } = await network({
method: 'POST',
url: GET_CURRENT_OSU,
data: {
device_version: input.deviceId,
version_name: `${input.version}-osu`,
provider,
provider: input.provider,
},
})
return data

55
src/helpers/devices/shouldFlashMcu.js

@ -0,0 +1,55 @@
// @flow
import network from 'api/network'
import { GET_LATEST_FIRMWARE } from 'helpers/urls'
import type { DeviceInfo } from 'helpers/devices/getDeviceInfo'
import getFinalFirmwareById from 'helpers/firmware/getFinalFirmwareById'
import getMcus from 'helpers/firmware/getMcus'
import getOsuFirmware from './getOsuFirmware'
import getDeviceVersion from './getDeviceVersion'
export default async (deviceInfo: DeviceInfo): Promise<boolean> => {
try {
// Get device infos from targetId
const deviceVersion = await getDeviceVersion(deviceInfo.targetId, deviceInfo.providerId)
// Get firmware infos with firmware name and device version
const seFirmwareVersion = await getOsuFirmware({
version: deviceInfo.fullVersion,
deviceId: deviceVersion.id,
provider: deviceInfo.providerId,
})
// Fetch next possible firmware
const { data } = await network({
method: 'POST',
url: GET_LATEST_FIRMWARE,
data: {
current_se_firmware_final_version: seFirmwareVersion.id,
device_version: deviceVersion.id,
provider: deviceInfo.providerId,
},
})
if (data.result === 'null') {
return false
}
const { se_firmware_osu_version } = data
const { next_se_firmware_final_version } = se_firmware_osu_version
const seFirmwareFinalVersion = await getFinalFirmwareById(next_se_firmware_final_version)
const mcus = await getMcus()
const currentMcuVersionId = mcus
.filter(mcu => mcu.name === deviceInfo.mcuVersion)
.map(mcu => mcu.id)
return !seFirmwareFinalVersion.mcu_versions.includes(...currentMcuVersionId)
} catch (err) {
const error = Error(err.message)
error.stack = err.stack
throw error
}
}

4
src/helpers/firmware/getNextMCU.js

@ -16,8 +16,8 @@ export default async (bootloaderVersion: string): Promise<*> => {
},
})
// FIXME: nextVersion will not be able to "default" when Error
// handling is standardize on the API side
// FIXME: nextVersion will not be able to "default" when
// Error handling is standardize on the API side
if (data === 'default' || !data.name) {
throw new LatestMCUInstalledError('there is no next mcu version to install')
}

23
src/helpers/firmware/installFinalFirmware.js

@ -4,18 +4,37 @@ import type { DeviceInfo } from 'helpers/devices/getDeviceInfo'
import { WS_INSTALL } from 'helpers/urls'
import { createDeviceSocket } from 'helpers/socket'
import { createCustomErrorClass } from 'helpers/errors'
import getDeviceVersion from 'helpers/devices/getDeviceVersion'
import getOsuFirmware from 'helpers/devices/getOsuFirmware'
import getDeviceInfo from 'helpers/devices/getDeviceInfo'
import getFinalFirmwareById from './getFinalFirmwareById'
const ManagerUnexpectedError = createCustomErrorClass('ManagerUnexpected')
const ManagerDeviceLockedError = createCustomErrorClass('ManagerDeviceLocked')
function remapSocketError(promise) {
return promise.catch((e: Error) => {
switch (true) {
case e.message.endsWith('6982'):
throw new ManagerDeviceLockedError()
default:
throw new ManagerUnexpectedError(e.message, { msg: e.message })
}
})
}
type Result = Promise<{ success: boolean, error?: string }>
export default async (transport: Transport<*>): Result => {
try {
const deviceInfo: DeviceInfo = await getDeviceInfo(transport)
const device = await getDeviceVersion(deviceInfo.targetId, deviceInfo.providerId)
const firmware = await getOsuFirmware({ deviceId: device.id, version: deviceInfo.fullVersion })
const firmware = await getOsuFirmware({
deviceId: device.id,
version: deviceInfo.fullVersion,
provider: deviceInfo.providerId,
})
const { next_se_firmware_final_version } = firmware
const nextFirmware = await getFinalFirmwareById(next_se_firmware_final_version)
@ -26,7 +45,7 @@ export default async (transport: Transport<*>): Result => {
}
const url = WS_INSTALL(params)
await createDeviceSocket(transport, url).toPromise()
await remapSocketError(createDeviceSocket(transport, url).toPromise())
return { success: true }
} catch (error) {
const result = { success: false, error }

2
src/helpers/firmware/installOsuFirmware.js

@ -38,7 +38,7 @@ export default async (
...firmware,
firmwareKey: firmware.firmware_key,
}
delete params.shouldUpdateMcu
delete params.shouldFlashMcu
const url = WS_INSTALL(params)
await remapError(createDeviceSocket(transport, url).toPromise())
return { success: true }

3
static/i18n/en/app.yml

@ -226,12 +226,15 @@ manager:
idCheck: Identifier check
updateMCU: Update MCU
confirm: Confirmation
installing: Installing firmware
flashing: Installing MCU
confirmIdentifier: Confirm identifier
confirmIdentifierText: Please confirm identifier on your Device. Be sure the identifier is the same as below
identifier: Identifier
mcuTitle: Updating MCU
mcuFirst: Unplug your device from your computer
mcuSecond: Press and hold left button and plug your device until the processing screen appears
mcuPin: If asked on device, please enter your pin code to finish the process
successTitle: Firmware has been updated with success
successText: You can now re-install your applications on your device
title: Manager

Loading…
Cancel
Save