Adds the possibility to show nice "do not disconnect" screens/icons on the USB screen. A proof-of-concept for the actual screen is at FS#9969

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20138 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Frank Gevaerts 2009-02-28 14:47:18 +00:00
parent 027b023241
commit b6a1af2a9b
2 changed files with 16 additions and 2 deletions

View file

@ -65,6 +65,7 @@
#define SYS_USB_CONNECTED_ACK MAKE_SYS_EVENT(SYS_EVENT_CLS_USB, 1)
#define SYS_USB_DISCONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_USB, 2)
#define SYS_USB_DISCONNECTED_ACK MAKE_SYS_EVENT(SYS_EVENT_CLS_USB, 3)
#define SYS_USB_LUN_LOCKED MAKE_SYS_EVENT(SYS_EVENT_CLS_USB, 4)
#define SYS_POWEROFF MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 0)
#define SYS_CHARGER_CONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 1)
#define SYS_CHARGER_DISCONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 2)

View file

@ -346,7 +346,7 @@ void usb_storage_reconnect(void)
}
}
/* called by usb_code_init() */
/* called by usb_core_init() */
void usb_storage_init(void)
{
int i;
@ -430,6 +430,12 @@ void usb_storage_init_connection(void)
#endif
#endif
usb_drv_recv(ep_out, tb.transfer_buffer, 1024);
int lun;
for(lun=0;lun<NUM_VOLUMES;lun++)
{
queue_broadcast(SYS_USB_LUN_LOCKED, (lun<<16)+0);
}
}
void usb_storage_disconnect(void)
@ -895,7 +901,14 @@ static void handle_scsi(struct command_block_wrapper* cbw)
case SCSI_ALLOW_MEDIUM_REMOVAL:
logf("scsi allow_medium_removal %d",lun);
/* TODO: use this to show the connect screen ? */
if((cbw->command_block[4] & 0x03) == 0)
{
queue_broadcast(SYS_USB_LUN_LOCKED, (lun<<16)+0);
}
else
{
queue_broadcast(SYS_USB_LUN_LOCKED, (lun<<16)+1);
}
send_csw(UMS_STATUS_GOOD);
break;
case SCSI_READ_FORMAT_CAPACITY: {