From b45d60efb2340d122f5209c1c1af9f3d81fdf859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Kiss?= Date: Mon, 22 Oct 2018 07:34:14 +0200 Subject: [PATCH] feat: log USB device list before check permission (#837) --- packages/uhk-usb/src/uhk-hid-device.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/uhk-usb/src/uhk-hid-device.ts b/packages/uhk-usb/src/uhk-hid-device.ts index 158ad38b..6e43da11 100644 --- a/packages/uhk-usb/src/uhk-hid-device.ts +++ b/packages/uhk-usb/src/uhk-hid-device.ts @@ -50,7 +50,11 @@ export class UhkHidDevice { return true; } - const dev = devices().find((x: Device) => isUhkDevice(x) || x.productId === Constants.BOOTLOADER_ID); + this.logService.debug('[UhkHidDevice] Devices before check permission:'); + const devs = devices(); + this.logDevices(devs); + + const dev = devs.find((x: Device) => isUhkDevice(x) || x.productId === Constants.BOOTLOADER_ID); if (!dev) { return true; @@ -260,9 +264,7 @@ export class UhkHidDevice { const devs = devices(); if (!isEqualArray(this._prevDevices, devs)) { this.logService.debug('[UhkHidDevice] Available devices:'); - for (const logDevice of devs) { - this.logService.debug(JSON.stringify(logDevice)); - } + this.logDevices(devs); this._prevDevices = devs; } else { this.logService.debug('[UhkHidDevice] Available devices unchanged'); @@ -284,6 +286,12 @@ export class UhkHidDevice { return null; } + + private logDevices(devs: Array): void { + for (const logDevice of devs) { + this.logService.debug(JSON.stringify(logDevice)); + } + } } function kbootCommandName(module: ModuleSlotToI2cAddress): string {