33 lines
1000 B
Diff
33 lines
1000 B
Diff
From 39aa7041481f6e5cf954e67661f2cb55d43f9441 Mon Sep 17 00:00:00 2001
|
|
From: David Lehman <dlehman@redhat.com>
|
|
Date: Thu, 8 Mar 2018 11:40:48 -0500
|
|
Subject: [PATCH] Allow device specification by node to udev.get_device.
|
|
(#1524700)
|
|
|
|
---
|
|
blivet/udev.py | 7 +++++--
|
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/blivet/udev.py b/blivet/udev.py
|
|
index 6936a230..6eb7dab0 100644
|
|
--- a/blivet/udev.py
|
|
+++ b/blivet/udev.py
|
|
@@ -56,9 +56,12 @@ def device_to_dict(device):
|
|
return result
|
|
|
|
|
|
-def get_device(sysfs_path):
|
|
+def get_device(sysfs_path=None, device_node=None):
|
|
try:
|
|
- device = pyudev.Devices.from_sys_path(global_udev, sysfs_path)
|
|
+ if sysfs_path is not None:
|
|
+ device = pyudev.Devices.from_sys_path(global_udev, sysfs_path)
|
|
+ elif device_node is not None:
|
|
+ device = pyudev.Devices.from_device_file(global_udev, device_node)
|
|
except pyudev.DeviceNotFoundError as e:
|
|
log.error(e)
|
|
result = None
|
|
--
|
|
2.14.3
|
|
|