am43-ctrl
am43-ctrl copied to clipboard
What is problem? I don't know linux.
I don't know linux.
raspbian lite. installed nodejs, git, libusb, libudev. I tried nodejs 10.x and 12.x. same result.
=================================================== pi@raspberrypi:~ $ npm install https://github.com/binsentsu/am43-ctrl
[email protected] install /home/pi/node_modules/usb prebuild-install --verbose || node-gyp rebuild
prebuild-install info begin Prebuild-install version 5.3.3
prebuild-install info looking for cached prebuild @ /home/pi/.npm/_prebuilds/470134-usb-v1.6.3-node-v72-linux-arm.tar.gz
prebuild-install http request GET https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v72-linux-arm.tar.gz
prebuild-install http 404 https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v72-linux-arm.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=12.16.3 runtime=node arch=arm libc= platform=linux)
make: Entering directory '/home/pi/node_modules/usb/build'
CC(target) Release/obj.target/libusb/libusb/libusb/core.o
CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o
CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o
CC(target) Release/obj.target/libusb/libusb/libusb/io.o
CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o
CC(target) Release/obj.target/libusb/libusb/libusb/sync.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o
AR(target) Release/obj.target/usb.a
COPY Release/usb.a
CXX(target) Release/obj.target/usb_bindings/src/node_usb.o
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/node_usb.cc:1:
../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../node_modules/nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type]
, reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
^
In file included from ../src/node_usb.h:14,
from ../src/node_usb.cc:1:
../src/node_usb.cc: At global scope:
/home/pi/.cache/node-gyp/12.16.3/include/node/node.h:608:43: warning: cast between incompatible function types from ‘void ()(v8::Localv8::Object)’ to ‘node::addon_register_func’ {aka ‘void ()(v8::Localv8::Object, v8::Localv8::Value, void*)’} [-Wcast-function-type]
(node::addon_register_func) (regfunc),
^
/home/pi/.cache/node-gyp/12.16.3/include/node/node.h:642:3: note: in expansion of macro ‘NODE_MODULE_X’
NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
^~~~~~~~~~~~~
../src/node_usb.cc:95:1: note: in expansion of macro ‘NODE_MODULE’
NODE_MODULE(usb_bindings, Initialize)
^~~~~~~~~~~
../src/node_usb.cc: In function ‘void handleHotplug(std::pair<libusb_device*, libusb_hotplug_event>)’:
../src/node_usb.cc:151:58: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, const char*, int, v8::Localv8::Value)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(Nan::New(hotplugThis), "emit", 2, argv);
^
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/node_usb.cc:1:
../node_modules/nan/nan.h:1001:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
../src/node_usb.cc:151:58: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, const char, int, v8::Localv8::Value)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(Nan::New(hotplugThis), "emit", 2, argv);
^
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/node_usb.cc:1:
../node_modules/nan/nan.h:1001:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
In file included from ../src/node_usb.h:12,
from ../src/node_usb.cc:1:
/home/pi/.cache/node-gyp/12.16.3/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void ()(const v8::WeakCallbackInfonode::ObjectWrap&) ’:
/home/pi/.cache/node-gyp/12.16.3/include/node/node_object_wrap.h:85:78: required from here
/home/pi/.cache/node-gyp/12.16.3/include/node/v8.h:10226:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfonode::ObjectWrap::Callback’ {aka ‘void ()(const v8::WeakCallbackInfonode::ObjectWrap&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo
@abandonware/[email protected] install /home/pi/node_modules/@abandonware/bluetooth-hci-socket node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/abandonware/node-bluetooth-hci-socket/releases/download/0.5.3-5/binding-0.5.3-5-node-v72-linux-arm.tar.gz
node-pre-gyp WARN Pre-built binaries not found for @abandonware/[email protected] and [email protected] (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/home/pi/node_modules/@abandonware/bluetooth-hci-socket/build'
CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o
In file included from ../src/BluetoothHciSocket.cpp:8:
../../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../../nan/nan.h:2294:62: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type]
, reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
^
In file included from /home/pi/.cache/node-gyp/12.16.3/include/node/node_buffer.h:25,
from ../src/BluetoothHciSocket.cpp:7:
../src/BluetoothHciSocket.cpp: At global scope:
/home/pi/.cache/node-gyp/12.16.3/include/node/node.h:608:43: warning: cast between incompatible function types from ‘void ()(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void ()(v8::Localv8::Object)’} to ‘node::addon_register_func’ {aka ‘void ()(v8::Localv8::Object, v8::Localv8::Value, void)’} [-Wcast-function-type]
(node::addon_register_func) (regfunc),
^
/home/pi/.cache/node-gyp/12.16.3/include/node/node.h:642:3: note: in expansion of macro ‘NODE_MODULE_X’
NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
^~~~~~~~~~~~~
../src/BluetoothHciSocket.cpp:578:1: note: in expansion of macro ‘NODE_MODULE’
NODE_MODULE(binding, BluetoothHciSocket::Init);
^~~~~~~~~~~
SOLINK_MODULE(target) Release/obj.target/binding.node
COPY Release/binding.node
COPY /home/pi/node_modules/@abandonware/bluetooth-hci-socket/lib/binding/binding.node
TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/home/pi/node_modules/@abandonware/bluetooth-hci-socket/build'
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
- [email protected] added 71 packages from 50 contributors, updated 1 package and audited 771 packages in 47.472s
1 package is looking for funding
run npm fund
for details
found 0 vulnerabilities
pi@raspberrypi:~ $ sudo am43ctrl sudo: am43ctrl: command not found pi@raspberrypi:~ $ sudo am43-ctrl sudo: am43-ctrl: command not found pi@raspberrypi:~ $ sudo am43ctrl 02:XX:XX:XX:XX:XX sudo: am43ctrl: command not found
================================================= what is problem?
cd into node_modules/.bin run by using: sudo ./am43ctrl … like in readme.
pi@raspberrypi:~/node_modules/.bin $ sudo ./am43ctrl 02:xx:xx:xx:xx:xx am43* ERROR: Neither --express-port or --mqtt-url supplied, nothing to do +0ms Usage: am43ctrl MAC1 MAC2 --express-port 3000 --url [mqtt|ws][s]://yourbroker.example.com
Options: --help Show help [boolean] --version Show version number [boolean] -d, --debug Enable debug logging [boolean] -l, --express-port Port for express web server (if unset, express will not startup) [number] --url, --mqtt-url MQTT broker URL --topic, --mqtt-base-topic Base topic for MQTT [default: "homeassistant"] -p, --mqtt-password Password for MQTT (if not specified as an argument, will prompt for password at startup) -u, --mqtt-username Username for MQTT
Examples: am43ctrl MAC1 MAC2 --url [broker_url] Connect to devices with specific IDs only, publish to MQTT pi@raspberrypi:~/node_modules/.bin $
pi@raspberrypi:~/node_modules/.bin $ sudo ./am43ctrl 02:xx:xx:xx:xx:xx -l 3000 am43* scanning for 1 device(s) [ '02xxxxxxxxxx' ] +0ms pi@raspberrypi:~/node_modules/.bin $
==================== Is it OK??
May I piggyback on this issue? I though I knew linux but this nodejs and npm is all new territory. After many hours of research, I've managed to get am43ctrl to install but have the following error when trying to run it:
root@HS3Pi3v5:~/node_modules/.bin# ./am43ctrl
/root/node_modules/@abandonware/noble/lib/hci-socket/hci.js:74
this._socket = new BluetoothHciSocket();
^
Error: EAFNOSUPPORT, Address family not supported by protocol
at new Hci (/root/node_modules/@abandonware/noble/lib/hci-socket/hci.js:74:18)
at new NobleBindings (/root/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:25:15)
at Object.<anonymous> (/root/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:546:18)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
root@HS3Pi3v5:~/node_modules/.bin# node --version
v8.17.0