Index: apps/screens.c =================================================================== --- apps/screens.c (revision 20139) +++ apps/screens.c (working copy) @@ -91,6 +91,90 @@ } #endif +int handle_usb_events(struct event_queue *q) +{ + struct queue_event ev; +#if defined(HAVE_USBSTACK) && defined(USE_ROCKBOX_USB) + int read_sectors_per_period[NUM_VOLUMES]={0}; + int write_sectors_per_period[NUM_VOLUMES]={0}; +#endif + int next_update=0; + + /* Don't return until we get SYS_USB_DISCONNECTED or SYS_TIMEOUT */ + while(1) + { + queue_wait_w_tmo(q, &ev, 1); + switch(ev.id) + { + case SYS_USB_DISCONNECTED: + usb_acknowledge(SYS_USB_DISCONNECTED_ACK); + return 0; +#if defined(HAVE_USBSTACK) && defined(USE_ROCKBOX_USB) + case SYS_USB_LUN_LOCKED: + { + int lun,value; + lun=ev.data>>16; + value=ev.data&0x0000ffff; + if(value) + screens[0].set_foreground(LCD_RGBPACK(0xff,0,0)); + else + screens[0].set_foreground(LCD_RGBPACK(0,0xff,0)); + screens[0].fillrect(30,30*lun+40,20,20); + break; + } + case SYS_USB_READ_DATA: + { + int lun,value; + lun=ev.data>>16; + value=ev.data&0x0000ffff; + read_sectors_per_period[lun]+=value; + break; + } + case SYS_USB_WRITE_DATA: + { + int lun,value; + lun=ev.data>>16; + value=ev.data&0x0000ffff; + write_sectors_per_period[lun]+=value; + break; + } +#endif + case SYS_TIMEOUT: + break; + } + if(TIME_AFTER(current_tick,next_update)) + { + if(usb_inserted()) { +#if (CONFIG_STORAGE & STORAGE_MMC) /* USB-MMC bridge can report activity */ + led(mmc_usb_active(HZ)); +#endif /* STORAGE_MMC */ + gui_syncstatusbar_draw(&statusbars, false); + } +#if defined(HAVE_USBSTACK) && defined(USE_ROCKBOX_USB) + int lun; + for(lun=0;lun