Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
1,772 Views

Edison BLE Stuck in "Dual Mode" with bleno

I am using https://github.com/sandeepmistry/bleno bleno to create a simple JavaScript Bluetooth peripheral. My code and steps can be found here: http://shawnhymel.com/703/bluetooth-low-energy-peripherals-with-javascript/ Bluetooth Low Energy Peripherals with JavaScript | Shawn Hymel

I made sure to unblock the radio and kill bluetoothd with

rfkill unblock bluetooth

killall bluetoothd

hciconfig hci0 up

It worked for a while (as you can see in the blog post). Eventually, my phone (Android - Samsung Galaxy S5) started showing the Edison as a "Dual Mode" device, which, according to the Edison documentation, is not possible. When I click on the device now in BLE Scanner, it just says "connecting..." forever. Previously, it would make an immediate connection to the Edison's BLE and offer me the available services and characteristics.

"squishy" is the name for my Edison.

I have tried restarting the Edison, restarting Bluetooth on my phone, and even re-flashing Yocto with no success. I have also tried other BLE scanners and programs. I cannot figure out what happened to the radio (something deeper than the Yocto file system?) to cause it to no longer accept BLE connections. This seems to have happened before to others (such as @danki in https://github.com/sandeepmistry/bleno/issues/131 this GitHub issue).

Here are the specifics of my Bluetooth configuration on the Edison. Please let me know if I can provide any more. Any help is appreciated!

root@squishy:~# rfkill list

0: phy0: wlan

Soft blocked: no

Hard blocked: no

1: brcmfmac-wifi: wlan

Soft blocked: no

Hard blocked: no

2: bcm43xx Bluetooth: bluetooth

Soft blocked: no

Hard blocked: no

3: hci0: bluetooth

Soft blocked: no

Hard blocked: no

root@squishy:~# systemctl status bluetooth -l

● bluetooth.service - Bluetooth service

Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)

Active: inactive (dead) since Sat 2015-11-28 17:52:28 UTC; 20min ago

Docs: man:bluetoothd(8)

Process: 241 ExecStart=/usr/lib/bluez5/bluetooth/bluetoothd (code=exited, status=0/SUCCESS)

Main PID: 241 (code=exited, status=0/SUCCESS)

Status: "Quitting"

Nov 26 17:39:02 squishy bluetoothd[241]: Bluetooth daemon 5.24

Nov 26 17:39:02 squishy bluetoothd[241]: Starting SDP server

Nov 26 17:39:03 squishy bluetoothd[241]: Bluetooth management interface 1.3 initialized

Nov 26 17:39:03 squishy bluetoothd[241]: Sap driver initialization failed.

Nov 26 17:39:03 squishy bluetoothd[241]: sap-server: Operation not permitted (1)

Nov 26 17:39:03 squishy bluetoothd[241]: hci0 Load Connection Parameters failed: Unknown Command (0x01)

Nov 26 17:39:03 squishy systemd[1]: Started Bluetooth service.

Nov 26 17:39:06 squishy bluetoothd[241]: Endpoint registered: sender=:1.7 path=/MediaEndpoint/A2DPSource

Nov 26 17:39:06 squishy bluetoothd[241]: Endpoint registered: sender=:1.7 path=/MediaEndpoint/A2DPSink

Nov 28 17:52:28 squishy bluetoothd[241]: Terminating

root@squishy:~# bluetoothctl

[NEW] Controller 98:4F:EE:04:3E:F9 BlueZ 5.24 [default]

[CHG] Controller 98:4F:EE:04:3E:F9 Name: squishy

[CHG] Controller 98:4F:EE:04:3E:F9 Alias: squishy

[CHG] Controller 98:4F:EE:04:3E:F9 Class: 0x000110

[CHG] Controller 98:4F:EE:04:3E:F9 UUIDs:

00001200-0000-1000-8000-00805f9b34fb

00001800-0000-1000-8000-00805f9b34fb

00001801-0000-1000-8000-00805f9b34fb

0000110e-0000-1000-8000-00805f9b34fb

0000110c-0000-1000-8000-00805f9b34fb

0000111e-0000-1000-8000-00805f9b34fb

0000110a-0000-1000-8000-00805f9b34fb

