fix stupid formatting from buggy editor, fix all compiler warnings, fix bug with name filtering
SVN revision: 48827
This commit is contained in:
parent
0b3d445747
commit
9392349756
|
@ -159,4 +159,6 @@ int main()
|
|||
|
||||
/* main loop must be started to use ecore fd polling */
|
||||
ecore_main_loop_begin();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -56,11 +56,11 @@ e_udev_find_by_type(const Eudev_Type etype, const char *name)
|
|||
struct udev *udev;
|
||||
struct udev_enumerate *en;
|
||||
struct udev_list_entry *devs, *cur;
|
||||
struct udev_device *device, *parent;
|
||||
const char *sysname, *devname;
|
||||
struct udev_device *device;
|
||||
const char *devname;
|
||||
Eina_List *ret = NULL;
|
||||
|
||||
if (!etype && !name) return NULL;
|
||||
if ((!etype) && (!name)) return NULL;
|
||||
|
||||
udev = udev_new();
|
||||
if (!udev) return NULL;
|
||||
|
@ -129,7 +129,7 @@ e_udev_find_by_type(const Eudev_Type etype, const char *name)
|
|||
device = udev_device_new_from_syspath(udev, devname);
|
||||
|
||||
if (name)
|
||||
if (!strstr(sysname,name))
|
||||
if (!strstr(devname,name))
|
||||
goto out;
|
||||
|
||||
ret = eina_list_append(ret, eina_stringshare_add(udev_device_get_property_value(device, "DEVPATH")));
|
||||
|
@ -162,11 +162,11 @@ e_udev_find_by_filter(const char *subsystem, const char *type, const char *name)
|
|||
struct udev *udev;
|
||||
struct udev_enumerate *en;
|
||||
struct udev_list_entry *devs, *cur;
|
||||
struct udev_device *device, *parent;
|
||||
const char *sysname, *id_type, *devname;
|
||||
struct udev_device *device;
|
||||
const char *devname;
|
||||
Eina_List *ret = NULL;
|
||||
|
||||
if (!subsystem && !type && !name) return NULL;
|
||||
if ((!subsystem) && (!type) && (!name)) return NULL;
|
||||
|
||||
udev = udev_new();
|
||||
if (!udev) return NULL;
|
||||
|
@ -186,7 +186,7 @@ e_udev_find_by_filter(const char *subsystem, const char *type, const char *name)
|
|||
device = udev_device_new_from_syspath(udev, devname);
|
||||
|
||||
if (name)
|
||||
if (!strstr(sysname,name))
|
||||
if (!strstr(devname,name))
|
||||
goto out;
|
||||
|
||||
ret = eina_list_append(ret, eina_stringshare_add(udev_device_get_property_value(device, "DEVPATH")));
|
||||
|
@ -331,7 +331,7 @@ e_udev_devpath_get_syspath(const char *devpath)
|
|||
struct udev *udev;
|
||||
struct udev_enumerate *en;
|
||||
struct udev_list_entry *devs, *cur;
|
||||
struct udev_device *device, *parent;
|
||||
struct udev_device *device;
|
||||
const char *name, *ret;
|
||||
|
||||
if (!devpath) return NULL;
|
||||
|
|
|
@ -23,7 +23,6 @@ e_udev_init(void)
|
|||
|
||||
return _e_eeze_udev_init_count;
|
||||
|
||||
unregister_log_domain:
|
||||
eina_log_domain_unregister(_e_eeze_udev_log_dom);
|
||||
_e_eeze_udev_log_dom = -1;
|
||||
shutdown_eina:
|
||||
|
|
|
@ -56,17 +56,17 @@ _get_syspath_from_watch(void *data, Ecore_Fd_Handler *fd_handler)
|
|||
test = udev_device_get_sysattr_value(device, "capability");
|
||||
if (test) cap = atoi(test);
|
||||
if (!(test = (udev_device_get_property_value(device, "ID_FS_USAGE"))) ||
|
||||
strcmp("filesystem", test) || cap == 52)
|
||||
(strcmp("filesystem", test)) || (cap == 52))
|
||||
goto error;
|
||||
break;
|
||||
case EUDEV_TYPE_DRIVE_INTERNAL:
|
||||
if (!(test = udev_device_get_property_value(device, "ID_BUS")) || strcmp("ata", test) ||
|
||||
!(test = udev_device_get_sysattr_value(device, "removable")) || atoi(test))
|
||||
if (!(test = udev_device_get_property_value(device, "ID_BUS")) || (strcmp("ata", test)) ||
|
||||
!(test = udev_device_get_sysattr_value(device, "removable")) || (atoi(test)))
|
||||
goto error;
|
||||
break;
|
||||
case EUDEV_TYPE_DRIVE_REMOVABLE:
|
||||
if ((!(test = udev_device_get_sysattr_value(device, "removable")) || !atoi(test)) &&
|
||||
(!(test = udev_device_get_sysattr_value(device, "capability")) || atoi(test) != 10))
|
||||
if ((!(test = udev_device_get_sysattr_value(device, "removable")) || (!atoi(test))) &&
|
||||
(!(test = udev_device_get_sysattr_value(device, "capability")) || (atoi(test) != 10)))
|
||||
goto error;
|
||||
break;
|
||||
case EUDEV_TYPE_DRIVE_CDROM:
|
||||
|
@ -75,11 +75,11 @@ _get_syspath_from_watch(void *data, Ecore_Fd_Handler *fd_handler)
|
|||
break;
|
||||
case EUDEV_TYPE_POWER_AC:
|
||||
if (!(test = (udev_device_get_property_value(device, "POWER_SUPPLY_TYPE"))) ||
|
||||
strcmp("Mains", test))
|
||||
(strcmp("Mains", test)))
|
||||
break;
|
||||
case EUDEV_TYPE_POWER_BAT:
|
||||
if (!(test = (udev_device_get_property_value(device, "POWER_SUPPLY_TYPE"))) ||
|
||||
strcmp("Battery", test))
|
||||
(strcmp("Battery", test)))
|
||||
break;
|
||||
/*
|
||||
case EUDEV_TYPE_ANDROID:
|
||||
|
@ -137,7 +137,6 @@ e_udev_watch_add(Eudev_Type type, void(*func)(const char *, const char *, void *
|
|||
Ecore_Fd_Handler *handler;
|
||||
Eudev_Watch *watch;
|
||||
struct _store_data *store;
|
||||
const char *subsystem, *device_type;
|
||||
|
||||
if (!(store = malloc(sizeof(struct _store_data)))) return NULL;
|
||||
if (!(watch = malloc(sizeof(Eudev_Watch))))
|
||||
|
@ -227,7 +226,7 @@ e_udev_watch_del(Eudev_Watch *watch)
|
|||
struct _store_data *sdata;
|
||||
void *ret;
|
||||
|
||||
if (!watch || !mon || !handler) return NULL;
|
||||
if ((!watch) || (!mon) || (!handler)) return NULL;
|
||||
|
||||
udev = udev_monitor_get_udev(mon);
|
||||
udev_monitor_unref(mon);
|
||||
|
|
Loading…
Reference in New Issue