0000002d
ˆ
875ÄÃÆ k
Index of /FSS-BCZ/root/proc/1859/task
Index of /FSS-BCZ/root/proc/1859/task
$ ˆl–Ãa¾”JeJ‚
ÆÅq·Å£Ê
„,ºßÉÄÇ 4? # -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011 Sebastian Wiesner
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 2.1 of the License, or (at your
# option) any later version.
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
# for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
pyudev.core
===========
Core types and functions of :mod:`pyudev`.
.. moduleauthor:: Sebastian Wiesner
"""
from __future__ import (print_function, division, unicode_literals,
absolute_import)
from pyudev.device import Devices
from pyudev._errors import DeviceNotFoundAtPathError
from pyudev._ctypeslib.libudev import ERROR_CHECKERS
from pyudev._ctypeslib.libudev import SIGNATURES
from pyudev._ctypeslib.utils import load_ctypes_library
from pyudev._util import ensure_byte_string
from pyudev._util import ensure_unicode_string
from pyudev._util import property_value_to_bytes
from pyudev._util import udev_list_iterate
class Context(object):
"""
A device database connection.
This class represents a connection to the udev device database, and is
really *the* central object to access udev. You need an instance of this
class for almost anything else in pyudev.
This class itself gives access to various udev configuration data (e.g.
:attr:`sys_path`, :attr:`device_path`), and provides device enumeration
(:meth:`list_devices()`).
Instances of this class can directly be given as ``udev *`` to functions
wrapped through :mod:`ctypes`.
"""
def __init__(self):
"""
Create a new context.
"""
self._libudev = load_ctypes_library('udev', SIGNATURES, ERROR_CHECKERS)
self._as_parameter_ = self._libudev.udev_new()
def __del__(self):
self._libudev.udev_unref(self)
@property
def sys_path(self):
"""
The ``sysfs`` mount point defaulting to ``/sys'`` as unicode string.
"""
if hasattr(self._libudev, 'udev_get_sys_path'):
return ensure_unicode_string(self._libudev.udev_get_sys_path(self))
return '/sys' # Fixed path since udev 183
@property
def device_path(self):
"""
The device directory path defaulting to ``/dev`` as unicode string.
"""
if hasattr(self._libudev, 'udev_get_dev_path'):
return ensure_unicode_string(self._libudev.udev_get_dev_path(self))
return '/dev' # Fixed path since udev 183
@property
def run_path(self):
"""
The run runtime directory path defaulting to ``/run`` as unico