Server IP : 149.255.58.128 / Your IP : 216.73.216.154
System : Linux cloud516.thundercloud.uk 5.14.0-427.26.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 17 15:51:13 EDT 2024 x86_64
PHP Version : 8.2.28
Disable Function : allow_url_include, apache_child_terminate, apache_setenv, exec, passthru, pcntl_exec, posix_kill, posix_mkfifo, posix_getpwuid, posix_setpgid, posix_setsid, posix_setuid, posix_setgid, posix_seteuid, posix_setegid, posix_uname, proc_close, proc_get_status, proc_open, proc_terminate, shell_exec, show_source, system
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Upload Files :
Command :
Current File : /usr/lib/python3.9/site-packages/pyudev/__pycache__//monitor.cpython-39.pyc
a
8g+^hR � @ 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 �2/usr/lib/python3.9/site-packages/pyudev/monitor.py�__init__S s zMonitor.__init__c C s | j �| � d S �N)r Zudev_monitor_unref�r r r r �__del__Y s zMonitor.__del__�udevc C s>