0000110b-0000-1000-8000-00805f9b34fb

[CHG] Controller 98:4F:EE:04:3E:F9 UUIDs:

00001200-0000-1000-8000-00805f9b34fb

00001800-0000-1000-8000-00805f9b34fb

00001801-0000-1000-8000-00805f9b34fb

0000110e-0000-1000-8000-00805f9b34fb

0000110c-0000-1000-8000-00805f9b34fb

0000111e-0000-1000-8000-00805f9b34fb

0000110a-0000-1000-8000-00805f9b34fb

0000110b-0000-1000-8000-00805f9b34fb

[CHG] Controller 98:4F:EE:04:3E:F9 Alias: BlueZ 5.24

[CHG] Controller 98:4F:EE:04:3E:F9 Class: 0x200110

[CHG] Controller 98:4F:EE:04:3E:F9 UUIDs:

00001200-0000-1000-8000-00805f9b34fb

00001800-0000-1000-8000-00805f9b34fb

00001801-0000-1000-8000-00805f9b34fb

0000110e-0000-1000-8000-00805f9b34fb

0000110c-0000-1000-8000-00805f9b34fb

0000111e-0000-1000-8000-00805f9b34fb

0000110a-0000-1000-8000-00805f9b34fb

0000110b-0000-1000-8000-00805f9b34fb

[CHG] Controller 98:4F:EE:04:3E:F9 Alias: squishy

[CHG] Controller 98:4F:EE:04:3E:F9 Class: 0x280110

[CHG] Controller 98:4F:EE:04:3E:F9 UUIDs:

00001200-0000-1000-8000-00805f9b34fb

00001800-0000-1000-8000-00805f9b34fb

00001801-0000-1000-8000-00805f9b34fb

0000110e-0000-1000-8000-00805f9b34fb

0000110c-0000-1000-8000-00805f9b34fb

0000111e-0000-1000-8000-00805f9b34fb

0000110a-0000-1000-8000-00805f9b34fb

0000110b-0000-1000-8000-00805f9b34fb

[CHG] Controller 98:4F:EE:04:3E:F9 Class: 0x2c0110

[CHG] Controller 98:4F:EE:04:3E:F9 UUIDs:

00001200-0000-1000-8000-00805f9b34fb

00001800-0000-1000-8000-00805f9b34fb

00001801-0000-1000-8000-00805f9b34fb

0000110e-0000-1000-8000-00805f9b34fb

0000110c-0000-1000-8000-00805f9b34fb

0000111e-0000-1000-8000-00805f9b34fb

0000110a-0000-1000-8000-00805f9b34fb

0000110b-0000-1000-8000-00805f9b34fb

[bluetooth]# show

Controller 98:4F:EE:04:3E:F9

Name: squishy

Alias: squishy

Class: 0x2c0110

Powered: yes

Discoverable: no

Pairable: yes

UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)

UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)

UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)

UUID: ...

7 Replies
Highlighted
New Contributor III
13 Views

Hi ShawnHymel,

probably you are using bleno version 0.3.2, this version had a serious problem on Yocto. Luckily two days ago was fixed by version 0.3.3, see:

https://github.com/sandeepmistry/bleno/commit/0c150480320f23bc04ea1618670712a4e9c55f91 - add isYocto check for skipping first set of adv and sr data (# 151) · sandeepmistry/bleno@0c15048 · GitHub

Please let me know if this solve your problem.

Thanks

-max

0 Kudos
Highlighted
Novice
13 Views

Thanks, max! I grabbed the latest repo from github, unzipped it, and ran npm install inside the directory. For some reason, the installation process can't find libudev headers. I see that libudev should be installed, but it seems that I need libudev-dev to get the headers, and that is not in any of the opkg.net Edison repos (e.g. http://repo.opkg.net/edison/repo/core2-32/ Index of /edison/repo/core2-32). I'm not even sure how it worked at all in the first place if bleno needs libudev.h.

root@squishy:~/bleno-master# npm install

npm WARN optional dep failed, continuing xpc-connection@0.1.4

npm WARN engine node-hid@0.5.1: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.38","npm":"1.4.28"})

-

> node-hid@0.5.1 install /home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid

