Skip to content

Commit

Permalink
fix: reset on closing usb and uart to disconnect on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
stoprocent committed Dec 30, 2024
1 parent 7effa7f commit 93d429b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/uart.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class BluetoothHciSocket extends EventEmitter {
this._serialDevice = null;
this._queue = null;
this._parser = null;
process.on('exit', () => this.reset());
}

setFilter (filter) {
Expand Down
2 changes: 2 additions & 0 deletions lib/usb.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ function BluetoothHciSocket () {

this._hciEventEndpointBuffer = Buffer.alloc(0);
this._aclDataInEndpointBuffer = Buffer.alloc(0);

process.on('exit', () => this.reset());
}

util.inherits(BluetoothHciSocket, events.EventEmitter);
Expand Down

0 comments on commit 93d429b

Please sign in to comment.