From df4fa8fb5b68c545befce8dc4a7d258a0ca491ba Mon Sep 17 00:00:00 2001 From: zyphlar Date: Fri, 31 Aug 2018 13:26:59 -0700 Subject: [PATCH] Fix all_on and all_off error sendFeatureReport always needs two arguments, even if one is null (0x00) See C++ source here for future development reference: https://github.com/pavel-a/usb-relay-hid/blob/87cf2d92c7b64b02f870b86a55ee9c970c29abdd/lib/usb_relay_lib.c --- src/board.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/board.js b/src/board.js index c2a418f..0a66a39 100644 --- a/src/board.js +++ b/src/board.js @@ -69,14 +69,17 @@ class Board { } allOn() { - this.trigger([ALL_ON]) + this.trigger([ALL_ON, 0]) } allOff() { - this.trigger([ALL_OFF]) + this.trigger([ALL_OFF, 0]) } trigger(state) { + if (state.length != 2) { + throw new Error('easy-usb-relay library error: exactly two arguments required for trigger function.') + } this.logState() this.board.sendFeatureReport(state) }