> node-pre-gyp install --fallback-to-build

make: Entering directory '/home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid/build'

CC(target) Release/obj.target/hidapi/hidapi/libusb/hid.o

../hidapi/libusb/hid.c:47:20: fatal error: libusb.h: No such file or directory

# include

^

compilation terminated.

hidapi.target.mk:84: recipe for target 'Release/obj.target/hidapi/hidapi/libusb/hid.o' failed

make: *** [Release/obj.target/hidapi/hidapi/libusb/hid.o] Error 1

make: Leaving directory '/home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid/build'

gyp ERR! build error

gyp ERR! stack Error: `make` failed with exit code: 2

gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)

gyp ERR! stack at ChildProcess.emit (events.js:98:17)

gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)

gyp ERR! System Linux 3.10.17-poky-edison+

gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid/build/HID/v0.5.1/Release/node-v11-linux-ia32/HID.node" "--module_name=HID" "--module_path=/home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid/build/HID/v0.5.1/Release/node-v11-linux-ia32"

gyp ERR! cwd /home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid

gyp ERR! node -v v0.10.38

gyp ERR! node-gyp -v v1.0.1

gyp ERR! not ok

node-pre-gyp ERR! build error

node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid/build/HID/v0.5.1/Release/node-v11-linux-ia32/HID.node --module_name=HID --module_path=/home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid/build/HID/v0.5.1/Release/node-v11-linux-ia32' (1)

node-pre-gyp ERR! stack at ChildProcess. (/home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid/node_modules/node-pre-gyp/lib/util/compile.js:83:29)

node-pre-gyp ERR! stack at ChildProcess.emit (events.js:98:17)

node-pre-gyp ERR! stack at maybeClose (child_process.js:766:16)

node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:833:5)

node-pre-gyp ERR! System Linux 3.10.17-poky-edison+

node-pre-gyp ERR! command "node" "/home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"

node-pre-gyp ERR! cwd /home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid

node-pre-gyp ERR! node -v v0.10.38

node-pre-gyp ERR! node-pre-gyp -v v0.6.12

node-pre-gyp ERR! not ok

Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid/build/HID/v0.5.1/Release/node-v11-linux-ia32/HID.node --module_name=HID --module_path=/home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid/build/HID/v0.5.1/Release/node-v11-linux-ia32' (1)

npm ERR! node-hid@0.5.1 install: `node-pre-gyp install --fallback-to-build`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the node-hid@0.5.1 install script.

npm ERR! This is most likely a problem with the node-hid package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR! node-pre-gyp install --fallback-to-build

npm ERR! You can get their info via:

npm ERR! npm owner ls node-hid

npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.10.17-poky-edison+

npm ERR! command "node" "/usr/bin/npm" "install"

npm ERR! cwd /home/root/bleno-master

npm ERR! node -v v0.10.38

npm ERR! npm -v 1.4.28

npm ERR! code ELIFECYCLE

npm ERR! not ok code 0

0 Kudos
Highlighted
Novice
13 Views

Wrong install output. I was able to install libusb with

opkg install libusb-1.0-dev

However, now I am getting the real error with the missing libudev.h file:

Silly forums are not letting me paste in the whole text, so here's a gist of the output: https://gist.github.com/ShawnHymel/804620ceeed764638d41 npm install bleno output · GitHub

0 Kudos
Highlighted
New Contributor III
13 Views

Hi ShawnHymel,

I usually install bleno from npm repo without download it from github and it works. Did you tried this way?

0 Kudos
Highlighted
Novice
13 Views

I have, and it still does not work. From what I can tell, the npmjs package (https://www.npmjs.com/package/bleno bleno) does not contain the Yocto fix that was pushed to GitHub 3 days ago.

0 Kudos
Highlighted
New Contributor III
13 Views

In this case you can use the version from NPM and change only the file that has the bug, ie: gap.js in /home/root/.node_app_slot/node_modules/bleno/lib/hci-socket/

0 Kudos
Highlighted
Novice
13 Views

That didn't stop the other errors, but resetting the phone also seemed to put the Edison back as being listed as "BLE only" (instead of just turning the BLE radio off and on). I really wish there was a way to easily replicate this and see why Android fails at BLE.

0 Kudos