summaryrefslogtreecommitdiff
path: root/firmware/usbstack
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2007-11-23 15:02:26 +0000
committerBjörn Stenberg <bjorn@haxx.se>2007-11-23 15:02:26 +0000
commit20dbc1b21f38c6caad13de485c68444c752380fc (patch)
treec8741e05cd054e4642cb2277a8bcdf8bd775601d /firmware/usbstack
parentf7f7967943b273b6c9b8212df1db9c3713ece013 (diff)
downloadrockbox-20dbc1b21f38c6caad13de485c68444c752380fc.zip
rockbox-20dbc1b21f38c6caad13de485c68444c752380fc.tar.gz
rockbox-20dbc1b21f38c6caad13de485c68444c752380fc.tar.bz2
rockbox-20dbc1b21f38c6caad13de485c68444c752380fc.tar.xz
Re-added USB charger detection and auto reboot on host connect.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15774 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usbstack')
-rw-r--r--firmware/usbstack/usb_core.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c
index 7f610ff..8e71c77 100644
--- a/firmware/usbstack/usb_core.c
+++ b/firmware/usbstack/usb_core.c
@@ -292,6 +292,7 @@ static const struct {
static int usb_address = 0;
static bool initialized = false;
+static bool data_connection = false;
static struct event_queue usbcore_queue;
#ifdef USB_STORAGE
@@ -305,6 +306,9 @@ static void ack_control(struct usb_ctrlrequest* req);
void usb_core_init(void)
{
+ if (initialized)
+ return;
+
queue_init(&usbcore_queue, false);
usb_drv_init();
#ifdef USB_STORAGE
@@ -331,10 +335,16 @@ void usb_core_exit(void)
#ifdef USB_STORAGE
remove_thread(usbcore_thread);
#endif
+ data_connection = false;
}
logf("usb_core_exit() finished");
}
+bool usb_core_data_connection(void)
+{
+ return data_connection;
+}
+
#ifdef USB_STORAGE
void usb_core_thread(void)
{
@@ -352,6 +362,7 @@ void usb_core_thread(void)
void usb_core_control_request(struct usb_ctrlrequest* req)
{
/* note: interrupt context */
+ data_connection = true;
#ifdef USB_BENCHMARK
if ((req->bRequestType & 0x60) == USB_TYPE_VENDOR) {
@@ -499,6 +510,7 @@ void usb_core_control_request(struct usb_ctrlrequest* req)
void usb_core_bus_reset(void)
{
usb_address = 0;
+ data_connection = false;
}
/* called by usb_drv_transfer_completed() */