-
• #2
After activating bluetooth in chrome with enabling this switch :
chrome://flags/#enable-experimental-web-platform-features
i face a new issue :serviceworker> active Handling URL "https://www.espruino.com/ide/" Couldn't connect to wss://localhost:31234 - disabling websockets for this session ERROR: serial_frame: getPorts timeout, disabling ERROR: getURL("/serial/ports") error : Not Found /serial/ports doesn't exist - disabling WebSocket support >>> Connecting... Set Slow Write = true BT> ERROR: NotFoundError: Bluetooth adapter not available. ERROR: [notify_error] Connection Failed. >>> Connection Failed.
-
• #3
That's odd - once you've enabled
chrome://flags/#enable-experimental-web-platform-features
it'll usually 'just work' (http://www.espruino.com/Quick+Start+BLE#linux)Have you tried just restarting the whole system and seeing if that's any better?
I use Linux for all my work, and occasionally I do get a
Bluetooth adapter not available.
and can fix it just by restarting the bluetooth stack withsudo /etc/init.d/bluetooth restart
What's your
bluetoothd
version?bluetoothd --version
And also what's the version of Chromium? Sometimes the builds are a long way behind the Chrome builds, so you could try installing Chrome and seeing if that's any better.
-
• #4
plonky@macronetmonk:~$ bluetoothd --version 5.50 plonky@macronetmonk:~$ sudo /etc/init.d/bluetooth restart [sudo] password for plonky: [ ok ] Restarting bluetooth (via systemctl): bluetooth.service. plonky@macronetmonk:~$ chromium --version Chromium 74.0.3729.108 snap
Still getting the error :
serviceworker> active Handling URL "https://www.espruino.com/ide/" Couldn't connect to wss://localhost:31234 - disabling websockets for this session ERROR: serial_frame: getPorts timeout, disabling ERROR: getURL("/serial/ports") error : Not Found /serial/ports doesn't exist - disabling WebSocket support >>> Connecting... Set Slow Write = true BT> ERROR: NotFoundError: Bluetooth adapter not available. ERROR: [notify_error] Connection Failed. >>> Connection Failed. >>> Connecting... Set Slow Write = true BT> ERROR: NotFoundError: Bluetooth adapter not available. ERROR: [notify_error] Connection Failed. >>> Connection Failed.
-
• #5
You don't have to worry about the
serial_frame
and/serial/ports
errors, but yeah,BT> ERROR: NotFoundError: Bluetooth adapter not available.
is your issue.Chromium looks up to date too. So do you see the
Web Bluetooth
menu item? Just nothing happens when you click it? Or do you get some other error/warning.Googling it, it might be that the bluetooth adaptor is turned off in Bluetooth settings? Worth a check - I don't know whether
gatttool
might have been able to overwrite the settings since you were running it as root.I know you tried
gatttool
but please can you just see ifsudo hcitool lescan
is able to list devices? -
• #6
plonky@macronetmonk:~$ sudo hcitool lescan [sudo] password for plonky: LE Scan ... FA:EE:05:A7:C7:34 Pixl.js c734 FA:EE:05:A7:C7:34 (unknown) F0:AB:54:4B:3F:8C TNT_BW F0:AB:54:4B:3F:8C (unknown)
-
• #7
That's properly strange then -
hcitool
looks like it's working great.I'm not sure what to suggest - I guess it could be some kind of permissions issue? You could try adding an external USB BLE dongle and see if that helps at all.
A workaround would be to install the Espruino command-line tools:
- install Node.js 8 (not 10 - 'noble' Bluetooth LE is still broken in that)
npm install espruino
espruino -d Pixl --ide 8080
to connect to the first Pixl.js device that's found- Go to
http://localhost:8080/
in the browser to get the IDE
This is 100% a Web Bluetooth/Chrome issue though (rather than being specific to the Espruino IDE), so perhaps the Chrome devs would have some ideas about it.
I'm on Mint 19.1 (which is basically Ubuntu 18.04) and it works fine on 2 separate devices. I'd have thought that I'd have heard more from people if it was broken for everyone in Ubuntu 19 though.
- install Node.js 8 (not 10 - 'noble' Bluetooth LE is still broken in that)
-
• #8
Good monring Gordon,
I will receive an external dongle by end of week to make more test.
I will also try the NPM way you suggest and keep you informed. :)Thank you so much for your answers.
-
• #9
Well well well,
Not good.
As far as i can see:plonky@macronetmonk:~/node_modules/espruino/bin$ ./espruino-cli.js --list Espruino Command-line Tool 0.1.27 ----------------------------------- PORTS:
No port listed.
I can still connect using gatttool, but using a random address on computer side.
If i use a public address, it doesn't work at all:plonky@macronetmonk:~/node_modules/espruino/bin$ gatttool -t random -b FA:EE:05:A7:C7:34 -I [FA:EE:05:A7:C7:34][LE]> connect Attempting to connect to FA:EE:05:A7:C7:34 Connection successful Notification handle = 0x000d value: 3c 2d 20 54 65 72 6d 69 6e 61 6c 0d 0a 3e [FA:EE:05:A7:C7:34][LE]> (gatttool:18294): GLib-WARNING **: 17:06:47.993: Invalid file descriptor. plonky@macronetmonk:~/node_modules/espruino/bin$ man gatttool plonky@macronetmonk:~/node_modules/espruino/bin$ gatttool -t public -b FA:EE:05:A7:C7:34 -I [FA:EE:05:A7:C7:34][LE]> connect Attempting to connect to FA:EE:05:A7:C7:34 [FA:EE:05:A7:C7:34][LE]> plonky@macronetmonk:~/node_modules/espruino/bin$
-
• #10
Ahh - https://www.npmjs.com/package/espruino might be handy.
Check that
which node
returns something, and then do:sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
That gives Node.js the permissions to access Bluetooth without running as a superuser.
Can you also try
./espruino-cli.js --list --verbose
and see if it shows any errors?Might be that somehow NPM hasn't installed the relevant Bluetooth stuff (and sorry, I should have mentioned you can do
npm install espruino -g
to install it globally so you don't have to manually execute the JS file. -
• #11
plonky@macronetmonk:~/node_modules/espruino/bin$ sudo setcap cap_net_raw+eip $(eval readlink -f `which node`) [sudo] password for plonky: plonky@macronetmonk:~/node_modules/espruino/bin$ ./espruino-cli.js --list Espruino Command-line Tool 0.1.27 ----------------------------------- PORTS: fa:ee:05:a7:c7:34 (Pixl.js c734) plonky@macronetmonk:~/node_modules/espruino/bin$ ./espruino-cli.js --list --verbose 0.1.27 Espruino Command-line Tool 0.1.27 ----------------------------------- Acorn library not found - you'll need it for compiled code Found /home/plonky/node_modules/espruino/libs/targz.js Found /home/plonky/node_modules/espruino/libs/utf8.js Found /home/plonky/node_modules/espruino/espruino.js Found /home/plonky/node_modules/espruino/core/codeWriter.js Found /home/plonky/node_modules/espruino/core/config.js Found /home/plonky/node_modules/espruino/core/env.js Found /home/plonky/node_modules/espruino/core/flasher.js Found /home/plonky/node_modules/espruino/core/modules.js Found /home/plonky/node_modules/espruino/core/notifications.js Found /home/plonky/node_modules/espruino/core/serial.js Found /home/plonky/node_modules/espruino/core/serial_chrome_serial.js No chrome.serial - Chrome Serial disabled Found /home/plonky/node_modules/espruino/core/serial_chrome_socket.js No chrome.sockets - Chrome Socket disabled Found /home/plonky/node_modules/espruino/core/serial_frame.js Found /home/plonky/node_modules/espruino/core/serial_noble.js Found /home/plonky/node_modules/espruino/core/serial_node_serial.js Found /home/plonky/node_modules/espruino/core/serial_node_socket.js Found /home/plonky/node_modules/espruino/core/serial_web_audio.js Found /home/plonky/node_modules/espruino/core/serial_web_bluetooth.js Found /home/plonky/node_modules/espruino/core/serial_websocket_local.js Found /home/plonky/node_modules/espruino/core/serial_websocket_relay.js Found /home/plonky/node_modules/espruino/core/serial_winnus.js Not on Windows, Winnus not needed Found /home/plonky/node_modules/espruino/core/terminal.js Found /home/plonky/node_modules/espruino/core/utils.js Found /home/plonky/node_modules/espruino/plugins/assembler.js Found /home/plonky/node_modules/espruino/plugins/boardJSON.js Found /home/plonky/node_modules/espruino/plugins/compiler.js Found /home/plonky/node_modules/espruino/plugins/getGitHub.js Found /home/plonky/node_modules/espruino/plugins/localModules.js Found /home/plonky/node_modules/espruino/plugins/minify.js Found /home/plonky/node_modules/espruino/plugins/saveOnSend.js Found /home/plonky/node_modules/espruino/plugins/setTime.js Found /home/plonky/node_modules/espruino/plugins/unicode.js Loading UTF8 with require Found /home/plonky/node_modules/espruino/plugins/versionChecker.js Initialising CodeWriter Initialising Config Initialising Env Initialising Flasher Initialising Modules Initialising Notifications Initialising Serial - Initialising Serial Noble Bluetooth LE - Initialising Serial Node Serial - Initialising Serial Node Socket - Initialising Serial Web Bluetooth Initialising Utils Initialising Status Initialising Assembler Initialising BoardJSON Initialising Compiler Initialising GetGitHub Initialising LocalModules Initialising Minify Initialising SaveOnSend Initialising SetTime Initialising Unicode Initialising VersionChecker Initialising CoreModules Searching for serial ports... Noble: getPorts - not initialised No navigator.bluetooth - Web Bluetooth not enabled Noble: stateChange -> poweredOn Noble: Disable Web Bluetooth as we have Noble instead Noble: Starting scan Noble: Found UART device: Pixl.js c734 fa:ee:05:a7:c7:34 Noble: Found device: TNT_BW f0:ab:54:4b:3f:8c Noble: Found device: TNT_BW f0:ab:54:4b:3f:8c PORTS: fa:ee:05:a7:c7:34 (Pixl.js c734)
looks better ! :)
-
• #12
And there we go :
plonky@macronetmonk:~/node_modules/espruino/bin$ ./espruino-cli.js -d Pixl --ide 8080 Espruino Command-line Tool 0.1.27 ----------------------------------- Searching for device named "Pixl" Found "Pixl.js c734" ("fa:ee:05:a7:c7:34") Connecting to 'fa:ee:05:a7:c7:34' Connected Web IDE is now available on http://localhost:8080 Web IDE Connection accepted. >< << {"VERSION":"2v01","GIT_COMMIT":"748a4d3","BOARD":"PIXLJS","FLASH":524288,"RAM":65536,"SERIAL":"1e21d7bf-3480018d","CONSOLE":"Bluetooth","MODULES":"Flash,Storage,heatshrink,fs,net,dgram,http,NetworkJS,WIZnet,crypto,neopixel,graphical_menu","EXPTR":536882356} >> > >
-
• #14
That's great! Glad you got something working!
I'd still be interested to know why it doesn't work for you with Chrome though, if you ever find it out.
-
• #15
Well, i try using my little laptop, still on ubuntu 19.04, and while i didnt face same issue, i still encounter new one :
Loaded code from storage. Handling URL "https://www.espruino.com/ide/" Couldn't connect to wss://localhost:31234 - disabling websockets for this session ERROR: getURL("/serial/ports") error : Not Found /serial/ports doesn't exist - disabling WebSocket support ERROR: serial_frame: getPorts timeout, disabling >>> Connecting... Set Slow Write = true serviceworker> active BT> ERROR: NotFoundError: User cancelled the requestDevice() chooser. ERROR: [notify_error] Connection Failed. >>> Connection Failed. >>> Connecting... Set Slow Write = true >>> Connecting to Pixl.js c734 BT> Device Name: Pixl.js c734 BT> Device ID: MckzoCJ/zg3Wdi0vtHM5mg== BT> ERROR: NetworkError: Connection failed for unknown reason. ERROR: [notify_error] Connection Failed. >>> Connection Failed.
-
• #16
I added -E to bluetoothd command to enable experimental mode:
Loaded code from storage. serviceworker> active Handling URL "https://www.espruino.com/ide/" Couldn't connect to wss://localhost:31234 - disabling websockets for this session ERROR: getURL("/serial/ports") error : Not Found /serial/ports doesn't exist - disabling WebSocket support ERROR: serial_frame: getPorts timeout, disabling >>> Connecting... Set Slow Write = true >>> Connecting to Pixl.js c734 BT> Device Name: Pixl.js c734 BT> Device ID: MckzoCJ/zg3Wdi0vtHM5mg== >>> Connected to BLE BT> Connected BT> Disconnected (gattserverdisconnected) ERROR: [notify_error] Connection Failed. >>> Connection Failed. BT> ERROR: NetworkError: GATT Server is disconnected. Cannot retrieve services. (Re)connect first with `device.gatt.connect`.
Good evening,
Im able to connect to device using gatttool command
But im unable to connect to it using web ide app from chromium, the device is not appearing when i try to connect.
It works very well from the same computer station, when im using windows10, i succed to connect and dev with windows chrome. But when i switch back to ubuntu (latest version 19.*) not possible to connect.
anybody had faced this issue before, and how did you solved it ?