From 1db3dfdd759476ae4930958ec775fd2009674091 Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Sun, 28 Nov 2010 15:22:51 +0000 Subject: Accept FS#11774 by Michael Hohmuth (with some own modifications to #ifdef conditions) Unmount all filesystems before connecting USB. This ensures that all filehandles are closed, which avoids possible filesystem corruption git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28693 a1c6a512-1295-4272-9138-f99709370657 --- firmware/usb.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'firmware/usb.c') diff --git a/firmware/usb.c b/firmware/usb.c index 9eaf2014fa..6309c1481c 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -131,6 +131,7 @@ static inline void usb_slave_mode(bool on) #ifdef HAVE_PRIORITY_SCHEDULING thread_set_priority(THREAD_ID_CURRENT, PRIORITY_REALTIME); #endif + disk_unmount_all(); usb_attach(); } else /* usb_state == USB_INSERTED (only!) */ @@ -172,6 +173,7 @@ static inline void usb_slave_mode(bool on) if(on) { DEBUGF("Entering USB slave mode\n"); + disk_unmount_all(); storage_soft_reset(); storage_init(); storage_enable(false); -- cgit v1.2.3