summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-wxgui/src/python/common.py11
-rw-r--r--gr-wxgui/src/python/const_window.py2
-rw-r--r--gr-wxgui/src/python/constants.py1
-rw-r--r--gr-wxgui/src/python/fft_window.py2
-rw-r--r--gr-wxgui/src/python/histo_window.py2
-rw-r--r--gr-wxgui/src/python/number_window.py2
-rw-r--r--gr-wxgui/src/python/scope_window.py7
-rw-r--r--gr-wxgui/src/python/scopesink_gl.py2
-rw-r--r--gr-wxgui/src/python/waterfall_window.py15
-rw-r--r--grc/blocks/wxgui_constellationsink2.xml13
-rw-r--r--grc/blocks/wxgui_fftsink2.xml13
-rw-r--r--grc/blocks/wxgui_histosink2.xml13
-rw-r--r--grc/blocks/wxgui_numbersink2.xml13
-rw-r--r--grc/blocks/wxgui_scopesink2.xml27
-rw-r--r--grc/blocks/wxgui_waterfallsink2.xml13
-rw-r--r--grc/python/Param.py28
-rw-r--r--usrp/host/lib/usrp_prims_common.cc4
-rw-r--r--usrp/host/lib/usrp_prims_libusb0.cc5
-rw-r--r--usrp/host/lib/usrp_prims_libusb1.cc2
19 files changed, 145 insertions, 30 deletions
diff --git a/gr-wxgui/src/python/common.py b/gr-wxgui/src/python/common.py
index a75f6810d..17a7dc0de 100644
--- a/gr-wxgui/src/python/common.py
+++ b/gr-wxgui/src/python/common.py
@@ -216,12 +216,13 @@ def get_min_max(samples):
@param samples the array of real values
@return a tuple of min, max
"""
- scale_factor = 3
+ factor = 2.0
mean = numpy.average(samples)
- rms = numpy.max([scale_factor*((numpy.sum((samples-mean)**2)/len(samples))**.5), .1])
- min_val = mean - rms
- max_val = mean + rms
- return min_val, max_val
+ std = numpy.std(samples)
+ fft = numpy.abs(numpy.fft.fft(samples - mean))
+ envelope = 2*numpy.max(fft)/len(samples)
+ ampl = max(std, envelope) or 0.1
+ return mean - factor*ampl, mean + factor*ampl
def get_min_max_fft(fft_samps):
"""
diff --git a/gr-wxgui/src/python/const_window.py b/gr-wxgui/src/python/const_window.py
index b128a4a98..f7c7caf07 100644
--- a/gr-wxgui/src/python/const_window.py
+++ b/gr-wxgui/src/python/const_window.py
@@ -64,6 +64,8 @@ class control_panel(wx.Panel):
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = forms.static_box_sizer(
parent=self, label='Options',
bold=True, orient=wx.VERTICAL,
diff --git a/gr-wxgui/src/python/constants.py b/gr-wxgui/src/python/constants.py
index 8ff7fa8fe..825f71c32 100644
--- a/gr-wxgui/src/python/constants.py
+++ b/gr-wxgui/src/python/constants.py
@@ -69,3 +69,4 @@ MINIMUM_KEY = 'minimum'
NUM_BINS_KEY = 'num_bins'
FRAME_SIZE_KEY = 'frame_size'
CHANNEL_OPTIONS_KEY = 'channel_options'
+SHOW_CONTROL_PANEL_KEY = 'show_control_panel'
diff --git a/gr-wxgui/src/python/fft_window.py b/gr-wxgui/src/python/fft_window.py
index e025c28dd..4ee5520f7 100644
--- a/gr-wxgui/src/python/fft_window.py
+++ b/gr-wxgui/src/python/fft_window.py
@@ -64,6 +64,8 @@ class control_panel(wx.Panel):
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = wx.BoxSizer(wx.VERTICAL)
control_box.AddStretchSpacer()
#checkboxes for average and peak hold
diff --git a/gr-wxgui/src/python/histo_window.py b/gr-wxgui/src/python/histo_window.py
index 5f434d70e..a1b520f9c 100644
--- a/gr-wxgui/src/python/histo_window.py
+++ b/gr-wxgui/src/python/histo_window.py
@@ -52,6 +52,8 @@ class control_panel(wx.Panel):
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = wx.BoxSizer(wx.VERTICAL)
SIZE = (100, -1)
control_box = forms.static_box_sizer(
diff --git a/gr-wxgui/src/python/number_window.py b/gr-wxgui/src/python/number_window.py
index 8a8249764..ab9d1ebc0 100644
--- a/gr-wxgui/src/python/number_window.py
+++ b/gr-wxgui/src/python/number_window.py
@@ -58,6 +58,8 @@ class control_panel(wx.Panel):
"""
self.parent = parent
wx.Panel.__init__(self, parent)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = wx.BoxSizer(wx.VERTICAL)
#checkboxes for average and peak hold
control_box.AddStretchSpacer()
diff --git a/gr-wxgui/src/python/scope_window.py b/gr-wxgui/src/python/scope_window.py
index 449046402..08a025e1e 100644
--- a/gr-wxgui/src/python/scope_window.py
+++ b/gr-wxgui/src/python/scope_window.py
@@ -82,6 +82,8 @@ class control_panel(wx.Panel):
WIDTH = 90
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = wx.BoxSizer(wx.VERTICAL)
##################################################
# Axes Options
@@ -374,6 +376,7 @@ class scope_window(wx.Panel, pubsub.pubsub):
sample_rate_key,
t_scale,
v_scale,
+ v_offset,
xy_mode,
ac_couple_key,
trigger_level_key,
@@ -413,8 +416,8 @@ class scope_window(wx.Panel, pubsub.pubsub):
self[X_PER_DIV_KEY] = v_scale
self[Y_PER_DIV_KEY] = v_scale
self[T_OFF_KEY] = 0
- self[X_OFF_KEY] = 0
- self[Y_OFF_KEY] = 0
+ self[X_OFF_KEY] = v_offset
+ self[Y_OFF_KEY] = v_offset
self[T_DIVS_KEY] = 8
self[X_DIVS_KEY] = 8
self[Y_DIVS_KEY] = 8
diff --git a/gr-wxgui/src/python/scopesink_gl.py b/gr-wxgui/src/python/scopesink_gl.py
index 2882488e3..358361de6 100644
--- a/gr-wxgui/src/python/scopesink_gl.py
+++ b/gr-wxgui/src/python/scopesink_gl.py
@@ -71,6 +71,7 @@ class _scope_sink_base(gr.hier_block2, common.wxgui_hb):
size=scope_window.DEFAULT_WIN_SIZE,
v_scale=0,
t_scale=0,
+ v_offset=0,
xy_mode=False,
ac_couple=False,
num_inputs=1,
@@ -119,6 +120,7 @@ class _scope_sink_base(gr.hier_block2, common.wxgui_hb):
sample_rate_key=SAMPLE_RATE_KEY,
t_scale=t_scale,
v_scale=v_scale,
+ v_offset=v_offset,
xy_mode=xy_mode,
ac_couple_key=AC_COUPLE_KEY,
trigger_level_key=TRIGGER_LEVEL_KEY,
diff --git a/gr-wxgui/src/python/waterfall_window.py b/gr-wxgui/src/python/waterfall_window.py
index 28e67a830..b7904e4d9 100644
--- a/gr-wxgui/src/python/waterfall_window.py
+++ b/gr-wxgui/src/python/waterfall_window.py
@@ -41,6 +41,7 @@ DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'waterfall_rate', 30)
DEFAULT_WIN_SIZE = (600, 300)
DIV_LEVELS = (1, 2, 5, 10, 20)
MIN_DYNAMIC_RANGE, MAX_DYNAMIC_RANGE = 10, 200
+DYNAMIC_RANGE_STEP = 10.
COLOR_MODES = (
('RGB1', 'rgb1'),
('RGB2', 'rgb2'),
@@ -63,6 +64,8 @@ class control_panel(wx.Panel):
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = wx.BoxSizer(wx.VERTICAL)
control_box.AddStretchSpacer()
options_box = forms.static_box_sizer(
@@ -143,13 +146,13 @@ class control_panel(wx.Panel):
def _on_clear_button(self, event):
self.parent[NUM_LINES_KEY] = self.parent[NUM_LINES_KEY]
def _on_incr_dynamic_range(self, event):
- self.parent[DYNAMIC_RANGE_KEY] = min(self.parent[DYNAMIC_RANGE_KEY] + 10, MAX_DYNAMIC_RANGE)
+ self.parent[DYNAMIC_RANGE_KEY] = min(MAX_DYNAMIC_RANGE, common.get_clean_incr(self.parent[DYNAMIC_RANGE_KEY]))
def _on_decr_dynamic_range(self, event):
- self.parent[DYNAMIC_RANGE_KEY] = max(self.parent[DYNAMIC_RANGE_KEY] - 10, MIN_DYNAMIC_RANGE)
+ self.parent[DYNAMIC_RANGE_KEY] = max(MIN_DYNAMIC_RANGE, common.get_clean_decr(self.parent[DYNAMIC_RANGE_KEY]))
def _on_incr_ref_level(self, event):
- self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] + self.parent[DYNAMIC_RANGE_KEY]*.1
+ self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] + self.parent[DYNAMIC_RANGE_KEY]/DYNAMIC_RANGE_STEP
def _on_decr_ref_level(self, event):
- self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] - self.parent[DYNAMIC_RANGE_KEY]*.1
+ self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] - self.parent[DYNAMIC_RANGE_KEY]/DYNAMIC_RANGE_STEP
def _on_incr_time_scale(self, event):
old_rate = self.parent[FRAME_RATE_KEY]
self.parent[FRAME_RATE_KEY] *= 0.75
@@ -239,8 +242,8 @@ class waterfall_window(wx.Panel, pubsub.pubsub):
if not len(self.samples): return
min_level, max_level = common.get_min_max_fft(self.samples)
#set the range and level
- self[REF_LEVEL_KEY] = max_level
- self[DYNAMIC_RANGE_KEY] = max_level - min_level
+ self[DYNAMIC_RANGE_KEY] = common.get_clean_num(max_level - min_level)
+ self[REF_LEVEL_KEY] = DYNAMIC_RANGE_STEP*round(.5+max_level/DYNAMIC_RANGE_STEP)
def handle_msg(self, msg):
"""
diff --git a/grc/blocks/wxgui_constellationsink2.xml b/grc/blocks/wxgui_constellationsink2.xml
index 5969d8405..598b55064 100644
--- a/grc/blocks/wxgui_constellationsink2.xml
+++ b/grc/blocks/wxgui_constellationsink2.xml
@@ -23,6 +23,9 @@ constsink_gl.const_sink_c(
gain_mu=$gain_mu,
symbol_rate=$symbol_rate,
omega_limit=$omega_limit,
+#if $win_size()
+ size=$win_size,
+#end if
)
#if not $grid_pos()
$(parent).Add(self.$(id).win)
@@ -103,6 +106,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<type>real</type>
</param>
<param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
<name>Grid Position</name>
<key>grid_pos</key>
<value></value>
@@ -114,11 +124,14 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<value></value>
<type>notebook</type>
</param>
+ <check>not $win_size or len($win_size) == 2</check>
<sink>
<name>in</name>
<type>complex</type>
</sink>
<doc>
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
diff --git a/grc/blocks/wxgui_fftsink2.xml b/grc/blocks/wxgui_fftsink2.xml
index 6f19f1aa4..42bca5ccf 100644
--- a/grc/blocks/wxgui_fftsink2.xml
+++ b/grc/blocks/wxgui_fftsink2.xml
@@ -23,6 +23,9 @@ fftsink2.$(type.fcn)(
avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#,
title=$title,
peak_hold=$peak_hold,
+#if $win_size()
+ size=$win_size,
+#end if
)
#if not $grid_pos()
$(parent).Add(self.$(id).win)
@@ -159,6 +162,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<hide>#if $average() == 'True' then 'none' else 'all'#</hide>
</param>
<param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
<name>Grid Position</name>
<key>grid_pos</key>
<value></value>
@@ -170,6 +180,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<value></value>
<type>notebook</type>
</param>
+ <check>not $win_size or len($win_size) == 2</check>
<sink>
<name>in</name>
<type>$type</type>
@@ -177,6 +188,8 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<doc>
Set Average Alpha to 0 for automatic setting.
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
diff --git a/grc/blocks/wxgui_histosink2.xml b/grc/blocks/wxgui_histosink2.xml
index 454a4932c..9edf9650d 100644
--- a/grc/blocks/wxgui_histosink2.xml
+++ b/grc/blocks/wxgui_histosink2.xml
@@ -14,6 +14,9 @@ histosink_gl.histo_sink_f(
title=$title,
num_bins=$num_bins,
frame_size=$frame_size,
+#if $win_size()
+ size=$win_size,
+#end if
)
#if not $grid_pos()
$(parent).Add(self.$(id).win)
@@ -41,6 +44,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<type>int</type>
</param>
<param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
<name>Grid Position</name>
<key>grid_pos</key>
<value></value>
@@ -52,11 +62,14 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<value></value>
<type>notebook</type>
</param>
+ <check>not $win_size or len($win_size) == 2</check>
<sink>
<name>in</name>
<type>float</type>
</sink>
<doc>
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
diff --git a/grc/blocks/wxgui_numbersink2.xml b/grc/blocks/wxgui_numbersink2.xml
index cc66cdcb0..5289db8af 100644
--- a/grc/blocks/wxgui_numbersink2.xml
+++ b/grc/blocks/wxgui_numbersink2.xml
@@ -24,6 +24,9 @@ numbersink2.$(type.fcn)(
label=$title,
peak_hold=$peak_hold,
show_gauge=$show_gauge,
+#if $win_size()
+ size=$win_size,
+#end if
)
#if not $grid_pos()
$(parent).Add(self.$(id).win)
@@ -152,6 +155,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
</option>
</param>
<param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
<name>Grid Position</name>
<key>grid_pos</key>
<value></value>
@@ -163,6 +173,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<value></value>
<type>notebook</type>
</param>
+ <check>not $win_size or len($win_size) == 2</check>
<sink>
<name>in</name>
<type>$type</type>
@@ -170,6 +181,8 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<doc>
Set Average Alpha to 0 for automatic setting.
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
diff --git a/grc/blocks/wxgui_scopesink2.xml b/grc/blocks/wxgui_scopesink2.xml
index 503d52972..eba45f489 100644
--- a/grc/blocks/wxgui_scopesink2.xml
+++ b/grc/blocks/wxgui_scopesink2.xml
@@ -15,10 +15,14 @@ scopesink2.$(type.fcn)(
title=$title,
sample_rate=$samp_rate,
v_scale=$v_scale,
+ v_offset=$v_offset,
t_scale=$t_scale,
ac_couple=$ac_couple,
xy_mode=$xy_mode,
num_inputs=$num_inputs,
+#if $win_size()
+ size=$win_size,
+#end if
)
#if not $grid_pos()
$(parent).Add(self.$(id).win)
@@ -59,19 +63,28 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<key>v_scale</key>
<value>0</value>
<type>real</type>
+ <hide>#if $v_scale() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>V Offset</name>
+ <key>v_offset</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $v_offset() then 'none' else 'part'#</hide>
</param>
<param>
<name>T Scale</name>
<key>t_scale</key>
<value>0</value>
<type>real</type>
+ <hide>#if $t_scale() then 'none' else 'part'#</hide>
</param>
<param>
<name>AC Couple</name>
<key>ac_couple</key>
<value>False</value>
- <type>enum</type>
- <hide>#if $ac_couple() == 'True' then 'none' else 'part'#</hide>
+ <type>bool</type>
+ <hide>#if $ac_couple() then 'none' else 'part'#</hide>
<option>
<name>Off</name>
<key>False</key>
@@ -103,6 +116,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<type>int</type>
</param>
<param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
<name>Grid Position</name>
<key>grid_pos</key>
<value></value>
@@ -114,6 +134,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<value></value>
<type>notebook</type>
</param>
+ <check>not $win_size or len($win_size) == 2</check>
<check>not $xy_mode or '$type' == 'complex' or $num_inputs != 1</check>
<sink>
<name>in</name>
@@ -127,6 +148,8 @@ Set the T Scale to 0 for automatic setting.
XY Mode allows the scope to initialize as an XY plotter.
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
diff --git a/grc/blocks/wxgui_waterfallsink2.xml b/grc/blocks/wxgui_waterfallsink2.xml
index 35790f820..cee598990 100644
--- a/grc/blocks/wxgui_waterfallsink2.xml
+++ b/grc/blocks/wxgui_waterfallsink2.xml
@@ -21,6 +21,9 @@ waterfallsink2.$(type.fcn)(
average=$options.average,
avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#,
title=$title,
+#if $win_size()
+ size=$win_size,
+#end if
)
#if not $grid_pos()
$(parent).Add(self.$(id).win)
@@ -116,6 +119,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
</option>
</param>
<param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
<name>Grid Position</name>
<key>grid_pos</key>
<value></value>
@@ -127,6 +137,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<value></value>
<type>notebook</type>
</param>
+ <check>not $win_size or len($win_size) == 2</check>
<sink>
<name>in</name>
<type>$type</type>
@@ -134,6 +145,8 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<doc>
Set Average Alpha to 0 for automatic setting.
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
diff --git a/grc/python/Param.py b/grc/python/Param.py
index 34d5ab116..81fb6ba7a 100644
--- a/grc/python/Param.py
+++ b/grc/python/Param.py
@@ -251,7 +251,7 @@ class Param(_Param, _GUIParam):
#########################
# Numeric Types
#########################
- elif t in ('raw', 'complex', 'real', 'int', 'complex_vector', 'real_vector', 'int_vector', 'hex', 'bool'):
+ elif t in ('raw', 'complex', 'real', 'int', 'hex', 'bool'):
#raise exception if python cannot evaluate this value
try: e = self.get_parent().get_parent().evaluate(v)
except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e)
@@ -269,10 +269,22 @@ class Param(_Param, _GUIParam):
try: assert isinstance(e, INT_TYPES)
except AssertionError: raise Exception, 'Expression "%s" is invalid for type integer.'%str(e)
return e
- #########################
- # Numeric Vector Types
- #########################
- elif t == 'complex_vector':
+ elif t == 'hex': return hex(e)
+ elif t == 'bool':
+ try: assert isinstance(e, bool)
+ except AssertionError: raise Exception, 'Expression "%s" is invalid for type bool.'%str(e)
+ return e
+ else: raise TypeError, 'Type "%s" not handled'%t
+ #########################
+ # Numeric Vector Types
+ #########################
+ elif t in ('complex_vector', 'real_vector', 'int_vector'):
+ if not v: v = '()' #turn a blank string into an empty list, so it will eval
+ #raise exception if python cannot evaluate this value
+ try: e = self.get_parent().get_parent().evaluate(v)
+ except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e)
+ #raise an exception if the data is invalid
+ if t == 'complex_vector':
if not isinstance(e, VECTOR_TYPES):
self._lisitify_flag = True
e = [e]
@@ -296,12 +308,6 @@ class Param(_Param, _GUIParam):
for ei in e: assert isinstance(ei, INT_TYPES)
except AssertionError: raise Exception, 'Expression "%s" is invalid for type integer vector.'%str(e)
return e
- elif t == 'hex': return hex(e)
- elif t == 'bool':
- try: assert isinstance(e, bool)
- except AssertionError: raise Exception, 'Expression "%s" is invalid for type bool.'%str(e)
- return e
- else: raise TypeError, 'Type "%s" not handled'%t
#########################
# String Types
#########################
diff --git a/usrp/host/lib/usrp_prims_common.cc b/usrp/host/lib/usrp_prims_common.cc
index 2d8a0fa2a..20a55653c 100644
--- a/usrp/host/lib/usrp_prims_common.cc
+++ b/usrp/host/lib/usrp_prims_common.cc
@@ -692,11 +692,13 @@ usrp_load_firmware_nth (int nth, const char *filename, bool force, libusb_contex
// FIXME. Turn this into a loop that rescans until we refind ourselves
- struct timespec t; // delay for 1 second
+ struct timespec t; // delay for 2 second
t.tv_sec = 2;
t.tv_nsec = 0;
our_nanosleep (&t);
+ usrp_rescan ();
+
return ULS_OK;
default:
diff --git a/usrp/host/lib/usrp_prims_libusb0.cc b/usrp/host/lib/usrp_prims_libusb0.cc
index 0c8c3d1de..7053786d8 100644
--- a/usrp/host/lib/usrp_prims_libusb0.cc
+++ b/usrp/host/lib/usrp_prims_libusb0.cc
@@ -69,7 +69,8 @@ _get_usb_string_descriptor (struct usb_dev_handle *udh, int index,
fprintf (stderr, "usrp: usb_get_string_descriptor failed: %s\n",
usb_strerror());
}
- return (ret);
+
+ return ret;
}
int
@@ -84,7 +85,7 @@ _usb_control_transfer (struct usb_dev_handle *udh, int request_type,
if (ret < 0)
fprintf (stderr, "usrp: usb_claim_interface failed: %s\n", usb_strerror());
- return (ret);
+ return ret;
}
diff --git a/usrp/host/lib/usrp_prims_libusb1.cc b/usrp/host/lib/usrp_prims_libusb1.cc
index 49d1a7282..fdd497abc 100644
--- a/usrp/host/lib/usrp_prims_libusb1.cc
+++ b/usrp/host/lib/usrp_prims_libusb1.cc
@@ -59,7 +59,7 @@ _get_usb_error_str (int usb_err)
case LIBUSB_ERROR_INVALID_PARAM:
return "Invalid parameter";
case LIBUSB_ERROR_ACCESS:
- return "Access denied (insufficient permissions";
+ return "Access denied (insufficient permissions)";
case LIBUSB_ERROR_NO_DEVICE:
return "No such device (it may have been disconnected)";
case LIBUSB_ERROR_NOT_FOUND: