Closed nospam2k closed 3 years ago
Solution:
sudo vi /etc/udev/rules.d/garmin-ant2.rules
Add the following line with the correct Vendor and product ids.
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fcf", ATTRS{idProduct}=="1008", RUN+="/sbin/modprobe usbserial vendor=0x0fcf product=0x1008", MODE="0666", OWNER="pi", GROUP="root"
You will need to unplug and replug the USB stick to activate.
var Ant = require('ant-plus'); var stick = new Ant.GarminStick2(); var sensor = new Ant.HeartRateSensor(stick); if (!stick.open()) { console.log('Stick not found!'); }
Returns:
/home/pi/.node-red/node_modules/usb/usb.js:48 this.__close() ^
Error: Can't close device with a pending request at Device.usb.Device.close (/home/pi/.node-red/node_modules/usb/usb.js:48:7) at GarminStick2.USBDriver.open (/home/pi/.node-red/node_modules/ant-plus/build/ant.js:352:29) at Object. (/home/pi/.node-red/test.js:15:12)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47