diff options
Diffstat (limited to 'firmware/usbstack/usb_storage.c')
-rw-r--r-- | firmware/usbstack/usb_storage.c | 22 |
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) | |||
608 | } | 608 | } |
609 | break; | 609 | break; |
610 | case RECEIVING_TIME: | 610 | case RECEIVING_TIME: |
611 | tm.tm_year=(tb.transfer_buffer[0]<<8)+tb.transfer_buffer[1]; | 611 | tm.tm_year=(tb.transfer_buffer[0]<<8)+tb.transfer_buffer[1] - 1900; |
612 | tm.tm_yday=(tb.transfer_buffer[2]<<8)+tb.transfer_buffer[3]; | 612 | tm.tm_yday=(tb.transfer_buffer[2]<<8)+tb.transfer_buffer[3]; |
613 | tm.tm_hour=tb.transfer_buffer[5]; | 613 | tm.tm_hour=tb.transfer_buffer[5]; |
614 | tm.tm_min=tb.transfer_buffer[6]; | 614 | tm.tm_min=tb.transfer_buffer[6]; |
615 | tm.tm_sec=tb.transfer_buffer[7]; | 615 | tm.tm_sec=tb.transfer_buffer[7]; |
616 | yearday_to_daymonth(tm.tm_yday,tm.tm_year,&tm.tm_mday,&tm.tm_mon); | 616 | yearday_to_daymonth(tm.tm_yday,tm.tm_year + 1900,&tm.tm_mday,&tm.tm_mon); |
617 | tm.tm_wday=day_of_week(tm.tm_mon,tm.tm_mday,tm.tm_year); | 617 | set_day_of_week(&tm); |
618 | tm.tm_year -= 1900; | ||
619 | set_time(&tm); | 618 | set_time(&tm); |
620 | send_csw(UMS_STATUS_GOOD); | 619 | send_csw(UMS_STATUS_GOOD); |
621 | break; | 620 | break; |
@@ -1081,16 +1080,19 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
1081 | break; | 1080 | break; |
1082 | 1081 | ||
1083 | case SCSI_WRITE_BUFFER: | 1082 | case SCSI_WRITE_BUFFER: |
1084 | if(cbw->command_block[1]==1 | 1083 | if(cbw->command_block[1]==1 /* mode = vendor specific */ |
1085 | && cbw->command_block[2]==0 | 1084 | && cbw->command_block[2]==0 /* buffer id = 0 */ |
1086 | && cbw->command_block[3]==0x0c | 1085 | |
1086 | && cbw->command_block[3]==0x0c /* offset (3 bytes) */ | ||
1087 | && cbw->command_block[4]==0 | 1087 | && cbw->command_block[4]==0 |
1088 | && cbw->command_block[5]==0 | 1088 | && cbw->command_block[5]==0 |
1089 | && cbw->command_block[6]==0 | 1089 | |
1090 | /* Some versions of itunes set the parameter list length to 0. | ||
1091 | * Technically it should be 0x0c, which is what libgpod sends */ | ||
1092 | && cbw->command_block[6]==0 /* parameter list (3 bytes) */ | ||
1090 | && cbw->command_block[7]==0 | 1093 | && cbw->command_block[7]==0 |
1091 | /* Some versions of itunes set the next byte to 0. Technically | ||
1092 | * it should be 0x0c */ | ||
1093 | && (cbw->command_block[8]==0 || cbw->command_block[8]==0x0c) | 1094 | && (cbw->command_block[8]==0 || cbw->command_block[8]==0x0c) |
1095 | |||
1094 | && cbw->command_block[9]==0) | 1096 | && cbw->command_block[9]==0) |
1095 | receive_time(); | 1097 | receive_time(); |
1096 | break; | 1098 | break; |