Esempio n. 1
0
    def __iter__(self):
        """
        Iterate over all matching devices.

        Yield :class:`Device` objects.
        """
        libudev.udev_enumerate_scan_devices(self)
        entry = libudev.udev_enumerate_get_list_entry(self)
        for name, _ in udev_list_iterate(entry):
            yield Device.from_sys_path(self.context, name)
Esempio n. 2
0
    def new_func(context, device, recursive=True):
        """
        New function wraps yielded value in Device.

        :param `Context` context: udev context
        :param `Device` device: device to start from
        :param bool recursive: if False, only show immediate slaves
        """
        for directory in func(device.sys_path, recursive):
            yield Device.from_sys_path(context, directory)
Esempio n. 3
0
    def __iter__(self):
        """
        Iterate over all matching devices.

        Yield :class:`Device` objects.
        """
        self._libudev.udev_enumerate_scan_devices(self)
        entry = self._libudev.udev_enumerate_get_list_entry(self)
        for name, _ in udev_list_iterate(self._libudev, entry):
            yield Device.from_sys_path(self.context, name)
Esempio n. 4
0
    def __iter__(self):
        """
        Iterate over all matching devices.

        Yield :class:`Device` objects.
        """
        self._libudev.udev_enumerate_scan_devices(self)
        entry = self._libudev.udev_enumerate_get_list_entry(self)
        for name, _ in udev_list_iterate(self._libudev, entry):
            try:
                yield Device.from_sys_path(self.context, name)
            except DeviceNotFoundAtPathError:
                continue