summaryrefslogtreecommitdiff
path: root/firmware/usbstack/usb_core.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-03-10 20:55:24 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-03-10 20:55:24 +0000
commit745133014e6161c4d8c7a7eab137b7d9b1174c55 (patch)
tree0731cf8a30b17dae164e4240e48b28782cdf5a06 /firmware/usbstack/usb_core.c
parent9d32b6aa1776db210d5c01589704a65238240df2 (diff)
downloadrockbox-745133014e6161c4d8c7a7eab137b7d9b1174c55.zip
rockbox-745133014e6161c4d8c7a7eab137b7d9b1174c55.tar.gz
rockbox-745133014e6161c4d8c7a7eab137b7d9b1174c55.tar.bz2
rockbox-745133014e6161c4d8c7a7eab137b7d9b1174c55.tar.xz
make the usb storage driver handle hotswap correctly, and exit the usb screen once all drives are "ejected" (either as a command from the OS or physically)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16617 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usbstack/usb_core.c')
-rw-r--r--firmware/usbstack/usb_core.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c
index e0aaa9b..aa46865 100644
--- a/firmware/usbstack/usb_core.c
+++ b/firmware/usbstack/usb_core.c
@@ -199,7 +199,10 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
.init = usb_storage_init,
.disconnect = NULL,
.transfer_complete = usb_storage_transfer_complete,
- .control_request = usb_storage_control_request
+ .control_request = usb_storage_control_request,
+#ifdef HAVE_HOTSWAP
+ .notify_hotswap = usb_storage_notify_hotswap,
+#endif
},
#endif
#ifdef USB_SERIAL
@@ -213,7 +216,10 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
.init = usb_serial_init,
.disconnect = usb_serial_disconnect,
.transfer_complete = usb_serial_transfer_complete,
- .control_request = usb_serial_control_request
+ .control_request = usb_serial_control_request,
+#ifdef HAVE_HOTSWAP
+ .notify_hotswap = NULL,
+#endif
},
#endif
#ifdef USB_CHARGING_ONLY
@@ -227,7 +233,10 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
.init = NULL,
.disconnect = NULL,
.transfer_complete = NULL,
- .control_request = NULL
+ .control_request = NULL,
+#ifdef HAVE_HOTSWAP
+ .notify_hotswap = NULL,
+#endif
},
#endif
};
@@ -386,6 +395,20 @@ bool usb_core_driver_enabled(int driver)
return drivers[driver].enabled;
}
+#ifdef HAVE_HOTSWAP
+void usb_core_hotswap_event(int volume,bool inserted)
+{
+ int i;
+ for(i=0;i<USB_NUM_DRIVERS;i++) {
+ if(drivers[i].enabled &&
+ drivers[i].notify_hotswap!=NULL)
+ {
+ drivers[i].notify_hotswap(volume,inserted);
+ }
+ }
+}
+#endif
+
static void usb_core_set_serial_function_id(void)
{
int id = 0;