| 1 |
:mod:`pyudev` - libudev binding |
| 2 |
=============================== |
| 3 |
|
| 4 |
.. automodule:: pyudev |
| 5 |
:platform: Linux |
| 6 |
:synopsis: libudev bindings |
| 7 |
|
| 8 |
.. autosummary:: |
| 9 |
:nosignatures: |
| 10 |
|
| 11 |
Context |
| 12 |
Device |
| 13 |
Devices |
| 14 |
Monitor |
| 15 |
MonitorObserver |
| 16 |
|
| 17 |
|
| 18 |
Version information |
| 19 |
------------------- |
| 20 |
|
| 21 |
.. data:: __version__ |
| 22 |
|
| 23 |
The version of :mod:`pyudev` as string. This string contains a major and a |
| 24 |
minor version number, and optionally a revision in the form |
| 25 |
``major.minor.revision``. As said, the ``revision`` part is optional and |
| 26 |
may not be present. |
| 27 |
|
| 28 |
This attribute is mainly intended for display purposes, use |
| 29 |
:data:`__version_info__` to check the version of :mod:`pyudev` in source |
| 30 |
code. |
| 31 |
|
| 32 |
.. data:: __version_info__ |
| 33 |
|
| 34 |
The version of :mod:`pyudev` as tuple of integers. This tuple contains a |
| 35 |
major and a minor number, and optionally a revision number in the form |
| 36 |
``(major, minor, revision)``. As said, the ``revision`` component is |
| 37 |
optional and may not be present. |
| 38 |
|
| 39 |
.. versionadded:: 0.10 |
| 40 |
|
| 41 |
.. autofunction:: udev_version() |
| 42 |
|
| 43 |
|
| 44 |
:class:`Context` – UDev database context |
| 45 |
---------------------------------------- |
| 46 |
|
| 47 |
.. autoclass:: Context |
| 48 |
|
| 49 |
.. automethod:: __init__ |
| 50 |
|
| 51 |
.. autoattribute:: sys_path |
| 52 |
|
| 53 |
.. autoattribute:: device_path |
| 54 |
|
| 55 |
.. autoattribute:: run_path |
| 56 |
|
| 57 |
.. autoattribute:: log_priority |
| 58 |
|
| 59 |
.. automethod:: list_devices |
| 60 |
|
| 61 |
|
| 62 |
:class:`Enumerator` – device enumeration and filtering |
| 63 |
------------------------------------------------------ |
| 64 |
|
| 65 |
.. autoclass:: Enumerator() |
| 66 |
|
| 67 |
.. automethod:: match |
| 68 |
|
| 69 |
.. automethod:: match_subsystem |
| 70 |
|
| 71 |
.. automethod:: match_sys_name |
| 72 |
|
| 73 |
.. automethod:: match_property |
| 74 |
|
| 75 |
.. automethod:: match_attribute |
| 76 |
|
| 77 |
.. automethod:: match_tag |
| 78 |
|
| 79 |
.. automethod:: match_parent |
| 80 |
|
| 81 |
.. automethod:: match_is_initialized |
| 82 |
|
| 83 |
.. automethod:: __iter__ |
| 84 |
|
| 85 |
|
| 86 |
:class:`Devices` – constructing `Device` objects |
| 87 |
------------------------------------------------ |
| 88 |
|
| 89 |
.. autoclass:: Devices() |
| 90 |
|
| 91 |
.. rubric:: Construction of device objects |
| 92 |
|
| 93 |
.. automethod:: from_path |
| 94 |
|
| 95 |
.. automethod:: from_sys_path |
| 96 |
|
| 97 |
.. automethod:: from_name |
| 98 |
|
| 99 |
.. automethod:: from_device_number |
| 100 |
|
| 101 |
.. automethod:: from_device_file |
| 102 |
|
| 103 |
.. automethod:: from_environment |
| 104 |
|
| 105 |
.. automethod:: METHODS |
| 106 |
|
| 107 |
|
| 108 |
:class:`Device` – accessing device information |
| 109 |
---------------------------------------------- |
| 110 |
|
| 111 |
.. autoclass:: Device() |
| 112 |
|
| 113 |
.. rubric:: Construction of device objects |
| 114 |
|
| 115 |
.. automethod:: from_path |
| 116 |
|
| 117 |
.. automethod:: from_sys_path |
| 118 |
|
| 119 |
.. automethod:: from_name |
| 120 |
|
| 121 |
.. automethod:: from_device_number |
| 122 |
|
| 123 |
.. automethod:: from_device_file |
| 124 |
|
| 125 |
.. automethod:: from_environment |
| 126 |
|
| 127 |
.. rubric:: General attributes |
| 128 |
|
| 129 |
.. attribute:: context |
| 130 |
|
| 131 |
The :class:`Context` to which this device is bound. |
| 132 |
|
| 133 |
.. versionadded:: 0.5 |
| 134 |
|
| 135 |
.. autoattribute:: sys_path |
| 136 |
|
| 137 |
.. autoattribute:: sys_name |
| 138 |
|
| 139 |
.. autoattribute:: sys_number |
| 140 |
|
| 141 |
.. autoattribute:: device_path |
| 142 |
|
| 143 |
.. autoattribute:: tags |
| 144 |
|
| 145 |
.. rubric:: Device driver and subsystem |
| 146 |
|
| 147 |
.. autoattribute:: subsystem |
| 148 |
|
| 149 |
.. autoattribute:: driver |
| 150 |
|
| 151 |
.. autoattribute:: device_type |
| 152 |
|
| 153 |
.. rubric:: Device nodes |
| 154 |
|
| 155 |
.. autoattribute:: device_node |
| 156 |
|
| 157 |
.. autoattribute:: device_number |
| 158 |
|
| 159 |
.. autoattribute:: device_links |
| 160 |
|
| 161 |
.. rubric:: Device initialization time |
| 162 |
|
| 163 |
.. autoattribute:: is_initialized |
| 164 |
|
| 165 |
.. autoattribute:: time_since_initialized |
| 166 |
|
| 167 |
.. rubric:: Device hierarchy |
| 168 |
|
| 169 |
.. autoattribute:: parent |
| 170 |
|
| 171 |
.. autoattribute:: ancestors |
| 172 |
|
| 173 |
.. autoattribute:: children |
| 174 |
|
| 175 |
.. automethod:: find_parent |
| 176 |
|
| 177 |
.. rubric:: Device events |
| 178 |
|
| 179 |
.. autoattribute:: action |
| 180 |
|
| 181 |
.. autoattribute:: sequence_number |
| 182 |
|
| 183 |
.. rubric:: Device properties |
| 184 |
|
| 185 |
.. automethod:: __iter__ |
| 186 |
|
| 187 |
.. automethod:: __len__ |
| 188 |
|
| 189 |
.. automethod:: __getitem__ |
| 190 |
|
| 191 |
.. automethod:: asint |
| 192 |
|
| 193 |
.. automethod:: asbool |
| 194 |
|
| 195 |
.. rubric:: Sysfs attributes |
| 196 |
|
| 197 |
.. autoattribute:: attributes |
| 198 |
|
| 199 |
.. rubric:: Deprecated members |
| 200 |
|
| 201 |
.. automethod:: traverse |
| 202 |
|
| 203 |
.. autoclass:: Attributes() |
| 204 |
|
| 205 |
.. attribute:: device |
| 206 |
|
| 207 |
The :class:`Device` to which these attributes belong. |
| 208 |
|
| 209 |
.. automethod:: __iter__ |
| 210 |
|
| 211 |
.. automethod:: __len__ |
| 212 |
|
| 213 |
.. automethod:: __getitem__ |
| 214 |
|
| 215 |
.. automethod:: asstring |
| 216 |
|
| 217 |
.. automethod:: asint |
| 218 |
|
| 219 |
.. automethod:: asbool |
| 220 |
|
| 221 |
.. autoclass:: Tags() |
| 222 |
|
| 223 |
.. automethod:: __iter__ |
| 224 |
|
| 225 |
.. automethod:: __contains__ |
| 226 |
|
| 227 |
|
| 228 |
:class:`Device` exceptions |
| 229 |
~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 230 |
|
| 231 |
.. autoclass:: DeviceNotFoundError |
| 232 |
|
| 233 |
.. autoclass:: DeviceNotFoundAtPathError |
| 234 |
:members: |
| 235 |
|
| 236 |
.. autoclass:: DeviceNotFoundByNameError |
| 237 |
:members: |
| 238 |
|
| 239 |
.. autoclass:: DeviceNotFoundByNumberError |
| 240 |
:members: |
| 241 |
|
| 242 |
.. autoclass:: DeviceNotFoundInEnvironmentError |
| 243 |
:members: |
| 244 |
|
| 245 |
|
| 246 |
:class:`Monitor` – device monitoring |
| 247 |
------------------------------------ |
| 248 |
|
| 249 |
.. autoclass:: Monitor() |
| 250 |
|
| 251 |
.. automethod:: from_netlink |
| 252 |
|
| 253 |
.. attribute:: context |
| 254 |
|
| 255 |
The :class:`Context` to which this monitor is bound. |
| 256 |
|
| 257 |
.. versionadded:: 0.5 |
| 258 |
|
| 259 |
.. autoattribute:: started |
| 260 |
|
| 261 |
.. automethod:: fileno |
| 262 |
|
| 263 |
.. automethod:: filter_by |
| 264 |
|
| 265 |
.. automethod:: filter_by_tag |
| 266 |
|
| 267 |
.. automethod:: remove_filter |
| 268 |
|
| 269 |
.. automethod:: start |
| 270 |
|
| 271 |
.. automethod:: set_receive_buffer_size |
| 272 |
|
| 273 |
.. automethod:: poll |
| 274 |
|
| 275 |
.. rubric:: Deprecated members |
| 276 |
|
| 277 |
.. automethod:: enable_receiving |
| 278 |
|
| 279 |
.. automethod:: receive_device |
| 280 |
|
| 281 |
.. automethod:: __iter__ |
| 282 |
|
| 283 |
|
| 284 |
:class:`MonitorObserver` – asynchronous device monitoring |
| 285 |
--------------------------------------------------------- |
| 286 |
|
| 287 |
.. autoclass:: MonitorObserver |
| 288 |
|
| 289 |
.. attribute:: monitor |
| 290 |
|
| 291 |
Get the :class:`Monitor` observer by this object. |
| 292 |
|
| 293 |
.. automethod:: __init__ |
| 294 |
|
| 295 |
.. automethod:: send_stop |
| 296 |
|
| 297 |
.. automethod:: stop |