From 7d629e71afd4ef97c45ad2a0cbf93631aa4a9bc9 Mon Sep 17 00:00:00 2001 From: Arturs Artamonovs Date: Mon, 6 Mar 2023 23:14:39 +0000 Subject: Add arguments to rx. --- README.md | 14 ++++++++++++-- airspyhf_rx.py | 11 ++++++++--- airspyhf_shedule.py | 0 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 airspyhf_shedule.py diff --git a/README.md b/README.md index c2a58ff..50cd170 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,22 @@ https://github.com/airspy/airspyhf.git Project webpage main.lv +http://git.main.lv/cgit.cgi/pyairspyhf.git - -## Sourcecode +# Source code git clone https://git.main.lv/cgit/pyairspyhf.git +# API +## libairspyhf + +## AirSpyHF + +# Examples + +## airspyhf_rx.py + + ## Install ## Links diff --git a/airspyhf_rx.py b/airspyhf_rx.py index 9770054..da0e32e 100644 --- a/airspyhf_rx.py +++ b/airspyhf_rx.py @@ -14,8 +14,6 @@ parser.add_argument("--outputfile") parser.add_argument("--serial") args = parser.parse_args() - - print("Check airspyHF version") p = airspyhf_lib_version_t() @@ -25,6 +23,8 @@ print(f"libairspyhf version {p.major_version}.{p.minor_version}.{p.revision}") print("Get list of devices if there is any") ndev = libairspyhf.airspyhf_list_devices(None,0) print("Found %d devices"%(ndev)) +if ndev < 1: + sys.exit(0) for devi in range(0,ndev): serial = c_uint64(0) @@ -33,7 +33,12 @@ for devi in range(0,ndev): print("try to open device") dev_p = airspyhf_device_t_p(None) -ret = libairspyhf.airspyhf_open_sn(dev_p,0x3b52ab5dada12535) +if args.serial != None: + ret = libairspyhf.airspyhf_open_sn(dev_p, args.serial) +else: + serial = c_uint64(0) + libairspyhf.airspyhf_list_devices(byref(serial), 1) + ret = libairspyhf.airspyhf_open_sn(dev_p, f"{hex(serial.value)}") print("open_sn: Returned %d"%(ret)) if (ret != 0): print("airspyhf_open_sn returned != 0, error") diff --git a/airspyhf_shedule.py b/airspyhf_shedule.py new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3