type = eeze_udev_find_unlisted_similar(type);
EINA_LIST_FREE(type, name) /* get a property using the device's syspath */
{
- if ((check = eeze_udev_syspath_get_property(name, "ID_MODEL")))
+ if ((check = eeze_udev_syspath_get_sysattr(name, "model")))
{
- check2 = eeze_udev_syspath_get_property(name, "ID_BUS");
- printf("\tOoh, a %s attached on your %s bus!\n", check, check2);
+ check2 = eeze_udev_syspath_get_subsystem(name);
+ printf("\tOoh, a %s attached to the %s subsytem!\n", check, check2);
eina_stringshare_del(check);
eina_stringshare_del(check2);
}
* This function will update @p list to include all devices matching
* devices with syspaths currently stored in @p list. All strings are
* stringshared.
+ *
+ * @note This is an expensive call, do not use it unless you must.
*/
EAPI Eina_List *eeze_udev_find_unlisted_similar(Eina_List *list);
if ((vendor = udev_device_get_property_value(device, "ID_VENDOR_ID")))
udev_enumerate_add_match_property(en, "ID_VENDOR_ID", vendor);
- else
- if ((vendor = udev_device_get_property_value(device, "ID_VENDOR")))
+ else if ((vendor = udev_device_get_property_value(device, "ID_VENDOR")))
udev_enumerate_add_match_property(en, "ID_VENDOR", vendor);
+ else if ((vendor = udev_device_get_sysattr_value(device, "vendor")))
+ udev_enumerate_add_match_sysattr(en, "vendor", vendor);
+ else if ((vendor = udev_device_get_sysattr_value(device, "manufacturer")))
+ udev_enumerate_add_match_sysattr(en, "manufacturer", vendor);
if ((model = udev_device_get_property_value(device, "ID_MODEL_ID")))
udev_enumerate_add_match_property(en, "ID_MODEL_ID", model);
- else
- if ((model = udev_device_get_property_value(device, "ID_MODEL")))
+ else if ((model = udev_device_get_property_value(device, "ID_MODEL")))
udev_enumerate_add_match_property(en, "ID_MODEL", model);
+ else if ((model = udev_device_get_sysattr_value(device, "model")))
+ udev_enumerate_add_match_sysattr(en, "model", model);
+ else if ((model = udev_device_get_sysattr_value(device, "product")))
+ udev_enumerate_add_match_sysattr(en, "product", model);
if ((revision = udev_device_get_property_value(device, "ID_REVISION")))
udev_enumerate_add_match_property(en, "ID_REVISION", revision);
+ else if ((revision = udev_device_get_sysattr_value(device, "revision")))
+ udev_enumerate_add_match_sysattr(en, "revision", revision);
+
+ udev_enumerate_add_match_subsystem(en, udev_device_get_subsystem(device));
udev_enumerate_scan_devices(en);
udev_device_unref(device);
_udev_enumerate *en;
_udev_list_entry *devs, *cur;
_udev_device *device, *parent;
- const char *devname, *test;
+ const char *devname;
Eina_List *ret = NULL;
if ((!etype) && (!name))
case EEZE_UDEV_TYPE_DRIVE_MOUNTABLE:
udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_property(en, "ID_FS_USAGE", "filesystem");
- /* parent node */
- udev_enumerate_add_nomatch_sysattr(en, "capability", "50");
break;
case EEZE_UDEV_TYPE_DRIVE_INTERNAL:
break;
case EEZE_UDEV_TYPE_DRIVE_REMOVABLE:
- udev_enumerate_add_match_subsystem(en, "block");
+ udev_enumerate_add_match_sysattr(en, "removable", "1");
udev_enumerate_add_match_property(en, "ID_TYPE", "disk");
break;
case EEZE_UDEV_TYPE_DRIVE_CDROM:
- udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_property(en, "ID_CDROM", "1");
break;
goto out;
}
}
- 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_BUS")) || (!strncmp(test, "ata", 3)))
- goto out;
+ /* this yields the actual hw device, not to be confused with the filesystem */
+ devname = udev_device_get_syspath(udev_device_get_parent(device));
}
else if (etype == EEZE_UDEV_TYPE_DRIVE_MOUNTABLE)
{
int devcheck;
- devcheck = open(udev_device_get_devnode(device), O_RDONLY | O_EXCL);
+ devcheck = open(udev_device_get_devnode(device), O_RDONLY);
if (devcheck < 0) goto out;
close(devcheck);
}
if (!(vendor = udev_device_get_property_value(child, "ID_VENDOR_ID")))
vendor = udev_device_get_property_value(child, "ID_VENDOR");
+ if (!vendor) vendor = udev_device_get_sysattr_value(child, "vendor");
+ if (!vendor) vendor = udev_device_get_sysattr_value(child, "manufacturer");
if (!(model = udev_device_get_property_value(child, "ID_MODEL_ID")))
model = udev_device_get_property_value(child, "ID_MODEL");
+ if (!model) model = udev_device_get_sysattr_value(child, "model");
+ if (!model) model = udev_device_get_sysattr_value(child, "product");
parent = udev_device_get_parent(child);
if (!(vendor2 = udev_device_get_property_value(child, "ID_VENDOR_ID")))
vendor2 = udev_device_get_property_value(child, "ID_VENDOR");
+ if (!vendor2) vendor2 = udev_device_get_sysattr_value(child, "vendor");
+ if (!vendor2) vendor2 = udev_device_get_sysattr_value(child, "manufacturer");
if (!(model2 = udev_device_get_property_value(child, "ID_MODEL_ID")))
model2 = udev_device_get_property_value(child, "ID_MODEL");
+ if (!model2) model2 = udev_device_get_sysattr_value(child, "model");
+ if (!model2) model2 = udev_device_get_sysattr_value(child, "product");
if ((!model2 && model) || (model2 && !model) || (!vendor2 && vendor)
|| (vendor2 && !vendor))
Eeze_Udev_Watch_Cb func = store->func;
void *sdata = store->data;
Eeze_Udev_Watch *watch = store->watch;
- int cap = 0, event = 0;
+ int event = 0;
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
return EINA_TRUE;
|| (strcmp(test, "block")))
goto error;
#endif
- test = udev_device_get_sysattr_value(device, "capability");
-
- if (test)
- cap = strtol(test, NULL, 10);
-
if (!(test = (udev_device_get_property_value(device, "ID_FS_USAGE"))) ||
- (strcmp("filesystem", test)) || (cap == 50))
+ (strcmp("filesystem", test)))
goto error;
{
int devcheck;
- devcheck = open(udev_device_get_devnode(device), O_RDONLY | O_EXCL);
+ devcheck = open(udev_device_get_devnode(device), O_RDONLY);
if (devcheck < 0) goto error;
close(devcheck);
}
break;
case EEZE_UDEV_TYPE_DRIVE_INTERNAL:
-#ifdef OLD_UDEV_RRRRRRRRRRRRRR
- if ((!(test = udev_device_get_subsystem(device)))
- || (strcmp(test, "block")))
- goto error;
-#endif
- if (!(test = udev_device_get_property_value(device, "ID_BUS"))
- || (strcmp("ata", test))
- || !(test = udev_device_get_sysattr_value(device, "removable"))
- || (strtol(test, NULL, 10)))
- goto error;
+ if (udev_device_get_property_value(device, "ID_FS_USAGE")) goto error;
+ test = udev_device_get_sysattr_value(device, "removable");
+ if (test[0] == '1') goto error;
break;
case EEZE_UDEV_TYPE_DRIVE_REMOVABLE:
-#ifdef OLD_UDEV_RRRRRRRRRRRRRR
- if ((!(test = udev_device_get_subsystem(device)))
- || (strcmp(test, "block")))
- goto error;
-#endif
- if ((!(test = udev_device_get_sysattr_value(device, "removable"))
- || (!strtol(test, NULL, 10)))
- && (!(test = udev_device_get_sysattr_value(device, "capability"))
- || (strtol(test, NULL, 10) != 10)))
- goto error;
+ if (udev_device_get_property_value(device, "ID_FS_USAGE")) goto error;
+ test = udev_device_get_sysattr_value(device, "removable");
+ if (test[0] == '0') goto error;
break;
case EEZE_UDEV_TYPE_DRIVE_CDROM:
-#ifdef OLD_UDEV_RRRRRRRRRRRRRR
- if ((!(test = udev_device_get_subsystem(device)))
- || (strcmp(test, "block")))
- goto error;
-#endif
if (!udev_device_get_property_value(device, "ID_CDROM"))
goto error;
break;
case EEZE_UDEV_TYPE_DRIVE_INTERNAL:
- udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL);
+ udev_monitor_filter_add_match_subsystem_devtype(mon, NULL, "disk");
break;
case EEZE_UDEV_TYPE_DRIVE_REMOVABLE:
- udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL);
+ udev_monitor_filter_add_match_subsystem_devtype(mon, NULL, "disk");
break;
case EEZE_UDEV_TYPE_DRIVE_CDROM: