summaryrefslogtreecommitdiff
path: root/gr-utils/src/python/lsusrp
diff options
context:
space:
mode:
authorjcorgan2008-07-10 19:56:51 +0000
committerjcorgan2008-07-10 19:56:51 +0000
commit241300330cfe393a3c19b7b1bedf87c127d649db (patch)
treec0d6ad29811ad904030a7e9311e832a0461618cf /gr-utils/src/python/lsusrp
parentf6195a3edd1eac5c5109ad6ffeb744cb7238cb55 (diff)
downloadgnuradio-241300330cfe393a3c19b7b1bedf87c127d649db.tar.gz
gnuradio-241300330cfe393a3c19b7b1bedf87c127d649db.tar.bz2
gnuradio-241300330cfe393a3c19b7b1bedf87c127d649db.zip
Add lookup by serial number.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8858 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-utils/src/python/lsusrp')
-rwxr-xr-xgr-utils/src/python/lsusrp16
1 files changed, 14 insertions, 2 deletions
diff --git a/gr-utils/src/python/lsusrp b/gr-utils/src/python/lsusrp
index df52c608e..d2eab33fe 100755
--- a/gr-utils/src/python/lsusrp
+++ b/gr-utils/src/python/lsusrp
@@ -25,9 +25,14 @@ MAX_USRPS = 8
from gnuradio import usrp
from optparse import OptionParser
-def disp_usrp(which):
+def disp_usrp(which, serial=None):
u_source = usrp.source_c(which=which)
u_sink = usrp.sink_c(which=which)
+ u_serial = u_source.serial_number()
+
+ if serial is not None:
+ if serial != u_serial:
+ raise ValueError
print "USRP", which, "serial number", u_source.serial_number()
subdev_A_rx = usrp.selected_subdev(u_source, (0,0))
@@ -44,11 +49,18 @@ if __name__ == "__main__":
parser.add_option("-w", "--which", type="int", default=None,
help="select which USRP (0, 1, ...) default is all found",
metavar="NUM")
+ parser.add_option("-s", "--serial", default=None,
+ help="select USRP by serial number",
+ metavar="SER")
(options, args) = parser.parse_args()
if len(args) > 0:
print parser.print_help()
raise SystemExit, 1
+ if options.serial is not None and options.which is not None:
+ print "Use of --which or --serial is exclusive"
+ raise SystemExit, 1
+
if options.which is not None:
try:
disp_usrp(options.which)
@@ -57,7 +69,7 @@ if __name__ == "__main__":
else:
for n in range(MAX_USRPS):
try:
- disp_usrp(n)
+ disp_usrp(n, options.serial)
except:
pass