From fba22599d2ce386517c5c7f93403e0b3a4c92877 Mon Sep 17 00:00:00 2001 From: Arturs Artamonovs Date: Wed, 8 Mar 2023 18:46:54 +0000 Subject: Fix the airspyhf_rx, update README --- .gitignore | 1 + README.md | 42 +++++++++++++++++++++++++++++++++++++++++- airspyhf/libairspyhf.py | 2 +- airspyhf_rx.py | 10 ++++------ test.py | 5 +---- 5 files changed, 48 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 77f5cbe..6342420 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea airspyhf/__pycache__/ +*.wav \ No newline at end of file diff --git a/README.md b/README.md index 50cd170..89cffee 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,45 @@ Python wrapper of airspyhf library https://github.com/airspy/airspyhf.git Project webpage main.lv +main project page http://main.lv +cgit source viewer http://git.main.lv/cgit.cgi/pyairspyhf.git -http://git.main.lv/cgit.cgi/pyairspyhf.git # Source code +``` git clone https://git.main.lv/cgit/pyairspyhf.git +``` + +# Install airspyhf + +Install all dependencies such as: +``` + cmake, libusb +``` + +Checked supported and tested version list + +To build the libairspyhf follow: https://github.com/airspy/airspyhf + +Workes localy +``` +git clone https://github.com/airspy/airspyhf.git +cd airspyhf +cmake . +make +sudo make install +``` + +If there is issues with libusb header try to find libusb header locations +``` +cmake -DLIBUSB_INCLUDE_DIR=/usr/include/libusb-1.0/ -DINSTALL_UDEV_RULES=ON +``` + +```commandline +udevadm control --reload-rules +``` + # API ## libairspyhf @@ -21,6 +54,13 @@ git clone https://git.main.lv/cgit/pyairspyhf.git ## airspyhf_rx.py +## Supported and tested + +| --- | --- | --- | --- | +| Python | libairspyhf | OS | Status | +| --- |--- | --- | --- | +| 3.9, 3.10 | 1.7.1 | ArchLinux, Ubuntu 20.04 | Supported and tested | + ## Install diff --git a/airspyhf/libairspyhf.py b/airspyhf/libairspyhf.py index dada9f5..a287626 100644 --- a/airspyhf/libairspyhf.py +++ b/airspyhf/libairspyhf.py @@ -23,7 +23,7 @@ def load_libairspyhf(): driver = driver() if driver is None: continue - print(driver) + #print("Search for driver named %s"%(driver)) try: dll = CDLL(driver) break diff --git a/airspyhf_rx.py b/airspyhf_rx.py index da0e32e..8ba5557 100644 --- a/airspyhf_rx.py +++ b/airspyhf_rx.py @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import os from airspyhf import * from ctypes import * @@ -38,7 +39,8 @@ if args.serial != None: else: serial = c_uint64(0) libairspyhf.airspyhf_list_devices(byref(serial), 1) - ret = libairspyhf.airspyhf_open_sn(dev_p, f"{hex(serial.value)}") + print(hex(serial.value)) + ret = libairspyhf.airspyhf_open_sn(dev_p, int(hex(serial.value),16)) print("open_sn: Returned %d"%(ret)) if (ret != 0): print("airspyhf_open_sn returned != 0, error") @@ -116,17 +118,13 @@ except: ret = libairspyhf.airspyhf_stop(dev_p) print(f"airspyhf_stop ret={ret}") - +time.sleep(1) #Not close for now ret = libairspyhf.close(dev_p) print("closed: Returned %d"%(ret)) print(f"Total samples received {sample_count}") -libairspyhf.py_test() - -libairspyhf.py_test_cb(read_samples_cb) - wave_file.close() print("All is ok") diff --git a/test.py b/test.py index 8d17197..443b83f 100644 --- a/test.py +++ b/test.py @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import os from airspyhf import * from ctypes import * @@ -110,10 +111,6 @@ print("closed: Returned %d"%(ret)) print(f"Total samples received {sample_count}") -libairspyhf.py_test() - -libairspyhf.py_test_cb(read_samples_cb) - wave_file.close() print("All is ok") -- cgit v1.2.3