diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2009-02-28 14:47:18 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2009-02-28 14:47:18 +0000 |
commit | b6a1af2a9b8d54ed8e94e2a36f5564cf3f239919 (patch) | |
tree | 2f2e78a6d0a9f9ad7e79f7b50ce9dde7ba3fd099 /firmware | |
parent | 027b023241dbc0e6e5f1d44b16d7fe1cf50ece25 (diff) |
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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/kernel.h | 1 | ||||
-rw-r--r-- | firmware/usbstack/usb_storage.c | 17 |
2 files changed, 16 insertions, 2 deletions
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index 63cc174cb6..8b55a57daa 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h @@ -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) diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 2080865e11..e769216a8d 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c @@ -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: { |