Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible upstream issues with noble causing No compatible USB Bluetooth 4.0 device found! #168

Closed
OwenBrotherwood opened this issue Feb 14, 2017 · 15 comments

Comments

@OwenBrotherwood
Copy link

OwenBrotherwood commented Feb 14, 2017

http://forum.espruino.com/comments/13473028/ for some background.
Possible problems with noble noble/noble#553

Installation: Windows 10 with Zadig giving No compatible USB Bluetooth 4.0 device found! with github clone (and in the IDE console and in downloaded Native)

image

using C:\nwjs\nwjs-sdk-v0.20.1-win-x64 (there may be a need to debug ...)

git clone --recursive https://github.com/espruino/EspruinoWebI­DE.git
npm install

C:\source\repos\github\espruino\Espruino­WebIDE\node_modules\noble>node examples\advertisement-discovery.js
C:\source\repos\github\espruino\Espruino­WebIDE\node_modules\bluetooth-hci-socket­\lib\usb.js:70
    throw new Error('No compatible USB Bluetooth 4.0 device found!');
    ^
Error: No compatible USB Bluetooth 4.0 device found!
    at BluetoothHciSocket.bindUser (C:\source\repos\github\espruino\Espruin­oWebIDE\node_modules\bluetooth-hci-socke­t\lib\usb.js:70:11)
    at BluetoothHciSocket.bindRaw (C:\source\repos\github\espruino\Espruin­oWebIDE\node_modules\bluetooth-hci-socke­t\lib\usb.js:28:8)
    at Hci.init (C:\source\repos\github\espruino\Espruin­oWebIDE\node_modules\noble\lib\hci-socke­t\hci.js:101:35)
    at NobleBindings.init (C:\source\repos\github\espruino\Espruin­oWebIDE\node_modules\noble\lib\hci-socke­t\bindings.js:82:13)
    at new Noble (C:\source\repos\github\espruino\Espruin­oWebIDE\node_modules\noble\lib\noble.js:­50:18)
    at Object.<anonymous> (C:\source\repos\github\espruino\Espruin­oWebIDE\node_modules\noble\index.js:4:18­)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)

