usb 2.5.1 → 2.5.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "usb",
3
3
  "description": "Library to access USB devices",
4
4
  "license": "MIT",
5
- "version": "2.5.1",
5
+ "version": "2.5.2-alpha.1",
6
6
  "main": "dist/index.js",
7
7
  "engines": {
8
8
  "node": ">=10.20.0 <11.x || >=12.17.0 <13.0 || >=14.0.0"
Binary file
Binary file
@@ -78,6 +78,16 @@ DWORD MyCMInterfaceNotification(HCMNOTIFICATION hNotify, PVOID Context, CM_NOTIF
78
78
 
79
79
  class HotPlugManagerWindows : public HotPlugManager
80
80
  {
81
+ public:
82
+ HotPlugManagerWindows()
83
+ {
84
+ cmNotifyFilter = { 0 };
85
+ cmNotifyFilter.cbSize = sizeof(cmNotifyFilter);
86
+ cmNotifyFilter.Flags = 0;
87
+ cmNotifyFilter.FilterType = CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE;
88
+ cmNotifyFilter.u.DeviceInterface.ClassGuid = GUID_DEVINTERFACE_USB_DEVICE;
89
+ }
90
+
81
91
  int supportedHotplugEvents()
82
92
  {
83
93
  return HOTPLUG_SUPPORTS_IDS;
@@ -91,12 +101,6 @@ class HotPlugManagerWindows : public HotPlugManager
91
101
  }
92
102
 
93
103
  isRunning = true;
94
-
95
- CM_NOTIFY_FILTER cmNotifyFilter = { 0 };
96
- cmNotifyFilter.cbSize = sizeof(cmNotifyFilter);
97
- cmNotifyFilter.Flags = 0;
98
- cmNotifyFilter.FilterType = CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE;
99
- cmNotifyFilter.u.DeviceInterface.ClassGuid = GUID_DEVINTERFACE_USB_DEVICE;
100
104
 
101
105
  auto res = CM_Register_Notification(&cmNotifyFilter, (PVOID)instanceData, (PCM_NOTIFY_CALLBACK)&MyCMInterfaceNotification, &hcm);
102
106
  if (res != CR_SUCCESS)
@@ -121,6 +125,7 @@ class HotPlugManagerWindows : public HotPlugManager
121
125
  private:
122
126
  std::atomic<bool> isRunning = {false};
123
127
  HCMNOTIFICATION hcm;
128
+ CM_NOTIFY_FILTER cmNotifyFilter;
124
129
  };
125
130
 
126
131
  std::unique_ptr<HotPlugManager> HotPlugManager::create()