From 67346b4cdaa40f4a83746462af5ddd203e9ff4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Tue, 30 Jan 2018 05:10:29 +0100 Subject: [PATCH] Simplify getTransferData() --- packages/usb/uhk.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/usb/uhk.js b/packages/usb/uhk.js index 38892aaf..3d49e217 100644 --- a/packages/usb/uhk.js +++ b/packages/usb/uhk.js @@ -175,20 +175,11 @@ function convertBufferToIntArray(buffer) { } function getTransferData(buffer) { - const data = convertBufferToIntArray(buffer) - // if data start with 0 need to add additional leading zero because HID API remove it. - // https://github.com/node-hid/node-hid/issues/187 - if (data.length > 0 && data[0] === 0) { -// data.unshift(0) // TODO: This has been commented out because it causes bugs on Linux and Mac. Gotta test it on Windows and fully remove it if possible. - } - // From HID API documentation: // http://www.signal11.us/oss/hidapi/hidapi/doxygen/html/group__API.html#gad14ea48e440cf5066df87cc6488493af // The first byte of data[] must contain the Report ID. // For devices which only support a single report, this must be set to 0x0. - data.unshift(0) - - return data + return [0, ...convertBufferToIntArray(buffer)]; } function readLog(buffer) {