예제 #1
0
파일: fpga.py 프로젝트: baka233/opae-sdk
    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')
예제 #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)
예제 #3
0
파일: sysfs.py 프로젝트: baka233/opae-sdk
    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
예제 #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