Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isKernelDeviceActive not supported on Windows #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/event-handlers/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function KeyboardEvent() {
}
}

KeyboardEvent.emptyDataBuffer = new Buffer(8).fill(0);
KeyboardEvent.emptyDataBuffer = Buffer.alloc(8, 0);

KeyboardEvent.prototype.isEmpty = function () {
return !this.data.compare(KeyboardEvent.emptyDataBuffer);
Expand Down
2 changes: 1 addition & 1 deletion lib/event-handlers/numpad.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function NumpadEvent() {
}
}

NumpadEvent.emptyDataBuffer = new Buffer(8).fill(0);
NumpadEvent.emptyDataBuffer = Buffer.alloc(8, 0);

NumpadEvent.prototype.isEmpty = function () {
return !this.data.compare(NumpadEvent.emptyDataBuffer);
Expand Down
4 changes: 2 additions & 2 deletions lib/hid-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ that = _.extend(new events.EventEmitter(), {
return;
}
logger.enabledLevels.trace && log.trace('found device interface #%s of type %s :', ifaceIndex, opt.device.type[ifaceIndex], util.logObject(iface));
if (iface.isKernelDriverActive()) {
if (process.platform !== "win32" && iface.isKernelDriverActive()) {
logger.enabledLevels.debug && log.debug('detach interface #%s of device "%s" from kernel', ifaceIndex, hid.deviceKey);
iface.detachKernelDriver();
}
Expand Down Expand Up @@ -290,7 +290,7 @@ that = _.extend(new events.EventEmitter(), {
return p.fromNode(iface.release.bind(iface, true))
.then(function () {
logger.enabledLevels.debug && log.debug('interface #%s released for device "%s"', ifaceIndex, hid.deviceKey);
if (!iface.isKernelDriverActive()) {
if (process.platform !== "win32" && !iface.isKernelDriverActive()) {
logger.enabledLevels.debug && log.debug('reattach interface #%s of device "%s" from kernel', ifaceIndex, hid.deviceKey);
iface.attachKernelDriver();
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"hw-promise": "0.0.2",
"jsonic": "^0.2.2",
"lodash": "^3.10.1",
"node-hid": "^0.5.1",
"node-hid": "^0.7.6",
"properties": "^1.2.1",
"require-directory": "^2.1.1",
"usb": "^1.1.1",
Expand Down