summaryrefslogtreecommitdiffstats
path: root/firmware/usbstack/usb_storage.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2009-08-11 19:30:19 +0000
committerFrank Gevaerts <frank@gevaerts.be>2009-08-11 19:30:19 +0000
commit2dc50471ca17eaeb24b45abce4c0f8944cd781d5 (patch)
tree3e704d88f999b8ab071f6ca7753c06e692486cbf /firmware/usbstack/usb_storage.c
parenteadfa483d1b014e39953669d79fb997d8cd1085d (diff)
downloadrockbox-2dc50471ca17eaeb24b45abce4c0f8944cd781d5.tar.gz
rockbox-2dc50471ca17eaeb24b45abce4c0f8944cd781d5.tar.bz2
rockbox-2dc50471ca17eaeb24b45abce4c0f8944cd781d5.zip
Consolidate day of week calculation
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22258 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usbstack/usb_storage.c')
-rw-r--r--firmware/usbstack/usb_storage.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index 94f4f71dbb..a3664b074b 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -608,14 +608,13 @@ void usb_storage_transfer_complete(int ep,int dir,int status,int length)
}
break;
case RECEIVING_TIME:
- tm.tm_year=(tb.transfer_buffer[0]<<8)+tb.transfer_buffer[1];
+ tm.tm_year=(tb.transfer_buffer[0]<<8)+tb.transfer_buffer[1] - 1900;
tm.tm_yday=(tb.transfer_buffer[2]<<8)+tb.transfer_buffer[3];
tm.tm_hour=tb.transfer_buffer[5];
tm.tm_min=tb.transfer_buffer[6];
tm.tm_sec=tb.transfer_buffer[7];
- yearday_to_daymonth(tm.tm_yday,tm.tm_year,&tm.tm_mday,&tm.tm_mon);
- tm.tm_wday=day_of_week(tm.tm_mon,tm.tm_mday,tm.tm_year);
- tm.tm_year -= 1900;
+ yearday_to_daymonth(tm.tm_yday,tm.tm_year + 1900,&tm.tm_mday,&tm.tm_mon);
+ set_day_of_week(&tm);
set_time(&tm);
send_csw(UMS_STATUS_GOOD);
break;
@@ -1081,16 +1080,19 @@ static void handle_scsi(struct command_block_wrapper* cbw)
break;
case SCSI_WRITE_BUFFER:
- if(cbw->command_block[1]==1
- && cbw->command_block[2]==0
- && cbw->command_block[3]==0x0c
+ if(cbw->command_block[1]==1 /* mode = vendor specific */
+ && cbw->command_block[2]==0 /* buffer id = 0 */
+
+ && cbw->command_block[3]==0x0c /* offset (3 bytes) */
&& cbw->command_block[4]==0
&& cbw->command_block[5]==0
- && cbw->command_block[6]==0
+
+ /* Some versions of itunes set the parameter list length to 0.
+ * Technically it should be 0x0c, which is what libgpod sends */
+ && cbw->command_block[6]==0 /* parameter list (3 bytes) */
&& cbw->command_block[7]==0
- /* Some versions of itunes set the next byte to 0. Technically
- * it should be 0x0c */
&& (cbw->command_block[8]==0 || cbw->command_block[8]==0x0c)
+
&& cbw->command_block[9]==0)
receive_time();
break;