ok
Direktori : /lib/python3.6/site-packages/pyudev/__pycache__/ |
Current File : //lib/python3.6/site-packages/pyudev/__pycache__/monitor.cpython-36.pyc |
3 u1�W�Q � @ s� d Z ddlmZmZmZmZ ddlZddlZddlm Z ddl mZ ddlm Z ddlmZ ddlmZ dd lmZ dd lmZ G dd� de�ZG d d� de �ZdS )z� pyudev.monitor ============== Monitor implementation. .. moduleauthor:: Sebastian Wiesner <lunaryorn@gmail.com> � )�print_function�division�unicode_literals�absolute_importN)�Thread)�partial)�Device)�eintr_retry_call)�ensure_byte_string)�pipe)�pollc @ s� e Zd ZdZdd� Zdd� Zed"dd��Zed d � �Z dd� Z d#dd�Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zd$dd�Zdd� Zd d!� Zd S )%�Monitorat A synchronous device event monitor. A :class:`Monitor` objects connects to the udev daemon and listens for changes to the device list. A monitor is created by connecting to the kernel daemon through netlink (see :meth:`from_netlink`): >>> from pyudev import Context, Monitor >>> context = Context() >>> monitor = Monitor.from_netlink(context) Once the monitor is created, you can add a filter using :meth:`filter_by()` or :meth:`filter_by_tag()` to drop incoming events in subsystems, which are not of interest to the application: >>> monitor.filter_by('input') When the monitor is eventually set up, you can either poll for events synchronously: >>> device = monitor.poll(timeout=3) >>> if device: ... print('{0.action}: {0}'.format(device)) ... Or you can monitor events asynchronously with :class:`MonitorObserver`. To integrate into various event processing frameworks, the monitor provides a :func:`selectable <select.select>` file description by :meth:`fileno()`. However, do *not* read or write directly on this file descriptor. Instances of this class can directly be given as ``udev_monitor *`` to functions wrapped through :mod:`ctypes`. .. versionchanged:: 0.16 Remove :meth:`from_socket()` which is deprecated, and even removed in recent udev versions. c C s || _ || _|j| _d| _d S )NF)�contextZ_as_parameter_�_libudev�_started)�selfr Z monitor_p� r �/usr/lib/python3.6/monitor.py�__init__V s zMonitor.__init__c C s | j j| � d S )N)r Zudev_monitor_unref)r r r r �__del__\ s zMonitor.__del__�udevc C s>