lvjin
unread,Oct 15, 2010, 4:02:23 AM10/15/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Android-x86
hi all!
I successful auto mount u-disk ever time.
I find the device can't auto mount u-disk again if you umount it,
because the sysfs path always change.
My u-disk is sdb, and i find /sys/class/block/sdb is linked to the
sysfs path, so i change the sysfs path to /sys/class/block/sdb in
vold.fstab, and modify system/vold/DirectVolume.cpp to find the real
sysfs path(device/pci0000:00/.../block/sdb) through the link(/sys/
classblock/sdb).
I don't know whether others have the same problem.
vold.fstab:
dev_mount sdcard /mnt/sdcard auto /sys/class/block/sdb
patch:
--- DirectVolume.org.cpp 2010-10-15 15:55:22.399119041 +0800
+++ DirectVolume.cpp 2010-10-12 17:26:38.829118480 +0800
@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <unistd.h>
#include <linux/kdev_t.h>
@@ -78,7 +79,17 @@
PathCollection::iterator it;
for (it = mPaths->begin(); it != mPaths->end(); ++it) {
- if (!strncmp(dp, *it, strlen(*it))) {
+
+ //make usb mass storage device can be auto mounted on x86 @
lvjin
+ int link_count;
+ char path_buf[1024] = {0};
+ char *mp;
+ link_count = readlink(*it, path_buf, 1024);
+ path_buf[1023] = '\0';
+ mp = &path_buf[5];
+
+// if (!strncmp(dp, *it, strlen(*it))) {
+ if (!strncmp(dp, mp, strlen(mp))) {
/* We can handle this disk */
int action = evt->getAction();
const char *devtype = evt->findParam("DEVTYPE");