diff options
author | discomfitor <discomfitor> | 2011-08-26 20:04:35 +0000 |
---|---|---|
committer | discomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33> | 2011-08-26 20:04:35 +0000 |
commit | 97273ee9e26c4cd2e2bd7753d04a9a270bd5045f (patch) | |
tree | 2dde0854e7c242cefcebde2eb417bcb6eb1067f3 /src/lib | |
parent | 107ec9071ff32dcfd18dcf9684d41914122ac4e5 (diff) | |
download | eeze-97273ee9e26c4cd2e2bd7753d04a9a270bd5045f.tar.gz eeze-97273ee9e26c4cd2e2bd7753d04a9a270bd5045f.tar.bz2 eeze-97273ee9e26c4cd2e2bd7753d04a9a270bd5045f.zip |
add and implement EEZE_DISK_TYPE_FLASH for flash cards
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eeze@62879 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33
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); |