mappum / node-hackrf Goto Github PK
View Code? Open in Web Editor NEW:radio: Control a HackRF device (e.g. Jawbreaker, HackRF One, or Rad1o) from Node.js
:radio: Control a HackRF device (e.g. Jawbreaker, HackRF One, or Rad1o) from Node.js
If one tries to use this module without a connected HackRF device, it crashes.
1] 52545 segmentation fault ./node_modules/.bin/noflo-nodejs
Would it be possible to expose sweep mode to node-hackrf?
Hi,
Nice project here but quite old now.
I got a V8 deprecated error:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info find Python using Python version 2.7.16 found at "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
gyp info spawn /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
gyp info spawn args [
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/7s4r/Projects/radiocar/node_modules/hackrf/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/7s4r/Library/Caches/node-gyp/12.19.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/7s4r/Library/Caches/node-gyp/12.19.0',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/7s4r/Library/Caches/node-gyp/12.19.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/7s4r/Projects/radiocar/node_modules/hackrf',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CC(target) Release/obj.target/libusb/deps/libusb/libusb/core.o
../deps/libusb/libusb/core.c:2241:35: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
if (header_len < 0 || header_len >= sizeof(buf)) {
~~~~~~~~~~ ^ ~~~~~~~~~~~
../deps/libusb/libusb/core.c:2250:44: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
if (text_len < 0 || text_len + header_len >= sizeof(buf)) {
~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~
2 warnings generated.
CC(target) Release/obj.target/libusb/deps/libusb/libusb/descriptor.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/hotplug.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/io.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/strerror.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/sync.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/os/poll_posix.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/os/threads_posix.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/os/darwin_usb.o
../deps/libusb/libusb/os/darwin_usb.c:344:3: warning: 'objc_registerThreadWithCollector' is deprecated: it does nothing. Define OBJC_SILENCE_GC_DEPRECATIONS=1 to temporarily silence this diagnostic. [-Wdeprecated-declarations]
objc_registerThreadWithCollector();
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/objc/objc-auto.h:243:1: note: 'objc_registerThreadWithCollector' has been explicitly marked deprecated here
OBJC_GC_DEPRECATED("it does nothing")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/objc/objc-auto.h:45:55: note: expanded from macro 'OBJC_GC_DEPRECATED'
# define OBJC_GC_DEPRECATED(message) __attribute__((deprecated(message ". Define OBJC_SILENCE_GC_DEPRECATIONS=1 to temporarily silence this diagnostic.")))
^
../deps/libusb/libusb/os/darwin_usb.c:1281:27: warning: expression which evaluates to zero treated as a null pointer constant of type 'IOUSBInterfaceInterface550 **' (aka 'struct IOUSBInterfaceStruct550 **') [-Wnon-literal-null-conversion]
cInterface->interface = IO_OBJECT_NULL;
^~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOTypes.h:167:25: note: expanded from macro 'IO_OBJECT_NULL'
#define IO_OBJECT_NULL ((io_object_t) 0)
^~~~~~~~~~~~~~~~~
2 warnings generated.
LIBTOOL-STATIC Release/usb.a
CC(target) Release/obj.target/libhackrf/src/hackrf.o
../src/hackrf.c:922:47: warning: implicit conversion from enumeration type 'transceiver_mode_t' to different enumeration type 'hackrf_transceiver_mode' [-Wenum-conversion]
result = hackrf_set_transceiver_mode(device, TRANSCEIVER_MODE_CPLD_UPDATE);
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
LIBTOOL-STATIC Release/hackrf.a
CXX(target) Release/obj.target/hackrf/src/bindings.o
../src/bindings.cc:9:36: error: too few arguments to function call, single argument 'context' was not specified
int index = info[0]->Uint32Value();
~~~~~~~~~~~~~~~~~~~~ ^
/Users/7s4r/Library/Caches/node-gyp/12.19.0/include/node/v8.h:2707:3: note: 'Uint32Value' declared here
V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
^
/Users/7s4r/Library/Caches/node-gyp/12.19.0/include/node/v8config.h:368:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/bindings.cc:30:13: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
device->Set(Nan::New("boardId").ToLocalChecked(), Nan::New(list->usb_board_ids[i]));
^
/Users/7s4r/Library/Caches/node-gyp/12.19.0/include/node/v8.h:3498:3: note: 'Set' has been explicitly marked deprecated here
V8_DEPRECATED("Use maybe version",
^
/Users/7s4r/Library/Caches/node-gyp/12.19.0/include/node/v8config.h:328:29: note: expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/bindings.cc:31:13: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
device->Set(Nan::New("usbIndex").ToLocalChecked(), Nan::New(list->usb_device_index[i]));
^
/Users/7s4r/Library/Caches/node-gyp/12.19.0/include/node/v8.h:3498:3: note: 'Set' has been explicitly marked deprecated here
V8_DEPRECATED("Use maybe version",
^
/Users/7s4r/Library/Caches/node-gyp/12.19.0/include/node/v8config.h:328:29: note: expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/bindings.cc:35:13: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
device->Set(Nan::New("serialNumber").ToLocalChecked(), serialNumber);
^
/Users/7s4r/Library/Caches/node-gyp/12.19.0/include/node/v8.h:3498:3: note: 'Set' has been explicitly marked deprecated here
V8_DEPRECATED("Use maybe version",
^
/Users/7s4r/Library/Caches/node-gyp/12.19.0/include/node/v8config.h:328:29: note: expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/bindings.cc:37:14: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
devices->Set(i, device);
^
/Users/7s4r/Library/Caches/node-gyp/12.19.0/include/node/v8.h:3507:3: note: 'Set' has been explicitly marked deprecated here
V8_DEPRECATED("Use maybe version",
^
/Users/7s4r/Library/Caches/node-gyp/12.19.0/include/node/v8config.h:328:29: note: expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/bindings.cc:45:14: error: no template named 'Handle'
void InitAll(Handle<Object> exports) {
^
4 warnings and 2 errors generated.
make: *** [Release/obj.target/hackrf/src/bindings.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:314:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/7s4r/Projects/radiocar/node_modules/hackrf
gyp ERR! node -v v12.19.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
The callback is listed as optional, but if it's not given the Node process will crash. The optional callback works fine with device.setFrequency
, but I haven't been able to figure out what the difference is between the two implementations (my C-foo isn't all that great). I have't checked the other optional callbacks but, maybe it should be checked if they are in fact optional or not as well.
There is no doubt this is a really cool project. But when i tried to install it i ran into this error.
/usr/bin/hackrf -> /usr/lib/node_modules/hackrf/bin.js
> [email protected] install /usr/lib/node_modules/hackrf
> node-gyp rebuild
make: Entering directory `/usr/lib/node_modules/hackrf/build'
CC(target) Release/obj.target/libusb/deps/libusb/libusb/core.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/descriptor.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/hotplug.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/io.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/strerror.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/sync.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/os/poll_posix.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/os/threads_posix.o
../deps/libusb/libusb/os/threads_posix.c:24:0: warning: "_GNU_SOURCE" redefined [enabled by default]
# define _GNU_SOURCE
^
<command-line>:0:0: note: this is the location of the previous definition
CC(target) Release/obj.target/libusb/deps/libusb/libusb/os/linux_usbfs.o
CC(target) Release/obj.target/libusb/deps/libusb/libusb/os/linux_netlink.o
../deps/libusb/libusb/os/linux_netlink.c: In function ‘linux_netlink_read_message’:
../deps/libusb/libusb/os/linux_netlink.c:311:5: warning: pointer targets in passing argument 1 of ‘linux_netlink_parse’ differ in signedness [-Wpointer-sign]
&busnum, &devaddr);
^
../deps/libusb/libusb/os/linux_netlink.c:196:12: note: expected ‘char *’ but argument is of type ‘unsigned char *’
static int linux_netlink_parse(char *buffer, size_t len, int *detached, const char **sys_name,
^
AR(target) Release/obj.target/deps/usb.a
COPY Release/usb.a
CC(target) Release/obj.target/libhackrf/src/hackrf.o
../src/hackrf.c: In function ‘hackrf_open_usb’:
../src/hackrf.c:421:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘ssize_t’ [-Wformat=]
printf("Number of USB devices: %ld\n", list_length);
^
../src/hackrf.c: In function ‘hackrf_set_freq_explicit’:
../src/hackrf.c:1046:2: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
if (if_freq_hz < 2150000000 || if_freq_hz > 2750000000) {
^
../src/hackrf.c:1046:2: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
AR(target) Release/obj.target/hackrf.a
COPY Release/hackrf.a
CXX(target) Release/obj.target/hackrf/src/bindings.o
../src/bindings.cc:8:20: error: ‘FunctionCallbackInfo’ does not name a type
void Devices(const FunctionCallbackInfo<Value>& args) {
^
../src/bindings.cc:8:20: error: ISO C++ forbids declaration of ‘parameter’ with no type [-fpermissive]
../src/bindings.cc:8:40: error: expected ‘,’ or ‘...’ before ‘<’ token
void Devices(const FunctionCallbackInfo<Value>& args) {
^
../src/bindings.cc: In function ‘void Devices(int)’:
../src/bindings.cc:10:28: error: no matching function for call to ‘v8::HandleScope::HandleScope(v8::Isolate*&)’
HandleScope scope(isolate);
^
../src/bindings.cc:10:28: note: candidates are:
In file included from /home/plasmashadow/.node-gyp/0.10.40/src/node.h:62:0,
from ../node_modules/nan/nan.h:24,
from ../src/bindings.cc:1:
/home/plasmashadow/.node-gyp/0.10.40/deps/v8/include/v8.h:473:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
HandleScope(const HandleScope&);
^
/home/plasmashadow/.node-gyp/0.10.40/deps/v8/include/v8.h:473:3: note: no known conversion for argument 1 from ‘v8::Isolate*’ to ‘const v8::HandleScope&’
/home/plasmashadow/.node-gyp/0.10.40/deps/v8/include/v8.h:448:3: note: v8::HandleScope::HandleScope()
HandleScope();
^
/home/plasmashadow/.node-gyp/0.10.40/deps/v8/include/v8.h:448:3: note: candidate expects 0 arguments, 1 provided
../src/bindings.cc:34:3: error: ‘args’ was not declared in this scope
args.GetReturnValue().Set(Device::NewInstance(device));
^
../src/bindings.cc: In function ‘void InitAll(v8::Handle<v8::Object>)’:
../src/bindings.cc:41:46: error: no matching function for call to ‘SetMethod(v8::Handle<v8::Object>&, const char [8], void (&)(int))’
NODE_SET_METHOD(exports, "devices", Devices);
^
../src/bindings.cc:41:46: note: candidate is:
In file included from ../node_modules/nan/nan.h:24:0,
from ../src/bindings.cc:1:
/home/plasmashadow/.node-gyp/0.10.40/src/node.h:112:6: note: template<class target_t> void node::SetMethod(target_t, const char*, v8::InvocationCallback)
void SetMethod(target_t obj, const char* name,
^
/home/plasmashadow/.node-gyp/0.10.40/src/node.h:112:6: note: template argument deduction/substitution failed:
../src/bindings.cc:41:46: note: cannot convert ‘Devices’ (type ‘void(int)’) to type ‘v8::InvocationCallback {aka v8::Handle<v8::Value> (*)(const v8::Arguments&)}’
NODE_SET_METHOD(exports, "devices", Devices);
^
make: *** [Release/obj.target/hackrf/src/bindings.o] Error 1
make: Leaving directory `/usr/lib/node_modules/hackrf/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.13.0-61-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/hackrf
gyp ERR! node -v v0.10.40
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the hackrf package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls hackrf
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-61-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "hackrf"
npm ERR! cwd /home/plasmashadow
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.