C:\source\repos\github\espruino\EspruinoWebIDE>rmdir /S node_modules
C:\source\repos\github\espruino\EspruinoWebIDE>node install ..\..\sandeepmistry\node-bluetooth-hci-socket
C:\source\repos\github\espruino\EspruinoWebIDE>node install ..\..\sandeepmistry\nobel
npm install
C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\noble>node examples\advertisement-discovery.js
peripheral discovered (bc1485e88e81 with address <bc:14:85:e8:8e:81, public>, connectable true, RSSI -62:
        hello my local name is:
                [TV] UE48J5515
        can I interest you in any of the following advertised services:
                []
        here is my manufacturer data:
                "7500420401018fbc1485e88e81be148564cf4024000000000000"

peripheral discovered (dff5a5ec431b with address <df:f5:a5:ec:43:1b, random>, connectable true, RSSI -45:
        hello my local name is:
                Puck.js 431b
        can I interest you in any of the following advertised services:
                ["6e400001b5a3f393e0a9e50e24dcca9e"]

Edit
EspruinoWebIDE log: going for EspruinoTools tests

We have chrome.serial - not using 'serialport' module
'noble' module couldn't be loaded, no node.js Bluetooth Low Energy  Error: A dynamic link library (DLL) initialization routine failed. \\?

Edit

EspruinoTools does not "see" ble at the moment

C:\source\repos\github\espruino\EspruinoWebIDE>npm install -g EspruinoTools
C:\source\repos\github\espruino\EspruinoWebIDE>c:\Users\owen\AppData\Roaming\npm\espruino.cmd
C:\source\repos\github\espruino\EspruinoWebIDE>c:\Users\owen\AppData\Roaming\npm\espruino.cmd --list
Espruino Command-line Tool 0.0.30
-----------------------------------

PORTS:
  COM3 (Microsoft)

C:\source\repos\github\espruino\EspruinoWebIDE\EspruinoTools>rmdir /s node_modules
C:\source\repos\github\espruino\EspruinoWebIDE\EspruinoTools>npm install ..\..\..\sandeepmistry\node-bluetooth-hci-socket
C:\source\repos\github\espruino\EspruinoWebIDE\EspruinoTools>npm install ..\..\..\sandeepmistry\noble
C:\source\repos\github\espruino\EspruinoWebIDE\EspruinoTools>npm install
C:\source\repos\github\espruino\EspruinoWebIDE\EspruinoTools>node bin\espruino-cli.js --list
Espruino Command-line Tool 0.0.30
-----------------------------------

PORTS:
  COM3 (Microsoft)
  df:f5:a5:ec:43:1b (Puck.js 431b)

EspruinoWebIDE still giving same error: dive into nw.js ?????????????????????????????????????????????????

We have chrome.serial - not using 'serialport' module
'noble' module couldn't be loaded, no node.js Bluetooth Low Energy  Error: A dynamic link library (DLL) initialization routine failed. \\?

Edit:
My only point of reference at this time is http://docs.nwjs.io/en/latest/For%20Users/Debugging%20with%20DevTools/

Edit
Doesn't work: possible disablement enablement needed

Open Developer Tools
DevTools can be opened with keyboard shortcut F12 on Windows and Linux or ⌘+⌥+i on Mac.

Edit:
Guessing ...

  "window": {
    "title": "Espruino Native IDE",
    "toolbar": true,
    "frame": true,
    "show": true,
    "fullscreen": false,
    "width": 1024,
    "height": 600,
    "position": "center"
  },
  "//chromium-args": "--enable-web-bluetooth",
  "chromium-args": "--enable-logging=stderr --enable-web-bluetooth",
  "//2": "-------------------------------------------------------- NPM",
  

Edit:

[11696:14664:0214/192750.935:WARNING:push_messaging_service_factory.cc(30)] PushMessagingService could not be built because InstanceID is unexpectedly disabled
[11696:14664:0214/192751.537:INFO:CONSOLE(30)] "We have chrome.serial - not using 'serialport' module", source: chrome-extension://bipaijaoackljocodhjdhecjbfoajehf/js/core/settingsConsole.js (30)
[11696:14664:0214/192751.862:INFO:CONSOLE(30)] "'noble' module couldn't be loaded, no node.js Bluetooth Low Energy
", source: chrome-extension://bipaijaoackljocodhjdhecjbfoajehf/js/core/settingsConsole.js (30)
[11696:14664:0214/192751.922:INFO:CONSOLE(30)] "'winnus' module not found, no Windows Bluetooth Low Energy", source: chrome-extension://bipaijaoackljocodhjdhecjbfoajehf/js/core/settingsConsole.js (30)

Edit:
debugger/console at last
C:\source\repos\github\espruino\EspruinoWebIDE>nw --remote-debugging-port=9222 .

Edit:
image



OK: I now have a Windows 10 Zandig Installation with nw.js SDK and can debug under suggestions as to what to do.
ie: that is about as far as I go just now until I get some good idea as to what to do next


Edit:
OK: one doesn't learn anything by sitting around: diving into https://github.com/tessel/node-usb

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\source\\repos\\github\\nonolith\\node-usb\\src\\binding\\usb_bindings.node" "--module_name=usb_bindings" "--module_path=C:\\source\\repos\\github\\nonolith\\node-usb\\src\\binding"
gyp ERR! cwd C:\source\repos\github\nonolith\node-usb
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\source\repos\github\nonolith\node-usb\src\binding\usb_bindings.node --module_name=usb_bindings --module_path=C:\source\repos\github\nonolith\node-usb\src\binding' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\source\repos\github\nonolith\node-usb\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Windows_NT 10.0.14393
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\source\\repos\\github\\nonolith\\node-usb\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\source\repos\github\nonolith\node-usb
node-pre-gyp ERR! node -v v6.9.5
node-pre-gyp ERR! node-pre-gyp -v v0.6.33
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\source\repos\github\nonolith\node-usb\src\binding\usb_bindings.node --module_name=usb_bindings --module_path=C:\source\repos\github\nonolith\node-usb\src\binding' (1)

And a lot of other lovly, lovly stuff that ended me here: node-usb/node-usb#109

@OwenBrotherwood
Copy link
Author

Sandeep is kindly investigating noble/noble#553 (comment)

In the meantime, I have to investigate winnus: I give a call out if stuch, otherwise I believe I know what I am doing :)

\C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\src\binding\usb_bindings.node
'winnus' module not found, no Windows Bluetooth Low Energy Error: error: 126\\?\C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\winnus\build\Release\winnus.node

@OwenBrotherwood
Copy link
Author

I will write an example for winnus to make something like https://github.com/sandeepmistry/noble/blob/master/examples/advertisement-discovery.js which has helped me ensure the stack under noble works
ie ensure that winnus is working correctly within it's dependancies

@gfwilliams
Copy link
Member

Winnus is purely for Windows 10 BLE - so if you're trying to debug Windows 7 there is no need to look into it.

@OwenBrotherwood
Copy link
Author

OwenBrotherwood commented Feb 16, 2017

OK: Status on my Windows 7 VM is as below
I start enabling more debug's with access to nw debug via port and obtain more info.
I update this issue comment with progress and if stuck, a new comment as call out

SEARCHING... NO PORTS FOUND

We have chrome.serial - not using 'serialport' module
'noble' module couldn't be loaded, no node.js Bluetooth Low Energy  Error: Systemet kan ikke finde meddelelsesteksten for meddelelsesnummer 0x%1 i meddelelsesfilen for %2. \\?\C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\src\binding\usb_bindings.node
'winnus' module not found, no Windows Bluetooth Low Energy Error: error: 126\\?\C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\winnus\build\Release\winnus.node
serial_audio: Audio Sample rate : 44100
serial_audio: Audio Serial Baud 9600 Bit time 4.59375
No navigator.bluetooth - Web Bluetooth not enabled
GET chrome.storage.sync = undefined
Initialising SettingsConsole

nw . --remote-debugging-port=9222

"chromium-args": "--enable-logging=stderr",

Back to nobel tests


[1496:1976:0216/083207.889:INFO:CONSOLE(30)] "'noble' module couldn't be loaded,
 no node.js Bluetooth Low Energy
C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\noble>node examples\
advertisement-discovery.js
peripheral discovered (627a3ebae2f0 with address <62:7a:3e:ba:e2:f0, random>, co
nnectable true, RSSI -73:
        hello my local name is:
                undefined
        can I interest you in any of the following advertised services:
                []
        here is my manufacturer data:
                "4c000c0e006c640f1777c7cedd32fb6e3f5110020b00"

peripheral discovered (dff5a5ec431b with address <df:f5:a5:ec:43:1b, random>, co
nnectable true, RSSI -71:
        hello my local name is:
                Puck.js 431b
        can I interest you in any of the following advertised services:
                ["6e400001b5a3f393e0a9e50e24dcca9e"]

image

@OwenBrotherwood
Copy link
Author

OwenBrotherwood commented Feb 16, 2017

I have done many things to get this far: all with reasonable care.
The status now is that sometimes I get a prompt with EspruinoTools, sometimes not.

Do I downgrade puck.js or pull the lattest puck.js code?

After input, I go back to node module hell.

In the meantime, I have done repeated node bin\espruino-cli --verbose
Without changing code, sometimes it works, other times not.

onAndOff.txt

@gfwilliams
Copy link
Member

Strange - not sure what to suggest. Stupid question - but is it close enough to the PC? It it's behind a wall or more than ~10m away it could be hard to connect to.

Have you tried the newest command-line tools from GitHub? Those can wait a little longer for a connection.

Also, you could use setAdvertising on your Puck when you do connect, and then really shorted the advertising interval - to 50ms or so - and see if that makes a difference?

I have a feeling that maybe some of the USB Bluetooth keys only listen on one channel (not all 3) which makes it very hard for them to connect

@OwenBrotherwood
Copy link
Author

No question is too stupid :)
puck.js close to PC
EspruinoTools are from fresh clone
I try and find how to setAdvertising. and edit this comment until next result/problem

@OwenBrotherwood
Copy link
Author

OwenBrotherwood commented Feb 16, 2017

Oops:
NOTE:

  • scan almost allways give a puck.js. It is the connecting after the scan that gives problems

ie


Found UART device: Puck.js 431b df:f5:a5:ec:43:1b
PORTS:
  df:f5:a5:ec:43:1b (Puck.js 431b)
Using first port, {"path":"df:f5:a5:ec:43:1b","description":"Puck.js 431b","
":"bluetooth"}
Connecting to 'df:f5:a5:ec:43:1b'
noble stopping scan
BT> Connecting
BT> ERROR Connecting
Unable to open device (connectionInfo=undefined)
Unable to connect!

And it is the failure of the connect after the scan that is "interesting"

@OwenBrotherwood
Copy link
Author

No comment required: I am ensuring I have a good base on Windows 10

C:\source\repos\github\espruino\winnus>node hello.js
[ { name: 'Puck.js 431b',
    address: 'df:f5:a5:ec:43:1b',
    path: '\\\\?\\bthledevice#{6e400001-b5a3-f393-e0a9-e50e24dcca9e}_dff5a5ec431b#8&2e011fae&0&000b#{6e400001-b5a3-f393-e0a9-e50e24dcca9e}' } ]
{ name: 'Puck.js 431b',
  address: 'df:f5:a5:ec:43:1b',
  path: '\\\\?\\bthledevice#{6e400001-b5a3-f393-e0a9-e50e24dcca9e}_dff5a5ec431b#8&2e011fae&0&000b#{6e400001-b5a3-f393-e0a9-e50e24dcca9e}' }
Connect
Error: BluetoothGATTSetDescriptorValue
    at Object.exports.connect (C:\source\repos\github\espruino\winnus\winnus.js:34:10)
    at Object.<anonymous> (C:\source\repos\github\espruino\winnus\hello.js:24:10)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:418:7)
    at startup (bootstrap_node.js:139:9)

I am not a full time programmer IRL: so this is cut and paste to give me context to test with.
There are probably inevitable mistakes and wrong assumptions: I'll get there

var winnus = require("./winnus");
var devices = null;
var device = null;
var errorCode = 0;

function connected(data){
  console.log("Got data "+JSON.stringify(data));  
}

errorCode++;
try {
  devices = winnus.getDevices();
  console.log(devices);
  device = devices[0];
  console.log(device);  
} catch (error) {
  console.error(error);
  process.exit(errorCode);  
}

errorCode++;
try {
  console.log("Connect");
  winnus.connect(device, function(data) {
    console.log("Got data "+JSON.stringify(data));
    process.exit(0);
  });  
} catch (error) {
  console.error(error);
  process.exit(errorCode);
}
winnus.write("Hello");

errorCode++;
setTimeout(function() {
  console.error("Timeout");
  try {
    winnus.disconnect();   
  } catch (error) {
    console.error(error);
  }
  process.exit(errorCode);
}, 1000);

Current release of nw.js dictates that the node v7.5.0 should be used, nw-gyp with nw.js and node-gyp for cmd line node (as far as I can see).
End game is a perfect EspruinoWebIDE from source for a future release of IDE where tests are primarily on Windows 10 with possible Windows 7 solution on request.
I doubt that chrome on Windows 10 get's to Connect to a Bluetooth device in the time frame that is perceived for the above.

Windows 10 with Intel Wireless Bluetooth 7265 0x8087 0x0a2a
nw.js v0.20.2
Node v7.5.0
Chromium 56.0.2924.87
commit hash: f3d0ed8-0d73593-a2ef613-1f1f729

@OwenBrotherwood
Copy link
Author

OwenBrotherwood commented Feb 18, 2017

Windows 10

If the puck.js has a low battery, it can advertise but not be connected to.
I changed the battery and got a cigar for this one:

C:\source\repos\github\espruino\winnus>node hello.js
[ { name: 'Puck.js 431b',
address: 'df:f5:a5:ec:43:1b',
path: '\\?\bthledevice#{6e400001-b5a3-f393-e0a9-e50e24dcca9e}_dff5a5ec431b#8&2e011fae&0&000b#{6e400001-b5a3-f393-e0a9-e50e24dcca9e}' } ]
{ name: 'Puck.js 431b',
address: 'df:f5:a5:ec:43:1b',
path: '\\?\bthledevice#{6e400001-b5a3-f393-e0a9-e50e24dcca9e}_dff5a5ec431b#8&2e011fae&0&000b#{6e400001-b5a3-f393-e0a9-e50e24dcca9e}' }
Connect
Got data "Hello"


Edit:
I document for github installation of IDE

image

@OwenBrotherwood
Copy link
Author

OwenBrotherwood commented Feb 18, 2017

Building EspruinoWebIDE from github: Windows 10 and puck.js ONLY (USB support problems)
Download:

And smoke a cigar
PR on request for the doc README.md



I regard this as good as I can now build for puck.js windows 10
BUT
BLOCKING issue for Windows 7 and usb with node-usb/node-usb#163

sandeep has a little refresh of npm as a problem for noble and bluetooth-hci-socket



Notes for next step:

The Jared Wilcurt @TheJaredWilcurt 02:30
@OwenBrotherwood
https://nwjs.io/blog/
Looks like either 0.18.1 or 0.18.2
it will be somewhere around Node v6.8.1 - 7.0.0
https://nwjs.io/blog/v0.18.2/
That will be the newest version of NW.js, pre-Node 7

Which almost fits this, unknown node version, from README.md nw-gyp rebuild --target=0.18.6 --arch=x64

need to find last nw version that supports node 6.X LTS to get usb working

https://nwjs.io/blog/v0.18.2/ is the last one before 7

@OwenBrotherwood
Copy link
Author

OwenBrotherwood commented Feb 18, 2017

Windows 10
node 6.8.1 https://nodejs.org/download/release/v6.8.1/
nw.js https://nwjs.io/blog/v0.18.2/ (based on node 6.8.1)

All node_modules ok: EXCEPT for usb which is still a painful experience
Next step is install nobel and bluetooth-hci-socket from github as I had forgotten to do this
Followed by node-usb from github

gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\owen\AppData\Roaming\npm\node_modules\nw-gyp\lib\configure.js:324:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\owen\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\bin\\nw-gyp.js" "rebuild" "--target=0.18.6" "--arch=x64"
gyp ERR! cwd C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb
gyp ERR! node -v v6.8.1
gyp ERR! nw-gyp -v v3.4.0
gyp ERR! not ok
'noble' module couldn't be loaded, no node.js Bluetooth Low Energy  Error: A dynamic link library (DLL) initialization routine failed. \\?\C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\src\binding\usb_bindings.node
'winnus' module not found, no Windows Bluetooth Low Energy Error: Module version mismatch. Expected 48, got 51.

Method for nw-gyp: for all binding.gyp in node_modules do nw-gyp rebuild --target=0.18.6 --arch=x64

C:\source\repos\github\espruino\EspruinoWebIDE\node_modules>ls -R */binding.gyp
bluetooth-hci-socket/binding.gyp  serialport/binding.gyp  usb/binding.gyp  websocket/binding.gyp  winnus/binding.gyp

C:\source\repos\github\espruino\EspruinoWebIDE\node_modules>cd bluetooth-hci-socket

C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\bluetooth-hci-socket>nw-gyp rebuild --target=0.18.6 --arch=x64

I have finally found a source for what I thought could be a next step, as the binding.gyp looked crazy.
node-usb/node-usb#109 (comment)

Modify binding.gyp and add the following to "variables":
'module_name': 'usb_bindings', 'module_path': './src/binding'
C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb>nw-gyp rebuild --target=0.18.6 --arch=x64 --msvs_version=2015
gyp info it worked if it ends with ok
gyp info using nw-gyp@3.4.0
gyp info using node@6.8.1 | win32 | x64
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\owen\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=2015',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\source\\repos\\github\\espruino\\EspruinoWebIDE\\node_modules\\usb\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\owen\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\owen\\.nw-gyp\\0.18.6\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\owen\\.nw-gyp\\0.18.6',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\owen\\AppData\\Roaming\\npm\\node_modules\\nw-gyp',
gyp info spawn args   '-Dnode_lib_file=nw.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\source\\repos\\github\\espruino\\EspruinoWebIDE\\node_modules\\usb',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '-Dv13=1',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\source\\repos\\github\\espruino\\EspruinoWebIDE\\node_modules\\usb\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  core.c
  descriptor.c
  hotplug.c
  io.c
C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: 't
imespec': 'struct' type redefinition (compiling source file ..\libusb\libusb\descriptor.c) [C:\source\repos\github\espr
uino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (com
  piling source file ..\libusb\libusb\descriptor.c)
C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: 't
imespec': 'struct' type redefinition (compiling source file ..\libusb\libusb\io.c) [C:\source\repos\github\espruino\Esp
ruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (com
  piling source file ..\libusb\libusb\io.c)
..\libusb\libusb\io.c(1227): warning C4244: '=': conversion from 'time_t' to 'long', possible loss of data [C:\source\r
epos\github\espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\io.c(1902): warning C4244: '=': conversion from 'time_t' to 'long', possible loss of data [C:\source\r
epos\github\espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\io.c(2435): warning C4244: '=': conversion from 'time_t' to 'long', possible loss of data [C:\source\r
epos\github\espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: 't
imespec': 'struct' type redefinition (compiling source file ..\libusb\libusb\core.c)C:\source\repos\github\espruino\Esp
ruinoWebIDE\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefinitio
n (compiling source file ..\libusb\libusb\hotplug.c) [C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\b
uild\libusb.vcxproj]

  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (com
  piling source file ..\libusb\libusb\hotplug.c)
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (com
  piling source file ..\libusb\libusb\core.c)
  strerror.c
  sync.c
  poll_windows.c
  threads_windows.c
C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: 't
imespec': 'struct' type redefinition (compiling source file ..\libusb\libusb\strerror.c) [C:\source\repos\github\esprui
no\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (com
  piling source file ..\libusb\libusb\strerror.c)
C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: 't
imespec': 'struct' type redefinition (compiling source file ..\libusb\libusb\sync.c) [C:\source\repos\github\espruino\E
spruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (com
  piling source file ..\libusb\libusb\sync.c)
  windows_usb.c
C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: 't
imespec': 'struct' type redefinition (compiling source file ..\libusb\libusb\os\threads_windows.c) [C:\source\repos\git
hub\espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (com
  piling source file ..\libusb\libusb\os\threads_windows.c)
..\libusb\libusb\os\threads_windows.c(194): warning C4244: '=': conversion from 'time_t' to 'long', possible loss of da
ta [C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\os\threads_windows.c(196): warning C4244: '=': conversion from 'const time_t' to 'long', possible loss
 of data [C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: 't
imespec': 'struct' type redefinition (compiling source file ..\libusb\libusb\os\poll_windows.c) [C:\source\repos\github
\espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (com
  piling source file ..\libusb\libusb\os\poll_windows.c)
C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: 't
imespec': 'struct' type redefinition (compiling source file ..\libusb\libusb\os\windows_usb.c) [C:\source\repos\github\
espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (com
  piling source file ..\libusb\libusb\os\windows_usb.c)
..\libusb\libusb\os\windows_usb.c(586): warning C4244: '=': conversion from '__int64' to 'unsigned int', possible loss
of data [C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\os\windows_usb.c(1017): warning C4996: 'GetVersionExA': was declared deprecated [C:\source\repos\githu
b\espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(433): note: see declaration of 'GetVersionExA'
..\libusb\libusb\os\windows_usb.c(1020): warning C4996: 'GetVersionExA': was declared deprecated [C:\source\repos\githu
b\espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(433): note: see declaration of 'GetVersionExA'
..\libusb\libusb\os\windows_usb.c(1423): warning C4244: '=': conversion from '__int64' to 'unsigned int', possible loss
 of data [C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\os\windows_usb.c(2558): warning C4018: '<': signed/unsigned mismatch [C:\source\repos\github\espruino\
EspruinoWebIDE\node_modules\usb\build\libusb.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\owen\AppData\Roaming\npm\node_modules\nw-gyp\lib\build.js:294:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\owen\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\bin\\nw-gyp.js" "rebuild" "--target=0.18.6" "--arch=x64" "--msvs_version=2015"
gyp ERR! cwd C:\source\repos\github\espruino\EspruinoWebIDE\node_modules\usb
gyp ERR! node -v v6.8.1
gyp ERR! nw-gyp -v v3.4.0
gyp ERR! not ok


Notes:

Windows 10 with no LIBUSB driver, just Windows BLE: it would be better to catch this error and give a shorter message as, in context, it causes a lot of error text and winnus is being used: caused me a bit of thought as to if important or not

Found C:\source\repos\github\espruino\EspruinoTools/core/serial_noble.js
'noble' module couldn't be loaded, no node.js Bluetooth Low Energy
 { Error: LIBUSB_ERROR_NOT_SUPPORTED

(Removed for brevity)

Initialising Serial
  - Initialising Serial Node Serial
  - Initialising Serial Windows NUS BLE #winnus . now I know where the name came from

Repeated above with same EspruinoCli but with LIBUSB (replace windows 10 driver and restart for good measure), no puck.js found (puck.js found again when windows 10 driver used)


Initialising Serial
  - Initialising Serial Noble
  - Initialising Serial Node Serial
  - Initialising Serial Windows NUS BLE
(Removed)
Searching for serial ports...
noble starting scan
noble starting scan
PORTS:
  COM3 (Microsoft)

@gfwilliams
Copy link
Member

When building the USB lib in Windows 10 I actually modified the windows header file - just seemed easier. After that the build works first time :)

I'm open to PRs that would trap certain errors and report them in a more helpful way...

@OwenBrotherwood
Copy link
Author

noble/noble#553 (comment)

Sandeep is releasing a new npm on it's way for node- bluetooth-hci-socket which will make life easier for additional bluetooth adapters,

@gfwilliams
Copy link
Member

Any news on this? Did the update fix the problems for you?

... or would it be possible to close this bug? I mean, on Windows 10 you shouldn't need noble anyway - and if winnus is reporting no device found then it's a driver issue rather than winnus' fault.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants