aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-01-03 13:13:18 -0800
committerMartin Braun <martin.braun@ettus.com>2018-01-11 14:50:12 -0800
commitdd29b7be30c0e9a1bac24b25e71d39a8beb97de5 (patch)
tree46d0d2a36a2ccf8d9a35e307c51832b94f2a94b8 /mpm/python/usrp_mpm
parent1889469efcc5d045defe7eda6b6da06293c73155 (diff)
downloaduhd-dd29b7be30c0e9a1bac24b25e71d39a8beb97de5.tar.gz
uhd-dd29b7be30c0e9a1bac24b25e71d39a8beb97de5.tar.bz2
uhd-dd29b7be30c0e9a1bac24b25e71d39a8beb97de5.zip
mpm: dboard_manager: Use mpmutils.to_native_str instead of local hack
Diffstat (limited to 'mpm/python/usrp_mpm')
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/base.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/mpm/python/usrp_mpm/dboard_manager/base.py b/mpm/python/usrp_mpm/dboard_manager/base.py
index 0915d3cdc..c56fb54e3 100644
--- a/mpm/python/usrp_mpm/dboard_manager/base.py
+++ b/mpm/python/usrp_mpm/dboard_manager/base.py
@@ -10,6 +10,7 @@ dboard base implementation module
from builtins import object
from six import iteritems
from usrp_mpm.mpmlog import get_logger
+from usrp_mpm.mpmutils import to_native_str
class DboardManagerBase(object):
"""
@@ -39,19 +40,10 @@ class DboardManagerBase(object):
self.slot_idx = slot_idx
if 'eeprom_md' not in kwargs:
self.log.warn("No EEPROM metadata given!")
- def anystr_to_str(any_str):
- """
- Convert byte-string or regular string to regular string, regardless
- of Python version (2 or 3).
- """
- try:
- return str(any_str, 'ascii')
- except TypeError:
- return str(any_str)
# In C++, we can only handle dicts if all the values are of the
# same type. So we must convert them all to strings here:
self.device_info = {
- key: anystr_to_str(kwargs.get('eeprom_md', {}).get(key, 'n/a'))
+ key: to_native_str(kwargs.get('eeprom_md', {}).get(key, 'n/a'))
for key in ('pid', 'serial', 'rev', 'eeprom_version')
}
self.log.trace("Dboard device info: `{}'".format(self.device_info))