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. --- airspyhf_rx.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'airspyhf_rx.py') 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") -- cgit v1.2.3