feat: Tweak unsupported Windows firmware update notification (#705)
* feat: Tweak unsupported Windows firmware update notification * feat: Display firmware update status * feat: throw error when left half not connected under firmware upgrade
This commit is contained in:
committed by
László Monda
parent
5e4fc983fb
commit
3d59bcf97e
@@ -59,8 +59,9 @@ export class UhkOperations {
|
|||||||
|
|
||||||
const leftModuleBricked = await this.waitForKbootIdle();
|
const leftModuleBricked = await this.waitForKbootIdle();
|
||||||
if (!leftModuleBricked) {
|
if (!leftModuleBricked) {
|
||||||
this.logService.error('[UhkOperations] Couldn\'t connect to the left keyboard half.');
|
const msg = '[UhkOperations] Couldn\'t connect to the left keyboard half.';
|
||||||
return;
|
this.logService.error(msg);
|
||||||
|
throw new Error(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.device.reenumerate(EnumerationModes.Buspal);
|
await this.device.reenumerate(EnumerationModes.Buspal);
|
||||||
|
|||||||
@@ -12,13 +12,10 @@
|
|||||||
Firmware {{ hardwareModules.rightModuleInfo.firmwareVersion }} is running on the right keyboard half.
|
Firmware {{ hardwareModules.rightModuleInfo.firmwareVersion }} is running on the right keyboard half.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p *ngIf="showUnsupportedOsToFirmwareUpgrade$ | async">Firmware update doesn't work on Windows 7, Windows Vista, and Windows XP. Use Windows 10, Windows 8, Linux, or OSX instead.</p>
|
<p *ngIf="runningOnNotSupportedWindows$ | async">Firmware update doesn't work on Windows 7, Windows Vista,
|
||||||
|
and Windows XP. Use Windows 10, Windows 8, Linux, or OSX instead.</p>
|
||||||
|
|
||||||
<p>If the update process fails, disconnect every USB device from your computer including USB hubs, KVM switches, and every USB device. Then connect only your UHK and retry.</p>
|
<p *ngIf="firmwareUpgradeAllowed$ | async">
|
||||||
|
|
||||||
<p>If you tried the above and the update still keeps failing, please <a class="link-github" (click)="openFirmwareGitHubIssuePage($event)">create a GitHub issue</a>, and attach the update log.</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<button class="btn btn-primary"
|
<button class="btn btn-primary"
|
||||||
[disabled]="flashFirmwareButtonDisbabled$ | async"
|
[disabled]="flashFirmwareButtonDisbabled$ | async"
|
||||||
(click)="onUpdateFirmware()">
|
(click)="onUpdateFirmware()">
|
||||||
@@ -29,9 +26,23 @@
|
|||||||
accept=".tar.bz2"
|
accept=".tar.bz2"
|
||||||
label="Choose firmware file and flash it"></file-upload>
|
label="Choose firmware file and flash it"></file-upload>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<div *ngIf="firmwareUpgradeFailed$ | async"
|
||||||
|
class="alert alert-danger"
|
||||||
|
role="alert">
|
||||||
|
<p>Firmware update failed. Disconnect every USB device from your computer (including USB hubs, KVM switches, USB dongles, and everything else), then only connect your UHK and retry.</p>
|
||||||
|
|
||||||
|
<p>If you tried the above and the update still keeps failing, please<a class="link-github" (click)="openFirmwareGitHubIssuePage($event)">create a GitHub issue</a>, and attach the update log.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="firmwareUpgradeSuccess$ | async"
|
||||||
|
class="alert alert-success"
|
||||||
|
role="alert">
|
||||||
|
<p>Firmware update succeeded.</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-grow">
|
<div class="flex-grow" *ngIf="firmwareUpgradeAllowed$ | async">
|
||||||
<xterm [logs]="xtermLog$ | async"></xterm>
|
<xterm [logs]="xtermLog$ | async"></xterm>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-footer">
|
<div class="flex-footer">
|
||||||
|
|||||||
@@ -7,10 +7,13 @@ import { Constants, HardwareModules, VersionInformation } from 'uhk-common';
|
|||||||
import { OpenUrlInNewWindowAction } from '../../../store/actions/app';
|
import { OpenUrlInNewWindowAction } from '../../../store/actions/app';
|
||||||
import {
|
import {
|
||||||
AppState,
|
AppState,
|
||||||
|
firmwareUpgradeAllowed,
|
||||||
|
firmwareUpgradeFailed,
|
||||||
|
firmwareUpgradeSuccess,
|
||||||
flashFirmwareButtonDisbabled,
|
flashFirmwareButtonDisbabled,
|
||||||
getAgentVersionInfo,
|
getAgentVersionInfo,
|
||||||
getHardwareModules,
|
getHardwareModules,
|
||||||
showUnsupportedOsToFirmwareUpgrade,
|
runningOnNotSupportedWindows,
|
||||||
xtermLog
|
xtermLog
|
||||||
} from '../../../store';
|
} from '../../../store';
|
||||||
import { UpdateFirmwareAction, UpdateFirmwareWithAction } from '../../../store/actions/device';
|
import { UpdateFirmwareAction, UpdateFirmwareWithAction } from '../../../store/actions/device';
|
||||||
@@ -31,7 +34,10 @@ export class DeviceFirmwareComponent implements OnDestroy {
|
|||||||
getAgentVersionInfo$: Observable<VersionInformation>;
|
getAgentVersionInfo$: Observable<VersionInformation>;
|
||||||
hardwareModulesSubscription: Subscription;
|
hardwareModulesSubscription: Subscription;
|
||||||
hardwareModules: HardwareModules;
|
hardwareModules: HardwareModules;
|
||||||
showUnsupportedOsToFirmwareUpgrade$: Observable<boolean>;
|
runningOnNotSupportedWindows$: Observable<boolean>;
|
||||||
|
firmwareUpgradeAllowed$: Observable<boolean>;
|
||||||
|
firmwareUpgradeFailed$: Observable<boolean>;
|
||||||
|
firmwareUpgradeSuccess$: Observable<boolean>;
|
||||||
|
|
||||||
constructor(private store: Store<AppState>) {
|
constructor(private store: Store<AppState>) {
|
||||||
this.flashFirmwareButtonDisbabled$ = store.select(flashFirmwareButtonDisbabled);
|
this.flashFirmwareButtonDisbabled$ = store.select(flashFirmwareButtonDisbabled);
|
||||||
@@ -40,7 +46,10 @@ export class DeviceFirmwareComponent implements OnDestroy {
|
|||||||
this.hardwareModulesSubscription = store.select(getHardwareModules).subscribe(data => {
|
this.hardwareModulesSubscription = store.select(getHardwareModules).subscribe(data => {
|
||||||
this.hardwareModules = data;
|
this.hardwareModules = data;
|
||||||
});
|
});
|
||||||
this.showUnsupportedOsToFirmwareUpgrade$ = store.select(showUnsupportedOsToFirmwareUpgrade);
|
this.runningOnNotSupportedWindows$ = store.select(runningOnNotSupportedWindows);
|
||||||
|
this.firmwareUpgradeAllowed$ = store.select(firmwareUpgradeAllowed);
|
||||||
|
this.firmwareUpgradeFailed$ = store.select(firmwareUpgradeFailed);
|
||||||
|
this.firmwareUpgradeSuccess$ = store.select(firmwareUpgradeSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ export const deviceConfigurationLoaded = createSelector(appState, fromApp.device
|
|||||||
export const getAgentVersionInfo = createSelector(appState, fromApp.getAgentVersionInfo);
|
export const getAgentVersionInfo = createSelector(appState, fromApp.getAgentVersionInfo);
|
||||||
export const getPrivilegePageState = createSelector(appState, fromApp.getPrivilagePageState);
|
export const getPrivilegePageState = createSelector(appState, fromApp.getPrivilagePageState);
|
||||||
export const runningOnNotSupportedWindows = createSelector(appState, fromApp.runningOnNotSupportedWindows);
|
export const runningOnNotSupportedWindows = createSelector(appState, fromApp.runningOnNotSupportedWindows);
|
||||||
|
export const firmwareUpgradeAllowed = createSelector(runningOnNotSupportedWindows, notSupportedOs => !notSupportedOs);
|
||||||
|
|
||||||
export const appUpdateState = (state: AppState) => state.appUpdate;
|
export const appUpdateState = (state: AppState) => state.appUpdate;
|
||||||
export const getShowAppUpdateAvailable = createSelector(appUpdateState, fromAppUpdate.getShowAppUpdateAvailable);
|
export const getShowAppUpdateAvailable = createSelector(appUpdateState, fromAppUpdate.getShowAppUpdateAvailable);
|
||||||
@@ -83,6 +84,7 @@ export const getBackupUserConfigurationState = createSelector(deviceState, fromD
|
|||||||
export const getRestoreUserConfiguration = createSelector(deviceState, fromDevice.getHasBackupUserConfiguration);
|
export const getRestoreUserConfiguration = createSelector(deviceState, fromDevice.getHasBackupUserConfiguration);
|
||||||
export const bootloaderActive = createSelector(deviceState, fromDevice.bootloaderActive);
|
export const bootloaderActive = createSelector(deviceState, fromDevice.bootloaderActive);
|
||||||
export const firmwareUpgradeFailed = createSelector(deviceState, fromDevice.firmwareUpgradeFailed);
|
export const firmwareUpgradeFailed = createSelector(deviceState, fromDevice.firmwareUpgradeFailed);
|
||||||
|
export const firmwareUpgradeSuccess = createSelector(deviceState, fromDevice.firmwareUpgradeSuccess);
|
||||||
|
|
||||||
export const getSideMenuPageState = createSelector(
|
export const getSideMenuPageState = createSelector(
|
||||||
showAddonMenu,
|
showAddonMenu,
|
||||||
@@ -108,9 +110,3 @@ export const getSideMenuPageState = createSelector(
|
|||||||
);
|
);
|
||||||
|
|
||||||
export const getRouterState = (state: AppState) => state.router;
|
export const getRouterState = (state: AppState) => state.router;
|
||||||
|
|
||||||
export const showUnsupportedOsToFirmwareUpgrade = createSelector(
|
|
||||||
runningOnNotSupportedWindows,
|
|
||||||
firmwareUpgradeFailed,
|
|
||||||
(isUnsupportedOs,
|
|
||||||
hasFirmwareUpgradeFailed) => isUnsupportedOs && hasFirmwareUpgradeFailed);
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export interface State {
|
|||||||
updatingFirmware: boolean;
|
updatingFirmware: boolean;
|
||||||
firmwareUpdateFinished: boolean;
|
firmwareUpdateFinished: boolean;
|
||||||
firmwareUpdateFailed?: boolean;
|
firmwareUpdateFailed?: boolean;
|
||||||
|
firmwareUpdateSuccess?: boolean;
|
||||||
modules: HardwareModules;
|
modules: HardwareModules;
|
||||||
log: Array<XtermLog>;
|
log: Array<XtermLog>;
|
||||||
restoringUserConfiguration: boolean;
|
restoringUserConfiguration: boolean;
|
||||||
@@ -129,6 +130,8 @@ export function reducer(state = initialState, action: Action): State {
|
|||||||
...state,
|
...state,
|
||||||
updatingFirmware: true,
|
updatingFirmware: true,
|
||||||
firmwareUpdateFinished: false,
|
firmwareUpdateFinished: false,
|
||||||
|
firmwareUpdateFailed: false,
|
||||||
|
firmwareUpdateSuccess: false,
|
||||||
log: [{message: 'Start flashing firmware', cssClass: XtermCssClass.standard}]
|
log: [{message: 'Start flashing firmware', cssClass: XtermCssClass.standard}]
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -137,7 +140,7 @@ export function reducer(state = initialState, action: Action): State {
|
|||||||
...state,
|
...state,
|
||||||
updatingFirmware: false,
|
updatingFirmware: false,
|
||||||
firmwareUpdateFinished: true,
|
firmwareUpdateFinished: true,
|
||||||
firmwareUpdateFailed: false,
|
firmwareUpdateSuccess: true,
|
||||||
modules: (action as UpdateFirmwareSuccessAction).payload
|
modules: (action as UpdateFirmwareSuccessAction).payload
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -232,3 +235,4 @@ export const getBackupUserConfigurationState = (state: State): RestoreConfigurat
|
|||||||
};
|
};
|
||||||
export const bootloaderActive = (state: State) => state.bootloaderActive;
|
export const bootloaderActive = (state: State) => state.bootloaderActive;
|
||||||
export const firmwareUpgradeFailed = (state: State) => state.firmwareUpdateFailed;
|
export const firmwareUpgradeFailed = (state: State) => state.firmwareUpdateFailed;
|
||||||
|
export const firmwareUpgradeSuccess = (state: State) => state.firmwareUpdateSuccess;
|
||||||
|
|||||||
Reference in New Issue
Block a user