summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/usb-hiby.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/usb-hiby.c')
-rw-r--r--firmware/target/hosted/usb-hiby.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/firmware/target/hosted/usb-hiby.c b/firmware/target/hosted/usb-hiby.c
index 6c35e76e29..b82fa5c4ce 100644
--- a/firmware/target/hosted/usb-hiby.c
+++ b/firmware/target/hosted/usb-hiby.c
@@ -27,8 +27,16 @@
#include "sysfs.h"
#include "power.h"
+//#define LOGF_ENABLE
+#include "logf.h"
+
static bool adb_mode = false;
+#ifdef HAVE_MULTIDRIVE
+void cleanup_rbhome(void);
+void startup_rbhome(void);
+#endif
+
/* TODO: implement usb detection properly */
int usb_detect(void)
{
@@ -37,6 +45,8 @@ int usb_detect(void)
void usb_enable(bool on)
{
+ logf("usb enable %d %d\n", on, adb_mode);
+
/* Ignore usb enable/disable when ADB is enabled so we can fireup adb shell
* without entering ums mode
*/
@@ -65,11 +75,16 @@ int disk_mount_all(void)
int rval = mount(dev[i], PIVOT_ROOT, fs[j], 0, NULL);
if (rval == 0 || errno == -EBUSY)
{
+ logf("mount good! %d/%d %d %d", i, j, rval, errno);
+#ifdef HAVE_MULTIDRIVE
+ startup_rbhome();
+#endif
return 1;
}
}
}
+ logf("mount failed! %d", errno);
return 0;
}
@@ -79,12 +94,22 @@ int disk_mount_all(void)
*/
int disk_unmount_all(void)
{
- if (umount("/mnt/sd_0") == 0)
+#ifdef HAVE_MULTIDRIVE
+ cleanup_rbhome();
+#endif
+
+ if (umount(PIVOT_ROOT) == 0)
{
sysfs_set_string("/sys/class/android_usb/android0/f_mass_storage/lun/file", "/dev/mmcblk0");
+ logf("umount_all good");
return 1;
}
+ logf("umount_all failed! %d", errno);
+#ifdef HAVE_MULTIDRIVE
+ startup_rbhome();
+#endif
+
return 0;
}