summaryrefslogtreecommitdiff
path: root/airspyhf_rx.py
diff options
context:
space:
mode:
authorArturs Artamonovs <dos21h@gmail.com>2023-03-06 23:14:39 +0000
committerArturs Artamonovs <dos21h@gmail.com>2023-03-06 23:14:39 +0000
commit7d629e71afd4ef97c45ad2a0cbf93631aa4a9bc9 (patch)
tree3b3414922015b9419ef25963ae7ad311e03e9e17 /airspyhf_rx.py
parent669926aa70eb78ea8f0ada46355a617abae61832 (diff)
downloadpyairspyhf-7d629e71afd4ef97c45ad2a0cbf93631aa4a9bc9.tar.gz
pyairspyhf-7d629e71afd4ef97c45ad2a0cbf93631aa4a9bc9.zip
Add arguments to rx.
Diffstat (limited to 'airspyhf_rx.py')
-rw-r--r--airspyhf_rx.py11
1 files changed, 8 insertions, 3 deletions
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")