diff --git a/packages/uhk-agent/src/services/app.service.ts b/packages/uhk-agent/src/services/app.service.ts
index 9fbfb154..348d1089 100644
--- a/packages/uhk-agent/src/services/app.service.ts
+++ b/packages/uhk-agent/src/services/app.service.ts
@@ -1,5 +1,6 @@
import { ipcMain, shell } from 'electron';
import { UhkHidDevice } from 'uhk-usb';
+import * as os from 'os';
import { AppStartInfo, IpcEvents, LogService } from 'uhk-common';
import { MainServiceBase } from './main-service-base';
@@ -30,7 +31,9 @@ export class AppService extends MainServiceBase {
},
deviceConnected: deviceConnectionState.connected,
hasPermission: deviceConnectionState.hasPermission,
- bootloaderActive: deviceConnectionState.bootloaderActive
+ bootloaderActive: deviceConnectionState.bootloaderActive,
+ platform: process.platform as string,
+ osVersion: os.release()
};
this.logService.info('[AppService] getAppStartInfo response:', response);
return event.sender.send(IpcEvents.app.getAppStartInfoReply, response);
diff --git a/packages/uhk-common/src/models/app-start-info.ts b/packages/uhk-common/src/models/app-start-info.ts
index 1c72c088..52390019 100644
--- a/packages/uhk-common/src/models/app-start-info.ts
+++ b/packages/uhk-common/src/models/app-start-info.ts
@@ -5,4 +5,6 @@ export interface AppStartInfo {
deviceConnected: boolean;
hasPermission: boolean;
bootloaderActive: boolean;
+ platform: string;
+ osVersion: string;
}
diff --git a/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.html b/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.html
index 0f7bad82..9a3911b5 100644
--- a/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.html
+++ b/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.html
@@ -12,7 +12,7 @@
Firmware {{ hardwareModules.rightModuleInfo.firmwareVersion }} is running on the right keyboard half.
- Please note that firmware update doesn't work on Windows 7, Windows Vista, and Windows XP. Use Windows 10, Windows 8, Linux, or OSX instead.
+ Firmware update doesn't work on Windows 7, Windows Vista, and Windows XP. Use Windows 10, Windows 8, Linux, or OSX instead.
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.
diff --git a/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.ts b/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.ts
index 7e8812e0..0b908a73 100644
--- a/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.ts
+++ b/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.ts
@@ -2,15 +2,15 @@ import { Component, OnDestroy } from '@angular/core';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
-import { HardwareModules, VersionInformation } from 'uhk-common';
-import { Constants } from 'uhk-common';
-import { OpenUrlInNewWindowAction } from '../../../store/actions/app';
+import { Constants, HardwareModules, VersionInformation } from 'uhk-common';
+import { OpenUrlInNewWindowAction } from '../../../store/actions/app';
import {
AppState,
flashFirmwareButtonDisbabled,
getAgentVersionInfo,
getHardwareModules,
+ showUnsupportedOsToFirmwareUpgrade,
xtermLog
} from '../../../store';
import { UpdateFirmwareAction, UpdateFirmwareWithAction } from '../../../store/actions/device';
@@ -31,6 +31,7 @@ export class DeviceFirmwareComponent implements OnDestroy {
getAgentVersionInfo$: Observable;
hardwareModulesSubscription: Subscription;
hardwareModules: HardwareModules;
+ showUnsupportedOsToFirmwareUpgrade$: Observable;
constructor(private store: Store) {
this.flashFirmwareButtonDisbabled$ = store.select(flashFirmwareButtonDisbabled);
@@ -39,6 +40,7 @@ export class DeviceFirmwareComponent implements OnDestroy {
this.hardwareModulesSubscription = store.select(getHardwareModules).subscribe(data => {
this.hardwareModules = data;
});
+ this.showUnsupportedOsToFirmwareUpgrade$ = store.select(showUnsupportedOsToFirmwareUpgrade);
}
ngOnDestroy(): void {
diff --git a/packages/uhk-web/src/app/store/actions/app.ts b/packages/uhk-web/src/app/store/actions/app.ts
index 51553991..0a55bbc4 100644
--- a/packages/uhk-web/src/app/store/actions/app.ts
+++ b/packages/uhk-web/src/app/store/actions/app.ts
@@ -1,6 +1,6 @@
import { Action } from '@ngrx/store';
-import { AppStartInfo, CommandLineArgs, HardwareConfiguration, Notification, type } from 'uhk-common';
+import { AppStartInfo, HardwareConfiguration, Notification, type } from 'uhk-common';
import { ElectronLogEntry } from '../../models/xterm-log';
const PREFIX = '[app] ';
@@ -10,7 +10,7 @@ export const ActionTypes = {
APP_BOOTSRAPPED: type(PREFIX + 'bootstrapped'),
APP_STARTED: type(PREFIX + 'started'),
APP_SHOW_NOTIFICATION: type(PREFIX + 'show notification'),
- APPLY_COMMAND_LINE_ARGS: type(PREFIX + 'apply command line args'),
+ APPLY_APP_START_INFO: type(PREFIX + 'apply command line args'),
APP_PROCESS_START_INFO: type(PREFIX + 'process start info'),
UNDO_LAST: type(PREFIX + 'undo last action'),
UNDO_LAST_SUCCESS: type(PREFIX + 'undo last action success'),
@@ -38,10 +38,10 @@ export class ShowNotificationAction implements Action {
}
}
-export class ApplyCommandLineArgsAction implements Action {
- type = ActionTypes.APPLY_COMMAND_LINE_ARGS;
+export class ApplyAppStartInfoAction implements Action {
+ type = ActionTypes.APPLY_APP_START_INFO;
- constructor(public payload: CommandLineArgs) {
+ constructor(public payload: AppStartInfo) {
}
}
@@ -107,7 +107,7 @@ export type Actions
= AppStartedAction
| AppBootsrappedAction
| ShowNotificationAction
- | ApplyCommandLineArgsAction
+ | ApplyAppStartInfoAction
| ProcessAppStartInfoAction
| UndoLastAction
| UndoLastSuccessAction
diff --git a/packages/uhk-web/src/app/store/effects/app.ts b/packages/uhk-web/src/app/store/effects/app.ts
index 0a2960c3..32979ac3 100644
--- a/packages/uhk-web/src/app/store/effects/app.ts
+++ b/packages/uhk-web/src/app/store/effects/app.ts
@@ -13,7 +13,7 @@ import 'rxjs/add/operator/catch';
import { AppStartInfo, LogService, Notification, NotificationType } from 'uhk-common';
import {
ActionTypes,
- ApplyCommandLineArgsAction,
+ ApplyAppStartInfoAction,
AppStartedAction,
DismissUndoNotificationAction,
OpenUrlInNewWindowAction,
@@ -65,7 +65,7 @@ export class ApplicationEffects {
.mergeMap((appInfo: AppStartInfo) => {
this.logService.debug('[AppEffect][processStartInfo] payload:', appInfo);
return [
- new ApplyCommandLineArgsAction(appInfo.commandLineArgs),
+ new ApplyAppStartInfoAction(appInfo),
new ConnectionStateChangedAction({
connected: appInfo.deviceConnected,
hasPermission: appInfo.hasPermission,
diff --git a/packages/uhk-web/src/app/store/index.ts b/packages/uhk-web/src/app/store/index.ts
index 1bb18be1..f1b381d1 100644
--- a/packages/uhk-web/src/app/store/index.ts
+++ b/packages/uhk-web/src/app/store/index.ts
@@ -52,6 +52,7 @@ export const getKeyboardLayout = createSelector(appState, fromApp.getKeyboardLay
export const deviceConfigurationLoaded = createSelector(appState, fromApp.deviceConfigurationLoaded);
export const getAgentVersionInfo = createSelector(appState, fromApp.getAgentVersionInfo);
export const getPrivilegePageState = createSelector(appState, fromApp.getPrivilagePageState);
+export const runningOnNotSupportedWindows = createSelector(appState, fromApp.runningOnNotSupportedWindows);
export const appUpdateState = (state: AppState) => state.appUpdate;
export const getShowAppUpdateAvailable = createSelector(appUpdateState, fromAppUpdate.getShowAppUpdateAvailable);
@@ -81,6 +82,7 @@ export const getHardwareModules = createSelector(deviceState, fromDevice.getHard
export const getBackupUserConfigurationState = createSelector(deviceState, fromDevice.getBackupUserConfigurationState);
export const getRestoreUserConfiguration = createSelector(deviceState, fromDevice.getHasBackupUserConfiguration);
export const bootloaderActive = createSelector(deviceState, fromDevice.bootloaderActive);
+export const firmwareUpgradeFailed = createSelector(deviceState, fromDevice.firmwareUpgradeFailed);
export const getSideMenuPageState = createSelector(
showAddonMenu,
@@ -106,3 +108,9 @@ export const getSideMenuPageState = createSelector(
);
export const getRouterState = (state: AppState) => state.router;
+
+export const showUnsupportedOsToFirmwareUpgrade = createSelector(
+ runningOnNotSupportedWindows,
+ firmwareUpgradeFailed,
+ (isUnsupportedOs,
+ hasFirmwareUpgradeFailed) => isUnsupportedOs && hasFirmwareUpgradeFailed);
diff --git a/packages/uhk-web/src/app/store/reducers/app.reducer.ts b/packages/uhk-web/src/app/store/reducers/app.reducer.ts
index 3793dfe6..61aaa6eb 100644
--- a/packages/uhk-web/src/app/store/reducers/app.reducer.ts
+++ b/packages/uhk-web/src/app/store/reducers/app.reducer.ts
@@ -1,6 +1,7 @@
import { ROUTER_NAVIGATION } from '@ngrx/router-store';
import { Action } from '@ngrx/store';
import {
+ AppStartInfo,
CommandLineArgs,
HardwareConfiguration,
Notification,
@@ -29,6 +30,8 @@ export interface State {
agentVersionInfo?: VersionInformation;
privilegeWhatWillThisDoClicked: boolean;
permissionError?: any;
+ platform?: string;
+ osVersion?: string;
}
export const initialState: State = {
@@ -50,10 +53,14 @@ export function reducer(state = initialState, action: Action & { payload: any })
};
}
- case ActionTypes.APPLY_COMMAND_LINE_ARGS: {
+ case ActionTypes.APPLY_APP_START_INFO: {
+ const payload = action.payload as AppStartInfo;
+
return {
...state,
- commandLineArgs: action.payload
+ commandLineArgs: payload.commandLineArgs,
+ platform: payload.platform,
+ osVersion: payload.osVersion
};
}
@@ -172,3 +179,15 @@ export const getPrivilagePageState = (state: State): PrivilagePageSate => {
showWhatWillThisDoContent: state.privilegeWhatWillThisDoClicked || permissionSetupFailed
};
};
+
+export const runningOnNotSupportedWindows = (state: State): boolean => {
+ if (!state.osVersion || state.platform !== 'win32') {
+ return false;
+ }
+
+ const version = state.osVersion.split('.');
+ const osMajor = +version[0];
+ const osMinor = +version[1];
+
+ return osMajor < 6 || (osMajor === 6 && osMinor < 2);
+};
diff --git a/packages/uhk-web/src/app/store/reducers/device.ts b/packages/uhk-web/src/app/store/reducers/device.ts
index 7981c882..08860fa3 100644
--- a/packages/uhk-web/src/app/store/reducers/device.ts
+++ b/packages/uhk-web/src/app/store/reducers/device.ts
@@ -23,6 +23,7 @@ export interface State {
savingToKeyboard: boolean;
updatingFirmware: boolean;
firmwareUpdateFinished: boolean;
+ firmwareUpdateFailed?: boolean;
modules: HardwareModules;
log: Array;
restoringUserConfiguration: boolean;
@@ -136,6 +137,7 @@ export function reducer(state = initialState, action: Action): State {
...state,
updatingFirmware: false,
firmwareUpdateFinished: true,
+ firmwareUpdateFailed: false,
modules: (action as UpdateFirmwareSuccessAction).payload
};
@@ -150,6 +152,7 @@ export function reducer(state = initialState, action: Action): State {
...state,
updatingFirmware: false,
firmwareUpdateFinished: true,
+ firmwareUpdateFailed: true,
modules: data.modules,
log: [...state.log, logEntry]
};
@@ -228,3 +231,4 @@ export const getBackupUserConfigurationState = (state: State): RestoreConfigurat
};
};
export const bootloaderActive = (state: State) => state.bootloaderActive;
+export const firmwareUpgradeFailed = (state: State) => state.firmwareUpdateFailed;