usb 1.8.7 → 1.8.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.8.8] - 2022-02-07
4
+
5
+ ### Fixed
6
+ - Reverted exit delay and hang by moving queue start/stop to device open/close - [`460`](https://github.com/node-usb/node-usb/pull/460) ([MikeColeGuru](https://github.com/MikeColeGuru))
7
+
3
8
  ## [1.8.7] - 2022-02-07
4
9
 
5
10
  ### Fixed
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "usb",
3
3
  "description": "Library to access USB devices",
4
- "version": "1.8.7",
4
+ "version": "1.8.8",
5
5
  "engines": {
6
6
  "node": ">=10.16.0"
7
7
  },
Binary file
Binary file
Binary file
package/src/device.cc CHANGED
@@ -19,12 +19,18 @@ Device::Device(const Napi::CallbackInfo & info) : Napi::ObjectWrap<Device>(info)
19
19
  device = info[0].As<Napi::External<libusb_device>>().Data();
20
20
  libusb_ref_device(device);
21
21
  byPtr.insert(std::make_pair(device, this));
22
+ #ifndef USE_POLL
23
+ completionQueue.start(info.Env());
24
+ #endif
22
25
  DEBUG_LOG("Created device %p", this);
23
26
  Constructor(info);
24
27
  }
25
28
 
26
29
  Device::~Device(){
27
30
  DEBUG_LOG("Freed device %p", this);
31
+ #ifndef USE_POLL
32
+ completionQueue.stop();
33
+ #endif
28
34
  byPtr.erase(device);
29
35
  libusb_close(device_handle);
30
36
  libusb_unref_device(device);
@@ -188,9 +194,6 @@ Napi::Value Device::Open(const Napi::CallbackInfo& info) {
188
194
  ENTER_METHOD(Device, 0);
189
195
  if (!self->device_handle){
190
196
  CHECK_USB(libusb_open(self->device, &self->device_handle));
191
- #ifndef USE_POLL
192
- completionQueue.start(info.Env());
193
- #endif
194
197
  }
195
198
  return env.Undefined();
196
199
  }
@@ -200,9 +203,6 @@ Napi::Value Device::Close(const Napi::CallbackInfo& info) {
200
203
  if (self->canClose()){
201
204
  libusb_close(self->device_handle);
202
205
  self->device_handle = NULL;
203
- #ifndef USE_POLL
204
- completionQueue.stop();
205
- #endif
206
206
  }else{
207
207
  THROW_ERROR("Can't close device with a pending request");
208
208
  }