Comparing version 2.8.1 to 2.8.2
# Changelog | ||
## [2.8.2] - 2023-03-06 | ||
### Added | ||
- Added new `usb.pollHotplug` setting to allow users to force hotplug detection using polling - [`576`](https://github.com/node-usb/node-usb/pull/576) ([Rob Moran](https://github.com/thegecko)) | ||
## [2.8.1] - 2023-02-26 | ||
@@ -4,0 +9,0 @@ |
@@ -7,2 +7,6 @@ /// <reference types="node" /> | ||
export declare function getDeviceList(): Device[]; | ||
/** | ||
* Force polling loop for hotplug events | ||
*/ | ||
export declare let pollHotplug: boolean; | ||
export declare const INIT_ERROR: number; | ||
@@ -9,0 +13,0 @@ export declare class LibUSBException extends Error { |
@@ -21,10 +21,12 @@ "use strict"; | ||
Object.setPrototypeOf(usb, events_1.EventEmitter.prototype); | ||
Object.defineProperty(usb, 'pollHotplug', { | ||
value: false, | ||
writable: true | ||
}); | ||
Object.getOwnPropertyNames(device_1.ExtendedDevice.prototype).forEach(function (name) { | ||
Object.defineProperty(usb.Device.prototype, name, Object.getOwnPropertyDescriptor(device_1.ExtendedDevice.prototype, name) || Object.create(null)); | ||
}); | ||
// Hotplug support | ||
var hotplugSupported = usb._supportedHotplugEvents(); | ||
// Devices delta support for non-libusb hotplug events | ||
// This methd needs to be used for attach/detach IDs (hotplugSupportType === 2) rather than a lookup because vid/pid are not unique | ||
var hotPlugDevices = new Set(); | ||
// This method needs to be used for attach/detach IDs (hotplugSupportType === 2) rather than a lookup because vid/pid are not unique | ||
var emitHotplugEvents = function () { | ||
@@ -84,3 +86,5 @@ var e_1, _a, e_2, _b; | ||
// Hotplug control | ||
var hotplugSupported = 0; | ||
var startHotplug = function () { | ||
hotplugSupported = usb.pollHotplug ? 0 : usb._supportedHotplugEvents(); | ||
if (hotplugSupported !== 1) { | ||
@@ -87,0 +91,0 @@ // Collect initial devices when not using libusb |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "2.8.1", | ||
"version": "2.8.2", | ||
"main": "dist/index.js", | ||
@@ -8,0 +8,0 @@ "engines": { |
@@ -293,2 +293,8 @@ # USB Library for Node.JS | ||
#### usb.getDeviceList() | ||
Return a list of legacy `Device` objects for the USB devices attached to the system. | ||
#### usb.pollHotplug | ||
Force polling loop for hotplug events. | ||
#### usb.setDebugLevel(level : int) | ||
@@ -295,0 +301,0 @@ Set the libusb debug level (between 0 and 4) |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6215333
3104
634