summaryrefslogtreecommitdiff
path: root/src/lib/eeze
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-01-29 13:46:30 -0500
committerChris Michael <cpmichael@osg.samsung.com>2016-01-29 13:46:30 -0500
commit684d5180c3bcd6054fc9a3bb9dae24f389fbac76 (patch)
treedc145729bc2cf9a675e093e7ce197032b789f0b6 /src/lib/eeze
parent40f162fbc500d7e2c51d93eff46e87c6117b7d91 (diff)
eeze: Fix eeze_udev_find_by_subsystem_sysname function
This function was severly broken when used for finding devices of a particular subsystem. Previously, this function would return every device in the system, regardless if subsystem or sysname was passed in. This patch fixes the issue by adding udev_enumerate matches before we scan for devices. This way, when we enumerate the scan results, we now get only devices that match the subsystem (if supplied). @fix Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to 'src/lib/eeze')
-rw-r--r--src/lib/eeze/eeze_udev_find.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/eeze/eeze_udev_find.c b/src/lib/eeze/eeze_udev_find.c
index 06bbb4c087..3df74cd938 100644
--- a/src/lib/eeze/eeze_udev_find.c
+++ b/src/lib/eeze/eeze_udev_find.c
@@ -392,18 +392,19 @@ eeze_udev_find_by_subsystem_sysname(const char *subsystem, const char *sysname)
392 const char *devname; 392 const char *devname;
393 Eina_List *ret = NULL; 393 Eina_List *ret = NULL;
394 394
395 if (!sysname) return NULL;
396
397 en = udev_enumerate_new(udev); 395 en = udev_enumerate_new(udev);
398 if (!en) return NULL; 396 if (!en) return NULL;
399 397
398 if (subsystem) udev_enumerate_add_match_subsystem(en, subsystem);
399 if (sysname) udev_enumerate_add_match_sysname(en, sysname);
400
400 udev_enumerate_scan_devices(en); 401 udev_enumerate_scan_devices(en);
401 devs = udev_enumerate_get_list_entry(en); 402 devs = udev_enumerate_get_list_entry(en);
402 udev_list_entry_foreach(cur, devs) 403 udev_list_entry_foreach(cur, devs)
403 { 404 {
404 devname = udev_list_entry_get_name(cur); 405 devname = udev_list_entry_get_name(cur);
405 device = 406 device = udev_device_new_from_syspath(udev, devname);
406 udev_device_new_from_subsystem_sysname(udev, subsystem, sysname); 407 if (!device) continue;
407 ret = eina_list_append(ret, eina_stringshare_add(devname)); 408 ret = eina_list_append(ret, eina_stringshare_add(devname));
408 udev_device_unref(device); 409 udev_device_unref(device);
409 } 410 }