Base wrapper class¶
Basic usage¶
Wrapper
class provides access to common basic
information about all device types.
Example:
>>> devs = list(udev.devices_by_subsystem('net'))
>>> device = wrapper.Wrapper(devs[0])
>>> device.bus
u'pci'
>>> device.model
u'Wireless 7260 (Dual Band Wireless-AC 7260)'
>>> device.name
u'wlp2s0'
>>> device.vendor
u'Intel Corporate'
>>> device.system_path
u'/sys/devices/pci0000:00/0000:00:1c.3/0000:02:00.0/net/wlp2s0'
>>> device.devid
(u'0x8086', u'0x08b1')
Module contents¶
-
class
hwd.wrapper.
Wrapper
(dev)¶ Generic wrapper class that wraps
pyudev.Device
instances.dev
is apyudev.Device
instance. Device’ssys_name
property is stored asname
property on the wrapper instance.-
aliases
¶ Return a list of device aliases (symlinks) that match this device. This list also includes the device node so it can be treated as a list of all filesystem objects that point to this device.
-
bus
¶ Device’s bus. If device is not on any bus, this property evaluates to
None
.
-
device
¶ The underlaying
pyudev.Device
instance can be accessed by using thedevice
property. This propety is cached, so only one lookup is performed to obtain the device object. This cache is invalidated byrefresh()
method.
-
devid
¶ Two-tuple containing device’s vendor ID and model ID (hex).
-
model
¶ First non-empty value from the following list:
- model name from model database
- model name as reported by the device driver
- model ID (hex)
If none of the above attributes are available, evaluates to
None
.
-
node
¶ Device node. Not all devices have a node. In case a device has no node, this property evaluates to
None
.
-
refresh
()¶ Clears the
device
cache.Note
This method does not cause immediate lookup of the udev context. Lookup is done when the
device
property is accessed.
-
system_path
¶ System path of the device.
-
vendor
¶ First non-empty value from the following list:
- organization name (OUI) from device database
- vendor from vendor database
- vendor as reported by the device driver
- vendor ID (hex)
If none of the above attributes are available, evaluates to
None
.
-