diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-04-26 16:23:10 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:52 -0800 |
commit | 658bdb71d89d1d8cd4be88f7f1b28c44682f5850 (patch) | |
tree | 440c30d9d40e4a6120185a5fc0df71f4e0d7de5c /mpm/python/usrp_mpm/periph_manager | |
parent | cf6619992ac0d9ed2d2c99ab17a98023ee162fef (diff) | |
download | uhd-658bdb71d89d1d8cd4be88f7f1b28c44682f5850.tar.gz uhd-658bdb71d89d1d8cd4be88f7f1b28c44682f5850.tar.bz2 uhd-658bdb71d89d1d8cd4be88f7f1b28c44682f5850.zip |
mpm: Added more generic UIO lookup
Diffstat (limited to 'mpm/python/usrp_mpm/periph_manager')
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/n310.py | 10 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/udev.py | 24 |
2 files changed, 3 insertions, 31 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n310.py index 364d50908..172aec35b 100644 --- a/mpm/python/usrp_mpm/periph_manager/n310.py +++ b/mpm/python/usrp_mpm/periph_manager/n310.py @@ -23,9 +23,8 @@ from .base import PeriphManagerBase from .net import get_iface_addrs from .net import byte_to_mac from .net import get_mac_addr -from .udev import get_uio_node from ..types import SID -from ..uio import uio +from ..uio import UIO from .. import libpyusrp_periphs as lib from logging import getLogger import netaddr @@ -118,11 +117,8 @@ class n310(PeriphManagerBase): sid.set_src_ep(new_ep) my_xbar = lib.xbar.xbar.make("/dev/crossbar0") # TODO my_xbar.set_route(xbar_src_addr, 0) # TODO - # uio_path, uio_size = get_uio_node("misc-enet-regs0") - uio_path = "/dev/uio0" - uio_size = 0x2000 - self.log.debug("got uio_path and size") - uio_obj = uio(uio_path, uio_size, read_only=False) + self.log.debug("Getting UIO device for Ethernet configuration...") + uio_obj = UIO(label="misc-enet-regs0", read_only=False) self.log.info("got my uio") self.log.info("ip_addr: %s", sender_addr) # self.log.info("mac_addr: %s", mac_addr) diff --git a/mpm/python/usrp_mpm/periph_manager/udev.py b/mpm/python/usrp_mpm/periph_manager/udev.py index 73601e85c..6801d2163 100644 --- a/mpm/python/usrp_mpm/periph_manager/udev.py +++ b/mpm/python/usrp_mpm/periph_manager/udev.py @@ -42,27 +42,3 @@ def get_spidev_nodes(spi_master): for device in context.list_devices(parent=parent, subsystem="spidev")] return paths -def get_uio_node(uio_name): - """ - Return found uio device path for a give parent name - """ - context = pyudev.Context() - paths = [device.sys_path - for device in context.list_devices(subsystem="uio")] - log = get_logger('get_uio_node') - log.debug("get_uio_node") - log.debug("got paths: %s", paths) - for path in paths: - with open(os.path.join(path, "maps", "map0", "name"), "r") as uio_file: - name = uio_file.read() - log.debug("uio_node name: %s", name.strip()) - if name.strip() == uio_name: - with open(os.path.join(path, "maps", "map0", "size"), "r") as uio_file: - size = uio_file.read() - log.debug("uio_node size: %s", size.strip()) - log.debug("uio_node syspath: %s", path) - # device = pyudev.Device.from_sys_path(context, path) - log.debug("got udev device") - log.debug("device_node: %s size: %s", "/dev/uio0", size.strip()) - return ("/dev/uio0", int(size.strip())) - return ("", 0) |