From 83469886044b20f6388e9bb3311cbb284f77a662 Mon Sep 17 00:00:00 2001 From: Michal Szafranski Date: Sun, 3 Nov 2019 17:40:02 +0100 Subject: [PATCH] fix device type read regression --- src/lpf2hub.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lpf2hub.ts b/src/lpf2hub.ts index 3a76b27..19134c0 100644 --- a/src/lpf2hub.ts +++ b/src/lpf2hub.ts @@ -268,7 +268,7 @@ export class LPF2Hub extends Hub { private _parsePortMessage (data: Buffer) { let port = this._getPortForPortNumber(data[3]); - const type = data.readUInt16LE(5); + const type = data[4] ? data.readUInt16LE(5) : 0; if (data[4] === 0x01 && this.sendPortInformationRequests) { modeInfoDebug(`Port ${this._toHex(data[3])}, type ${this._toHex(type, 4)} (${Consts.DeviceTypeNames[data[5]] || "unknown"})`);