Skip to content

Commit

Permalink
Add FreeBSD support
Browse files Browse the repository at this point in the history
  • Loading branch information
valpackett committed Nov 26, 2016
1 parent e89459a commit 04553d6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ coverage

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/
lib/binding/

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Bluetooth HCI socket binding for Node.js

__NOTE:__ Currently only supports __Linux__ and __Windows__.
__NOTE:__ Currently only supports __Linux__, __FreeBSD__ and __Windows__.

## Prerequisites

Expand Down Expand Up @@ -168,6 +168,16 @@ Set ```BLUETOOTH_HCI_SOCKET_FORCE_USB``` environment variable:
sudo BLUETOOTH_HCI_SOCKET_FORCE_USB=1 node <file>.js
```

### FreeBSD

Disable automatic loading of the default Bluetooth stack by putting [no-ubt.conf](https://gist.github.com/myfreeweb/44f4f3e791a057bc4f3619a166a03b87) into ```/usr/local/etc/devd/no-ubt.conf``` and restarting devd (```sudo service devd restart```).

Unload ```ng_ubt``` kernel module if already loaded:

```sh
sudo kldunload ng_ubt
```

### OS X

#### Disable CSR USB Driver
Expand Down
2 changes: 1 addition & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
'target_name': 'binding',
'conditions': [
['OS=="linux" or OS=="android"', {
['OS=="linux" or OS=="android" or OS=="freebsd"', {
'sources': [
'src/BluetoothHciSocket.cpp'
]
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var os = require('os');

var platform = os.platform();

if (process.env.BLUETOOTH_HCI_SOCKET_FORCE_USB || platform === 'win32') {
if (process.env.BLUETOOTH_HCI_SOCKET_FORCE_USB || platform === 'win32' || platform === 'freebsd') {
module.exports = require('./lib/usb.js');
} else if (platform === 'linux' || platform === 'android') {
module.exports = require('./lib/native');
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"os": [
"linux",
"android",
"freebsd",
"win32"
],
"dependencies": {
Expand Down

0 comments on commit 04553d6

Please sign in to comment.