bluetooth-hci-socket
Advanced tools
Comparing version 0.4.4 to 0.5.0
@@ -7,3 +7,3 @@ var os = require('os'); | ||
module.exports = require('./lib/usb.js'); | ||
} else if (platform === 'linux') { | ||
} else if (platform === 'linux' || platform === 'android') { | ||
module.exports = require('./lib/native'); | ||
@@ -10,0 +10,0 @@ } else { |
@@ -44,5 +44,25 @@ var events = require('events'); | ||
this._usbDevice = usb.findByIds(usbVid, usbPid); | ||
if (process.env.BLUETOOTH_HCI_SOCKET_USB_BUS && process.env.BLUETOOTH_HCI_SOCKET_USB_ADDRESS) { | ||
var usbBus = parseInt(process.env.BLUETOOTH_HCI_SOCKET_USB_BUS); | ||
var usbAddress = parseInt(process.env.BLUETOOTH_HCI_SOCKET_USB_ADDRESS); | ||
debug('using USB BUS = ' + usbBus + ', Address = ' + usbAddress); | ||
var usbDevices = usb.getDeviceList(); | ||
for (var i = 0; i < usbDevices.length; i++) { | ||
var usbDeviceDesc = usbDevices[i].deviceDescriptor; | ||
if ((usbDeviceDesc.idVendor == usbVid) && | ||
(usbDeviceDesc.idProduct == usbPid) && | ||
(usbDevices[i].busNumber == usbBus) && | ||
(usbDevices[i].deviceAddress == usbAddress)) { | ||
this._usbDevice = usbDevices[i]; | ||
} | ||
} | ||
} else { | ||
this._usbDevice = usb.findByIds(usbVid, usbPid); | ||
} | ||
} else { | ||
this._usbDevice = usb.findByIds(0x0a5c, 0x21e8) || usb.findByIds(0x19ff, 0x0239) || usb.findByIds(0x0a12, 0x0001) || usb.findByIds(0x0b05, 0x17cb); | ||
this._usbDevice = usb.findByIds(0x0a5c, 0x21e8) || usb.findByIds(0x19ff, 0x0239) || usb.findByIds(0x0a12, 0x0001) || usb.findByIds(0x0b05, 0x17cb) || usb.findByIds(0x8087, 0x07dc); | ||
} | ||
@@ -131,3 +151,3 @@ | ||
if (this._mode === 'raw' && buf.length === 6 && ('0e0401030c00' === buf.toString('hex'))) { | ||
if (this._mode === 'raw' && buf.length === 6 && ('0e0401030c00' === buf.toString('hex') || '0e0402030c00' === buf.toString('hex'))) { | ||
debug('reset complete'); | ||
@@ -134,0 +154,0 @@ this._isUp = true; |
{ | ||
"name": "bluetooth-hci-socket", | ||
"version": "0.4.4", | ||
"version": "0.5.0", | ||
"description": "Bluetooth HCI socket binding for Node.js", | ||
@@ -27,2 +27,3 @@ "main": "index.js", | ||
"linux", | ||
"android", | ||
"win32" | ||
@@ -29,0 +30,0 @@ ], |
@@ -33,2 +33,3 @@ # node-bluetooth-hci-socket | ||
| Asus BT-400 | 0x0b05 | 0x17cb | | ||
| Intel Wireless Bluetooth | 0x8087 | 0x07dc | | ||
@@ -35,0 +36,0 @@ ## Install |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
44171
683
196
9