From 9540e3cd0501fe1212f79a34c8fbc9c9e4ea6042 Mon Sep 17 00:00:00 2001 From: dhewg Date: Wed, 25 Aug 2010 22:28:07 +0200 Subject: [PATCH] restore old isInserted() behaviour --- libogc/usbstorage.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libogc/usbstorage.c b/libogc/usbstorage.c index 05a6643..b39dcbf 100644 --- a/libogc/usbstorage.c +++ b/libogc/usbstorage.c @@ -92,6 +92,7 @@ as used by libfat static usbstorage_handle __usbfd; static u8 __lun = 0; static bool __mounted = false; +static bool __removed = false; static u16 __vid = 0; static u16 __pid = 0; @@ -116,6 +117,7 @@ static s32 __usb_blkmsg_cb(s32 retval, void *dummy) static s32 __usb_deviceremoved_cb(s32 retval,void *arg) { __mounted = false; + __removed = true; return 0; } @@ -604,6 +606,7 @@ free_and_return: s32 USBStorage_Close(usbstorage_handle *dev) { __mounted = false; + __removed = false; __lun = 0; __vid = 0; __pid = 0; @@ -762,10 +765,15 @@ static bool __usbstorage_IsInserted(void) s32 maxLun; s32 retval; - if(__mounted) + if (__mounted) return true; - if(!__inited) + if (__removed) { + __removed = false; + return false; + } + + if (!__inited) return false; buffer = (usb_device_entry*)__lwp_heap_allocate(&__heap, DEVLIST_MAXSIZE * sizeof(usb_device_entry)); -- 2.11.4.GIT