From 6c4f580fc2dc6da2c0b8b92f96b4f164b89db6e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sun, 20 May 2018 01:40:45 +0200 Subject: [PATCH] Check if the keyboard is in factory reset mode and if so, display a relevant instruction. --- packages/uhk-common/src/util/helpers.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/uhk-common/src/util/helpers.ts b/packages/uhk-common/src/util/helpers.ts index 185cb375..b831597c 100644 --- a/packages/uhk-common/src/util/helpers.ts +++ b/packages/uhk-common/src/util/helpers.ts @@ -5,6 +5,10 @@ export const getHardwareConfigFromDeviceResponse = (json: string): HardwareConfi const hardwareConfig = new HardwareConfiguration(); hardwareConfig.fromBinary(UhkBuffer.fromArray(data)); + if (hardwareConfig.signature === 'FTY') { + throw Error('The device is in factory reset mode. Power-cycle the device to use it with Agent!'); + } + if (hardwareConfig.signature !== 'UHK') { throw Error('Invalid hardware configuration'); }