Ejemplo n.º 1
0
    def enum(cls, filt=[]):
        for drv in cls._drivers:
            drv_path = sysfs_path('/sys/bus/pci/drivers', drv.PCI_DRIVER)
            if os.path.exists(drv_path):
                return drv.enum(filt)

        print('no fpga drivers loaded')
Ejemplo n.º 2
0
    def __init__(self, _sysfs_path):
        """__init__ Initializes a new sysfs_node object with a sysfs path.

        Args:
            sysfs_path: sysfs path to a 'file' or 'directory' object.
        """
        super(sysfs_node, self).__init__()
        self._sysfs_path = sysfs_path(_sysfs_path)
Ejemplo n.º 3
0
    def enum_devices(cls):
        """enum_devices Discover sysfs devices under a given device root.


        """
        nodes = []
        paths = glob.glob(sysfs_path(cls.DEVICE_ROOT, '*'))
        # log.debug('found %s objects: %s', sysfs_class_name, class_paths)
        for path in paths:
            nodes.append(cls(path))
        return nodes
Ejemplo n.º 4
0
    def enum_class(cls, sysfs_class_name, sysfs_class=None):
        """enum_class Discover class_node objects under a given "class".

        Args:
            sysfs_class_name: The name of the class under /sys/class to look
                              at.
            sysfs_class(class_node): The class_node or deriving class to use
                                     when creating class_node objects.

        Notes:
            If 'sysfs_class' is not specified, it will use this class.
            This is meant so that classes deriving from this can omit this.
        """
        sysfs_class = sysfs_class or cls
        log = LOG(cls.__name__)
        nodes = []
        class_paths = glob.glob(sysfs_path('class', sysfs_class_name, '*'))
        log.debug('found %s objects: %s', sysfs_class_name, class_paths)
        for path in class_paths:
            nodes.append(sysfs_class(path))
        return nodes