diff --git a/package.json b/package.json index 8fe24876..051a3c34 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ }, "scripts": { "postinstall": "lerna bootstrap", - "test":"run-p -sn test:test-serializer test:uhk-common test:uhk-web", + "test":"run-p -sn test:test-serializer test:uhk-common", "test:test-serializer": "lerna exec --scope test-serializer npm test", "test:uhk-common": "lerna exec --scope uhk-common npm test", "test:uhk-web": "lerna exec --scope uhk-web npm test", diff --git a/packages/uhk-agent/src/services/device.service.ts b/packages/uhk-agent/src/services/device.service.ts index 2e3da26a..dcc2fe45 100644 --- a/packages/uhk-agent/src/services/device.service.ts +++ b/packages/uhk-agent/src/services/device.service.ts @@ -46,6 +46,7 @@ export class DeviceService { */ public async loadConfigurations(event: Electron.Event): Promise { try { + await this.device.waitUntilKeyboardBusy(); const userConfiguration = await this.loadConfiguration( SystemPropertyIds.MaxUserConfigSize, UsbCommand.ReadUserConfig, diff --git a/packages/uhk-usb/src/uhk-hid-device.ts b/packages/uhk-usb/src/uhk-hid-device.ts index 3e7e4eb0..ad833e2b 100644 --- a/packages/uhk-usb/src/uhk-hid-device.ts +++ b/packages/uhk-usb/src/uhk-hid-device.ts @@ -165,7 +165,7 @@ export class UhkHidDevice { this._device = null; } - private async waitUntilKeyboardBusy(): Promise { + public async waitUntilKeyboardBusy(): Promise { while (true) { const buffer = await this.write(new Buffer([UsbCommand.GetKeyboardState])); if (buffer[1] === 0) {