forked from enlightenment/efl
watches that use types will actually work now! also, documentation on ecore_fd_handlers is very misleading
SVN revision: 48825
This commit is contained in:
parent
0f4eb30d82
commit
0b3d445747
|
@ -34,9 +34,9 @@ _get_syspath_from_watch(void *data, Ecore_Fd_Handler *fd_handler)
|
||||||
int cap = 0;
|
int cap = 0;
|
||||||
|
|
||||||
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
|
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
|
||||||
return 0;
|
return 1;
|
||||||
device = udev_monitor_receive_device(store->mon);
|
device = udev_monitor_receive_device(store->mon);
|
||||||
if (!device) return 0;
|
if (!device) return 1;
|
||||||
|
|
||||||
switch (store->type)
|
switch (store->type)
|
||||||
{
|
{
|
||||||
|
@ -93,14 +93,14 @@ _get_syspath_from_watch(void *data, Ecore_Fd_Handler *fd_handler)
|
||||||
if (!test)
|
if (!test)
|
||||||
{
|
{
|
||||||
udev_device_unref(device);
|
udev_device_unref(device);
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
ret = eina_stringshare_add(udev_device_get_syspath(device));
|
ret = eina_stringshare_add(udev_device_get_syspath(device));
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
udev_device_unref(device);
|
udev_device_unref(device);
|
||||||
eina_stringshare_del(test);
|
eina_stringshare_del(test);
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
udev_device_unref(device);
|
udev_device_unref(device);
|
||||||
|
@ -113,7 +113,7 @@ _get_syspath_from_watch(void *data, Ecore_Fd_Handler *fd_handler)
|
||||||
|
|
||||||
error:
|
error:
|
||||||
udev_device_unref(device);
|
udev_device_unref(device);
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Add a watch in a subsystem for a device type
|
* Add a watch in a subsystem for a device type
|
||||||
|
@ -150,31 +150,31 @@ e_udev_watch_add(Eudev_Type type, void(*func)(const char *, const char *, void *
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case EUDEV_TYPE_KEYBOARD:
|
case EUDEV_TYPE_KEYBOARD:
|
||||||
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", "usb_interface");
|
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL);
|
||||||
break;
|
break;
|
||||||
case EUDEV_TYPE_MOUSE:
|
case EUDEV_TYPE_MOUSE:
|
||||||
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", "usb_interface");
|
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL);
|
||||||
break;
|
break;
|
||||||
case EUDEV_TYPE_TOUCHPAD:
|
case EUDEV_TYPE_TOUCHPAD:
|
||||||
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", "usb_interface");
|
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL);
|
||||||
break;
|
break;
|
||||||
case EUDEV_TYPE_DRIVE_MOUNTABLE:
|
case EUDEV_TYPE_DRIVE_MOUNTABLE:
|
||||||
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", "disk");
|
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL);
|
||||||
break;
|
break;
|
||||||
case EUDEV_TYPE_DRIVE_INTERNAL:
|
case EUDEV_TYPE_DRIVE_INTERNAL:
|
||||||
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", "disk");
|
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL);
|
||||||
break;
|
break;
|
||||||
case EUDEV_TYPE_DRIVE_REMOVABLE:
|
case EUDEV_TYPE_DRIVE_REMOVABLE:
|
||||||
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", "disk");
|
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL);
|
||||||
break;
|
break;
|
||||||
case EUDEV_TYPE_DRIVE_CDROM:
|
case EUDEV_TYPE_DRIVE_CDROM:
|
||||||
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", "disk");
|
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL);
|
||||||
break;
|
break;
|
||||||
case EUDEV_TYPE_POWER_AC:
|
case EUDEV_TYPE_POWER_AC:
|
||||||
udev_monitor_filter_add_match_subsystem_devtype(mon, "power_supply", "*");
|
udev_monitor_filter_add_match_subsystem_devtype(mon, "power_supply", NULL);
|
||||||
break;
|
break;
|
||||||
case EUDEV_TYPE_POWER_BAT:
|
case EUDEV_TYPE_POWER_BAT:
|
||||||
udev_monitor_filter_add_match_subsystem_devtype(mon, "power_supply", "*");
|
udev_monitor_filter_add_match_subsystem_devtype(mon, "power_supply", NULL);
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
case EUDEV_TYPE_ANDROID:
|
case EUDEV_TYPE_ANDROID:
|
||||||
|
@ -233,8 +233,11 @@ e_udev_watch_del(Eudev_Watch *watch)
|
||||||
udev_monitor_unref(mon);
|
udev_monitor_unref(mon);
|
||||||
udev_unref(udev);
|
udev_unref(udev);
|
||||||
sdata = ecore_main_fd_handler_del(handler);
|
sdata = ecore_main_fd_handler_del(handler);
|
||||||
ret = sdata->data;
|
if (sdata)
|
||||||
free(sdata);
|
{
|
||||||
|
ret = sdata->data;
|
||||||
|
free(sdata);
|
||||||
|
}
|
||||||
free(watch);
|
free(watch);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue