add and implement EEZE_DISK_TYPE_FLASH for flash cards

SVN revision: 62879
This commit is contained in:
Mike Blumenkrantz 2011-08-26 20:04:35 +00:00
parent ba66da6e8b
commit 59ede5ee9f
2 changed files with 18 additions and 5 deletions

View File

@ -36,9 +36,10 @@ extern "C" {
typedef enum
{
EEZE_DISK_TYPE_UNKNOWN = 0, /**< type could not be determined */
EEZE_DISK_TYPE_INTERNAL = 1, /**< internal drive */
EEZE_DISK_TYPE_CDROM = 2, /**< cdrom drive */
EEZE_DISK_TYPE_USB = 4 /**< usb drive */
EEZE_DISK_TYPE_INTERNAL = (1 << 0), /**< internal drive */
EEZE_DISK_TYPE_CDROM = (1 << 1), /**< cdrom drive */
EEZE_DISK_TYPE_USB = (1 << 2), /**< usb drive */
EEZE_DISK_TYPE_FLASH = (1 << 3) /**< flash disk */
} Eeze_Disk_Type;
typedef enum

View File

@ -54,11 +54,23 @@ _eeze_disk_type_find(Eeze_Disk *disk)
if ((!test) && (!filesystem))
test = _walk_children_get_attr(disk->syspath, "ID_BUS", "block", EINA_TRUE);
if (!test)
return EEZE_DISK_TYPE_UNKNOWN; /* FIXME */
{
_udev_device *dev;
for (dev = udev_device_get_parent(disk->device); dev; dev = udev_device_get_parent(dev))
{
test = udev_device_get_subsystem(dev);
if (!test) return EEZE_DISK_TYPE_UNKNOWN;
if (!strcmp(test, "block"))) continue;
if (!strcmp(test, "mmc")) return EEZE_DISK_TYPE_FLASH;
break;
}
return EEZE_DISK_TYPE_UNKNOWN; /* FIXME */
}
if (!strcmp(test, "ata")) ret = EEZE_DISK_TYPE_INTERNAL;
else if (!strcmp(test, "usb")) ret = EEZE_DISK_TYPE_USB;
else ret = EEZE_DISK_TYPE_UNKNOWN;
else ret = EEZE_DISK_TYPE_UNKNOWN; /* FIXME */
eina_stringshare_del(test);