diff options
Diffstat (limited to 'bootloader/x1000.c')
-rw-r--r-- | bootloader/x1000.c | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/bootloader/x1000.c b/bootloader/x1000.c index 1c9f3cd2fa..bc56b8f822 100644 --- a/bootloader/x1000.c +++ b/bootloader/x1000.c | |||
@@ -56,43 +56,6 @@ | |||
56 | #include <stdio.h> | 56 | #include <stdio.h> |
57 | #include <stdarg.h> | 57 | #include <stdarg.h> |
58 | 58 | ||
59 | /* Flags to indicate if hardware was already initialized */ | ||
60 | bool usb_inited = false; | ||
61 | |||
62 | /* Set to true if a SYS_USB_CONNECTED event is seen | ||
63 | * Set to false if a SYS_USB_DISCONNECTED event is seen */ | ||
64 | bool is_usb_connected = false; | ||
65 | |||
66 | void init_usb(void) | ||
67 | { | ||
68 | if(usb_inited) | ||
69 | return; | ||
70 | |||
71 | usb_init(); | ||
72 | usb_start_monitoring(); | ||
73 | usb_inited = true; | ||
74 | } | ||
75 | |||
76 | void usb_mode(void) | ||
77 | { | ||
78 | init_usb(); | ||
79 | |||
80 | if(!is_usb_connected) | ||
81 | splash2(0, "Waiting for USB", "Press " BL_QUIT_NAME " to go back"); | ||
82 | |||
83 | while(!is_usb_connected) | ||
84 | if(get_button(TIMEOUT_BLOCK) == BL_QUIT) | ||
85 | return; | ||
86 | |||
87 | splash(0, "USB mode"); | ||
88 | usb_acknowledge(SYS_USB_CONNECTED_ACK); | ||
89 | |||
90 | while(is_usb_connected) | ||
91 | get_button(TIMEOUT_BLOCK); | ||
92 | |||
93 | splash(3*HZ, "USB disconnected"); | ||
94 | } | ||
95 | |||
96 | void main(void) | 59 | void main(void) |
97 | { | 60 | { |
98 | system_init(); | 61 | system_init(); |
@@ -110,6 +73,9 @@ void main(void) | |||
110 | 73 | ||
111 | filesystem_init(); | 74 | filesystem_init(); |
112 | 75 | ||
76 | usb_init(); | ||
77 | usb_start_monitoring(); | ||
78 | |||
113 | /* It's OK if this doesn't mount anything. Any disk access should | 79 | /* It's OK if this doesn't mount anything. Any disk access should |
114 | * be guarded by a call to check_disk() to see if the disk is really | 80 | * be guarded by a call to check_disk() to see if the disk is really |
115 | * present, blocking with an "insert SD card" prompt if appropriate. */ | 81 | * present, blocking with an "insert SD card" prompt if appropriate. */ |