summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/screens.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/apps/screens.c b/apps/screens.c
index 537ec9e21f..92ab2b7e4b 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -96,7 +96,10 @@ static int clamp_value_wrap(int value, int max, int min)
96#ifndef SIMULATOR 96#ifndef SIMULATOR
97static int handle_usb_events(void) 97static int handle_usb_events(void)
98{ 98{
99#if (CONFIG_STORAGE & STORAGE_MMC)
99 int next_update=0; 100 int next_update=0;
101#endif /* STORAGE_MMC */
102
100#ifdef HAVE_TOUCHSCREEN 103#ifdef HAVE_TOUCHSCREEN
101 enum touchscreen_mode old_mode = touchscreen_get_mode(); 104 enum touchscreen_mode old_mode = touchscreen_get_mode();
102 105
@@ -115,7 +118,7 @@ static int handle_usb_events(void)
115 if (hid_enabled) 118 if (hid_enabled)
116 { 119 {
117 int id = HID_CONSUMER_USAGE_UNASSIGNED; 120 int id = HID_CONSUMER_USAGE_UNASSIGNED;
118 button = get_action(CONTEXT_USB_HID, HZ/4); 121 button = get_action(CONTEXT_USB_HID, HZ/2);
119 122
120 switch (button) 123 switch (button)
121 { 124 {
@@ -147,7 +150,11 @@ static int handle_usb_events(void)
147 } 150 }
148 else 151 else
149#endif 152#endif
150 button = button_get_w_tmo(HZ/4); 153 {
154 button = button_get_w_tmo(HZ/2);
155 /* hid emits the event in get_action */
156 send_event(GUI_EVENT_ACTIONUPDATE, NULL);
157 }
151 158
152 switch(button) 159 switch(button)
153 { 160 {
@@ -158,16 +165,15 @@ static int handle_usb_events(void)
158 break; 165 break;
159 } 166 }
160 167
168#if (CONFIG_STORAGE & STORAGE_MMC) /* USB-MMC bridge can report activity */
161 if(TIME_AFTER(current_tick,next_update)) 169 if(TIME_AFTER(current_tick,next_update))
162 { 170 {
163 if(usb_inserted()) { 171 if(usb_inserted()) {
164#if (CONFIG_STORAGE & STORAGE_MMC) /* USB-MMC bridge can report activity */
165 led(mmc_usb_active(HZ)); 172 led(mmc_usb_active(HZ));
166#endif /* STORAGE_MMC */
167 gui_syncstatusbar_draw(&statusbars, false);
168 } 173 }
169 next_update=current_tick+HZ/2; 174 next_update=current_tick+HZ/2;
170 } 175 }
176#endif /* STORAGE_MMC */
171 } 177 }
172Exit: 178Exit:
173#ifdef HAVE_TOUCHSCREEN 179#ifdef HAVE_TOUCHSCREEN
@@ -224,7 +230,12 @@ void usb_screen(void)
224 viewportmanager_set_statusbar(usb_bars); 230 viewportmanager_set_statusbar(usb_bars);
225 231
226#ifdef SIMULATOR 232#ifdef SIMULATOR
227 while (button_get(true) & BUTTON_REL); 233 while (1)
234 {
235 if (button_get_w_tmo(HZ/2))
236 break;
237 send_event(GUI_EVENT_ACTIONUPDATE, NULL);
238 }
228#else 239#else
229 usb_acknowledge(SYS_USB_CONNECTED_ACK); 240 usb_acknowledge(SYS_USB_CONNECTED_ACK);
230 while (handle_usb_events()); 241 while (handle_usb_events());