diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Eeze_Disk.h | 7 | ||||
-rw-r--r-- | src/lib/eeze_disk.c | 16 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/lib/Eeze_Disk.h b/src/lib/Eeze_Disk.h index 31e5fa6..23d7036 100644 --- a/src/lib/Eeze_Disk.h +++ b/src/lib/Eeze_Disk.h @@ -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 diff --git a/src/lib/eeze_disk.c b/src/lib/eeze_disk.c index 5a0e08c..6a9b55a 100644 --- a/src/lib/eeze_disk.c +++ b/src/lib/eeze_disk.c @@ -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); |