Socket
Socket
Sign inDemoInstall

usb

Package Overview
Dependencies
Maintainers
3
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

usb - npm Package Compare versions

Comparing version 2.8.2 to 2.8.3

6

CHANGELOG.md
# Changelog
## [2.8.3] - 2023-03-09
### Fixed
- Fixed Windows X86 crash with USB detection - [`578`](https://github.com/node-usb/node-usb/pull/578) ([Julian Waller](https://github.com/Julusian))
- Fixed Windows USB detection race condition with delay - [`577`](https://github.com/node-usb/node-usb/pull/577) ([Rob Moran](https://github.com/thegecko))
## [2.8.2] - 2023-03-06

@@ -4,0 +10,0 @@

4

dist/usb/bindings.d.ts

@@ -11,2 +11,6 @@ /// <reference types="node" />

export declare let pollHotplug: boolean;
/**
* Hotplug polling loop delay (ms)
*/
export declare let pollHotplugDelay: number;
export declare const INIT_ERROR: number;

@@ -13,0 +17,0 @@ export declare class LibUSBException extends Error {

16

dist/usb/index.js

@@ -25,2 +25,6 @@ "use strict";

});
Object.defineProperty(usb, 'pollHotplugDelay', {
value: 500,
writable: true
});
Object.getOwnPropertyNames(device_1.ExtendedDevice.prototype).forEach(function (name) {

@@ -83,4 +87,6 @@ Object.defineProperty(usb.Device.prototype, name, Object.getOwnPropertyDescriptor(device_1.ExtendedDevice.prototype, name) || Object.create(null));

}
setTimeout(function () { return pollHotplug(); }, 500);
setTimeout(function () { return pollHotplug(); }, usb.pollHotplugDelay);
};
// Devices changed event handler
var devicesChanged = function () { return setTimeout(function () { return emitHotplugEvents(); }, usb.pollHotplugDelay); };
// Hotplug control

@@ -99,4 +105,4 @@ var hotplugSupported = 0;

// Use hotplug ID events to trigger a change check
usb.on('attachIds', emitHotplugEvents);
usb.on('detachIds', emitHotplugEvents);
usb.on('attachIds', devicesChanged);
usb.on('detachIds', devicesChanged);
}

@@ -115,4 +121,4 @@ }

// Remove hotplug ID event listeners
usb.off('attachIds', emitHotplugEvents);
usb.off('detachIds', emitHotplugEvents);
usb.off('attachIds', devicesChanged);
usb.off('detachIds', devicesChanged);
}

@@ -119,0 +125,0 @@ }

@@ -35,3 +35,3 @@ /// <reference types="w3c-web-usb" />

protected knownDevices: Map<usb.Device, WebUSBDevice>;
protected authorisedDevices: Set<USBDevice>;
protected authorisedDevices: Set<USBDeviceFilter>;
constructor(options?: USBOptions);

@@ -38,0 +38,0 @@ private _onconnect;

@@ -278,3 +278,10 @@ "use strict";

}
this.authorisedDevices.add(device);
this.authorisedDevices.add({
vendorId: device.vendorId,
productId: device.productId,
classCode: device.deviceClass,
subclassCode: device.deviceSubclass,
protocolCode: device.deviceProtocol,
serialNumber: device.serialNumber
});
return [2 /*return*/, device];

@@ -462,3 +469,11 @@ case 6:

}
return this.authorisedDevices.has(device);
// Check authorised devices
return __spreadArray([], __read(this.authorisedDevices.values())).some(function (authorised) {
return authorised.vendorId === device.vendorId
&& authorised.productId === device.productId
&& authorised.classCode === device.deviceClass
&& authorised.subclassCode === device.deviceSubclass
&& authorised.protocolCode === device.deviceProtocol
&& authorised.serialNumber === device.serialNumber;
});
};

@@ -465,0 +480,0 @@ return WebUSB;

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "2.8.2",
"version": "2.8.3",
"main": "dist/index.js",

@@ -47,3 +47,3 @@ "engines": {

"test": "mocha --require coffeescript/register --grep Module test/*",
"full-test": "mocha --require coffeescript/register test/*.coffee",
"full-test": "mocha --timeout 10000 --require coffeescript/register test/*.coffee",
"valgrind": "coffee -c test/*.coffee; valgrind --leak-check=full --show-possibly-lost=no node --expose-gc --trace-gc node_modules/mocha/bin/_mocha -R spec",

@@ -50,0 +50,0 @@ "docs": "typedoc",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc