diff --git a/BigRedButton.js b/BigRedButton.js index d8759d6..df309b5 100644 --- a/BigRedButton.js +++ b/BigRedButton.js @@ -55,7 +55,11 @@ function BigRedButton(index) util.inherits(BigRedButton, events.EventEmitter); BigRedButton.prototype.askForStatus = function() { - this.hid.write(cmdStatus); + try { + this.hid.write(cmdStatus); + } catch(e) { + this.close(); + } }; BigRedButton.prototype.interpretData = function(error, data) { @@ -98,3 +102,7 @@ BigRedButton.prototype.isLidDown = function() { exports.BigRedButton = BigRedButton; exports.deviceCount = function () { return getAllDevices().length; } +exports.resetDevices = function () { + allDevices = null + getAllDevices(); +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..5c8485b --- /dev/null +++ b/package.json @@ -0,0 +1,28 @@ +{ + "name": "BigRedButtonNodeHID", + "version": "1.0.0", + "description": "Big red button helper.", + "main": "BigRedButton.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git@github.com:codepope/BigRedButtonNodeHID.git" + }, + "keywords": [ + "big", + "red", + "button", + "helper", + "io", + "usb", + "hid" + ], + "author": "codepope", + "license": "MIT", + "bugs": { + "url": "https://github.com/codepope/BigRedButtonNodeHID/issues" + }, + "homepage": "https://github.com/codepope/BigRedButtonNodeHID" +}