fix compile error, add new private function to walk_get sysattr value, fix internal/removable drive detection

SVN revision: 49084
This commit is contained in:
Mike Blumenkrantz 2010-05-21 05:18:24 +00:00
parent e13e6ce071
commit 2133ccd144
4 changed files with 31 additions and 2 deletions

View File

@ -452,6 +452,7 @@ eeze_udev_syspath_is_touchpad(const char *syspath)
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
touchpad = _walk_parents_test_attr(device, "resolution", NULL);
#else
const char *test;
test = udev_device_get_property_value(device, "ID_INPUT_TOUCHPAD");
if (test) touchpad = atoi(test);
#endif

View File

@ -220,7 +220,6 @@ eeze_udev_find_by_type(const Eeze_Udev_Type etype, const char *name)
case EEZE_UDEV_TYPE_DRIVE_REMOVABLE:
udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_property(en, "ID_TYPE", "disk");
udev_enumerate_add_match_sysattr(en, "removable", "1");
break;
case EEZE_UDEV_TYPE_DRIVE_CDROM:
udev_enumerate_add_match_subsystem(en, "block");
@ -274,6 +273,17 @@ eeze_udev_find_by_type(const Eeze_Udev_Type etype, const char *name)
}
}
else if (etype == EEZE_UDEV_TYPE_DRIVE_INTERNAL)
{
if (udev_device_get_property_value(device, "ID_USB_DRIVER"))
goto out;
}
else if (etype == EEZE_UDEV_TYPE_DRIVE_REMOVABLE)
{
if (!(test = udev_device_get_property_value(device, "ID_USB_DRIVER")))
goto out;
}
if (name)
if (!strstr(devname, name))
goto out;

View File

@ -32,6 +32,24 @@ _walk_parents_test_attr(struct udev_device *device, const char *sysattr, const c
return 0;
}
const char *
_walk_parents_get_attr(struct udev_device *device, const char *sysattr)
{
struct udev_device *parent, *child = device;
const char *test;
if ((test = udev_device_get_sysattr_value(device, sysattr)))
return eina_stringshare_add(test);
parent = udev_device_get_parent(child);
for (; parent; child = parent, parent = udev_device_get_parent(child))
{
if ((test = udev_device_get_sysattr_value(parent, sysattr)))
return eina_stringshare_add(test);
}
return NULL;
}
/**
* check a list for all parents of a device,
* stringshare adding all devices that are not in the list

View File

@ -23,8 +23,8 @@ extern int _e_eeze_udev_log_dom;
#define WARN(...) EINA_LOG_DOM_WARN(_e_eeze_udev_log_dom, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_e_eeze_udev_log_dom, __VA_ARGS__)
/* from watch.c */
Eina_Bool _walk_parents_test_attr(struct udev_device *device, const char *sysattr, const char* value);
const char *_walk_parents_get_attr(struct udev_device *device, const char *sysattr);
void _get_unlisted_parents(Eina_List *list, struct udev_device *device);
#endif