diff options
-rw-r--r-- | firmware/export/usb.h | 3 | ||||
-rw-r--r-- | firmware/usb.c | 59 | ||||
-rw-r--r-- | firmware/usbstack/usb_core.c | 4 | ||||
-rw-r--r-- | firmware/usbstack/usb_storage.c | 42 |
4 files changed, 92 insertions, 16 deletions
diff --git a/firmware/export/usb.h b/firmware/export/usb.h index 4bfbfd4b75..833d2ab35e 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h | |||
@@ -29,6 +29,7 @@ enum { | |||
29 | USB_REENABLE, | 29 | USB_REENABLE, |
30 | USB_POWERED, | 30 | USB_POWERED, |
31 | USB_TRANSFER_COMPLETION, | 31 | USB_TRANSFER_COMPLETION, |
32 | USB_REQUEST_DISK, | ||
32 | USB_REQUEST_REBOOT | 33 | USB_REQUEST_REBOOT |
33 | }; | 34 | }; |
34 | 35 | ||
@@ -102,6 +103,8 @@ bool usb_charging_enabled(void); | |||
102 | #ifdef HAVE_USBSTACK | 103 | #ifdef HAVE_USBSTACK |
103 | void usb_signal_transfer_completion(struct usb_transfer_completion_event_data* event_data); | 104 | void usb_signal_transfer_completion(struct usb_transfer_completion_event_data* event_data); |
104 | bool usb_driver_enabled(int driver); | 105 | bool usb_driver_enabled(int driver); |
106 | bool usb_exclusive_ata(void); /* ata is available for usb */ | ||
107 | void usb_request_exclusive_ata(void); | ||
105 | #endif | 108 | #endif |
106 | 109 | ||
107 | #if defined(IPOD_COLOR) || defined(IPOD_4G) \ | 110 | #if defined(IPOD_COLOR) || defined(IPOD_4G) \ |
diff --git a/firmware/usb.c b/firmware/usb.c index 07d2c5890c..d9c13dffdf 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -73,6 +73,7 @@ static struct thread_entry *usb_thread_entry; | |||
73 | static struct event_queue usb_queue; | 73 | static struct event_queue usb_queue; |
74 | static int last_usb_status; | 74 | static int last_usb_status; |
75 | static bool usb_monitor_enabled; | 75 | static bool usb_monitor_enabled; |
76 | static bool exclusive_disk; | ||
76 | 77 | ||
77 | 78 | ||
78 | #if defined(IPOD_COLOR) || defined(IPOD_4G) \ | 79 | #if defined(IPOD_COLOR) || defined(IPOD_4G) \ |
@@ -197,6 +198,16 @@ static void usb_thread(void) | |||
197 | else | 198 | else |
198 | #endif | 199 | #endif |
199 | { | 200 | { |
201 | #ifdef HAVE_USBSTACK | ||
202 | #ifdef USE_ROCKBOX_USB | ||
203 | usb_core_enable_protocol(USB_DRIVER_MASS_STORAGE,true); | ||
204 | usb_core_enable_protocol(USB_DRIVER_SERIAL,false);/* TODO: add debug setting */ | ||
205 | usb_core_enable_protocol(USB_DRIVER_CHARGING_ONLY,false); | ||
206 | usb_enable(true); | ||
207 | #else | ||
208 | usb_request_exclusive_ata(); | ||
209 | #endif /* USE_ROCKBOX_USB */ | ||
210 | #else | ||
200 | /* Tell all threads that they have to back off the ATA. | 211 | /* Tell all threads that they have to back off the ATA. |
201 | We subtract one for our own thread. */ | 212 | We subtract one for our own thread. */ |
202 | num_acks_to_expect = | 213 | num_acks_to_expect = |
@@ -204,9 +215,23 @@ static void usb_thread(void) | |||
204 | waiting_for_ack = true; | 215 | waiting_for_ack = true; |
205 | DEBUGF("USB inserted. Waiting for ack from %d threads...\n", | 216 | DEBUGF("USB inserted. Waiting for ack from %d threads...\n", |
206 | num_acks_to_expect); | 217 | num_acks_to_expect); |
218 | #endif | ||
207 | } | 219 | } |
208 | break; | 220 | break; |
209 | 221 | #ifdef HAVE_USBSTACK | |
222 | case USB_REQUEST_DISK: | ||
223 | if(!waiting_for_ack) | ||
224 | { | ||
225 | /* Tell all threads that they have to back off the ATA. | ||
226 | We subtract one for our own thread. */ | ||
227 | num_acks_to_expect = | ||
228 | queue_broadcast(SYS_USB_CONNECTED, 0) - 1; | ||
229 | waiting_for_ack = true; | ||
230 | DEBUGF("USB inserted. Waiting for ack from %d threads...\n", | ||
231 | num_acks_to_expect); | ||
232 | } | ||
233 | break; | ||
234 | #endif | ||
210 | case SYS_USB_CONNECTED_ACK: | 235 | case SYS_USB_CONNECTED_ACK: |
211 | if(waiting_for_ack) | 236 | if(waiting_for_ack) |
212 | { | 237 | { |
@@ -215,25 +240,22 @@ static void usb_thread(void) | |||
215 | { | 240 | { |
216 | DEBUGF("All threads have acknowledged the connect.\n"); | 241 | DEBUGF("All threads have acknowledged the connect.\n"); |
217 | #ifdef HAVE_USBSTACK | 242 | #ifdef HAVE_USBSTACK |
218 | #ifdef HAVE_PRIORITY_SCHEDULING | 243 | #ifndef USE_ROCKBOX_USB |
219 | thread_set_priority(usb_thread_entry,PRIORITY_REALTIME); | ||
220 | #endif | ||
221 | #ifdef USE_ROCKBOX_USB | ||
222 | usb_core_enable_protocol(USB_DRIVER_MASS_STORAGE,true); | ||
223 | usb_core_enable_protocol(USB_DRIVER_SERIAL,false);/* TODO: add debug setting */ | ||
224 | usb_core_enable_protocol(USB_DRIVER_CHARGING_ONLY,false); | ||
225 | usb_enable(true); | ||
226 | #else /* USE_ROCKBOX_USB */ | ||
227 | /* until we have native mass-storage mode, we want to reboot on | 244 | /* until we have native mass-storage mode, we want to reboot on |
228 | usb host connect */ | 245 | usb host connect */ |
229 | try_reboot(); | 246 | try_reboot(); |
230 | #endif /* USE_ROCKBOX_USB */ | 247 | #endif /* USE_ROCKBOX_USB */ |
248 | #ifdef HAVE_PRIORITY_SCHEDULING | ||
249 | thread_set_priority(usb_thread_entry,PRIORITY_REALTIME); | ||
250 | exclusive_disk = true; | ||
251 | #endif | ||
231 | 252 | ||
232 | #else | 253 | #else |
233 | usb_slave_mode(true); | 254 | usb_slave_mode(true); |
234 | cpu_idle_mode(true); | 255 | cpu_idle_mode(true); |
235 | #endif | 256 | #endif |
236 | usb_state = USB_INSERTED; | 257 | usb_state = USB_INSERTED; |
258 | waiting_for_ack = false; | ||
237 | } | 259 | } |
238 | else | 260 | else |
239 | { | 261 | { |
@@ -246,6 +268,7 @@ static void usb_thread(void) | |||
246 | case USB_EXTRACTED: | 268 | case USB_EXTRACTED: |
247 | #ifdef HAVE_USBSTACK | 269 | #ifdef HAVE_USBSTACK |
248 | usb_enable(false); | 270 | usb_enable(false); |
271 | exclusive_disk = false; | ||
249 | #ifdef HAVE_PRIORITY_SCHEDULING | 272 | #ifdef HAVE_PRIORITY_SCHEDULING |
250 | thread_set_priority(usb_thread_entry,PRIORITY_SYSTEM); | 273 | thread_set_priority(usb_thread_entry,PRIORITY_SYSTEM); |
251 | #endif | 274 | #endif |
@@ -290,6 +313,7 @@ static void usb_thread(void) | |||
290 | { | 313 | { |
291 | DEBUGF("All threads have acknowledged. " | 314 | DEBUGF("All threads have acknowledged. " |
292 | "We're in business.\n"); | 315 | "We're in business.\n"); |
316 | waiting_for_ack = false; | ||
293 | } | 317 | } |
294 | else | 318 | else |
295 | { | 319 | { |
@@ -403,6 +427,7 @@ void usb_acknowledge(long id) | |||
403 | void usb_init(void) | 427 | void usb_init(void) |
404 | { | 428 | { |
405 | usb_state = USB_EXTRACTED; | 429 | usb_state = USB_EXTRACTED; |
430 | exclusive_disk = false; | ||
406 | usb_monitor_enabled = false; | 431 | usb_monitor_enabled = false; |
407 | countdown = -1; | 432 | countdown = -1; |
408 | 433 | ||
@@ -481,6 +506,20 @@ bool usb_inserted(void) | |||
481 | #endif | 506 | #endif |
482 | } | 507 | } |
483 | 508 | ||
509 | #ifdef HAVE_USBSTACK | ||
510 | void usb_request_exclusive_ata(void) | ||
511 | { | ||
512 | if(!exclusive_disk) { | ||
513 | queue_post(&usb_queue, USB_REQUEST_DISK, 0); | ||
514 | } | ||
515 | } | ||
516 | |||
517 | bool usb_exclusive_ata(void) | ||
518 | { | ||
519 | return exclusive_disk; | ||
520 | } | ||
521 | #endif | ||
522 | |||
484 | #ifdef HAVE_USB_POWER | 523 | #ifdef HAVE_USB_POWER |
485 | bool usb_powered(void) | 524 | bool usb_powered(void) |
486 | { | 525 | { |
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index aa0f06e4f6..f40d76bee0 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c | |||
@@ -460,6 +460,10 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req) | |||
460 | { | 460 | { |
461 | if(usb_state == DEFAULT) { | 461 | if(usb_state == DEFAULT) { |
462 | set_serial_descriptor(); | 462 | set_serial_descriptor(); |
463 | #ifdef USB_STORAGE | ||
464 | if(usb_core_storage_enabled) | ||
465 | usb_request_exclusive_ata(); | ||
466 | #endif | ||
463 | } | 467 | } |
464 | 468 | ||
465 | #ifdef USB_BENCHMARK | 469 | #ifdef USB_BENCHMARK |
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 73464cf608..bde774e5f0 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c | |||
@@ -80,6 +80,8 @@ | |||
80 | #define ASC_LBA_OUT_OF_RANGE 0x21 | 80 | #define ASC_LBA_OUT_OF_RANGE 0x21 |
81 | #define ASC_WRITE_ERROR 0x0C | 81 | #define ASC_WRITE_ERROR 0x0C |
82 | #define ASC_READ_ERROR 0x11 | 82 | #define ASC_READ_ERROR 0x11 |
83 | #define ASC_NOT_READY 0x04 | ||
84 | #define ASCQ_BECOMING_READY 0x01 | ||
83 | 85 | ||
84 | #define SCSI_FORMAT_CAPACITY_FORMATTED_MEDIA 0x02000000 | 86 | #define SCSI_FORMAT_CAPACITY_FORMATTED_MEDIA 0x02000000 |
85 | 87 | ||
@@ -207,6 +209,7 @@ static struct { | |||
207 | unsigned char sense_key; | 209 | unsigned char sense_key; |
208 | unsigned char information; | 210 | unsigned char information; |
209 | unsigned char asc; | 211 | unsigned char asc; |
212 | unsigned char ascq; | ||
210 | } cur_sense_data; | 213 | } cur_sense_data; |
211 | 214 | ||
212 | static void handle_scsi(struct command_block_wrapper* cbw); | 215 | static void handle_scsi(struct command_block_wrapper* cbw); |
@@ -228,10 +231,6 @@ static enum { | |||
228 | /* called by usb_code_init() */ | 231 | /* called by usb_code_init() */ |
229 | void usb_storage_init(void) | 232 | void usb_storage_init(void) |
230 | { | 233 | { |
231 | size_t bufsize; | ||
232 | unsigned char * audio_buffer = audio_get_buffer(false,&bufsize); | ||
233 | /* TODO : check if bufsize is at least 32K ? */ | ||
234 | tb.transfer_buffer = (void *)UNCACHED_ADDR((unsigned int)(audio_buffer + 31) & 0xffffffe0); | ||
235 | logf("usb_storage_init done"); | 234 | logf("usb_storage_init done"); |
236 | } | 235 | } |
237 | 236 | ||
@@ -270,6 +269,7 @@ void usb_storage_transfer_complete(bool in,int status,int length) | |||
270 | send_csw(UMS_STATUS_FAIL); | 269 | send_csw(UMS_STATUS_FAIL); |
271 | cur_sense_data.sense_key=SENSE_MEDIUM_ERROR; | 270 | cur_sense_data.sense_key=SENSE_MEDIUM_ERROR; |
272 | cur_sense_data.asc=ASC_WRITE_ERROR; | 271 | cur_sense_data.asc=ASC_WRITE_ERROR; |
272 | cur_sense_data.ascq=0; | ||
273 | break; | 273 | break; |
274 | } | 274 | } |
275 | 275 | ||
@@ -291,6 +291,7 @@ void usb_storage_transfer_complete(bool in,int status,int length) | |||
291 | cur_sense_data.sense_key=0; | 291 | cur_sense_data.sense_key=0; |
292 | cur_sense_data.information=0; | 292 | cur_sense_data.information=0; |
293 | cur_sense_data.asc=0; | 293 | cur_sense_data.asc=0; |
294 | cur_sense_data.ascq=0; | ||
294 | } | 295 | } |
295 | break; | 296 | break; |
296 | case WAITING_FOR_COMMAND: | 297 | case WAITING_FOR_COMMAND: |
@@ -329,6 +330,7 @@ void usb_storage_transfer_complete(bool in,int status,int length) | |||
329 | cur_sense_data.sense_key=0; | 330 | cur_sense_data.sense_key=0; |
330 | cur_sense_data.information=0; | 331 | cur_sense_data.information=0; |
331 | cur_sense_data.asc=0; | 332 | cur_sense_data.asc=0; |
333 | cur_sense_data.ascq=0; | ||
332 | } | 334 | } |
333 | break; | 335 | break; |
334 | case SENDING_BLOCKS: | 336 | case SENDING_BLOCKS: |
@@ -351,6 +353,7 @@ void usb_storage_transfer_complete(bool in,int status,int length) | |||
351 | cur_sense_data.sense_key=0; | 353 | cur_sense_data.sense_key=0; |
352 | cur_sense_data.information=0; | 354 | cur_sense_data.information=0; |
353 | cur_sense_data.asc=0; | 355 | cur_sense_data.asc=0; |
356 | cur_sense_data.ascq=0; | ||
354 | } | 357 | } |
355 | break; | 358 | break; |
356 | } | 359 | } |
@@ -390,13 +393,20 @@ bool usb_storage_control_request(struct usb_ctrlrequest* req) | |||
390 | handled = true; | 393 | handled = true; |
391 | break; | 394 | break; |
392 | 395 | ||
393 | case USB_REQ_SET_CONFIGURATION: | 396 | case USB_REQ_SET_CONFIGURATION: { |
397 | size_t bufsize; | ||
398 | unsigned char * audio_buffer; | ||
394 | logf("ums: set config"); | 399 | logf("ums: set config"); |
395 | /* prime rx endpoint. We only need room for commands */ | 400 | /* prime rx endpoint. We only need room for commands */ |
396 | state = WAITING_FOR_COMMAND; | 401 | state = WAITING_FOR_COMMAND; |
402 | |||
403 | /* TODO : check if bufsize is at least 32K ? */ | ||
404 | audio_buffer = audio_get_buffer(false,&bufsize); | ||
405 | tb.transfer_buffer = (void *)UNCACHED_ADDR((unsigned int)(audio_buffer + 31) & 0xffffffe0); | ||
397 | usb_drv_recv(EP_MASS_STORAGE, tb.transfer_buffer, 1024); | 406 | usb_drv_recv(EP_MASS_STORAGE, tb.transfer_buffer, 1024); |
398 | handled = true; | 407 | handled = true; |
399 | break; | 408 | break; |
409 | } | ||
400 | } | 410 | } |
401 | 411 | ||
402 | return handled; | 412 | return handled; |
@@ -409,6 +419,7 @@ static void send_and_read_next(void) | |||
409 | send_csw(UMS_STATUS_FAIL); | 419 | send_csw(UMS_STATUS_FAIL); |
410 | cur_sense_data.sense_key=SENSE_MEDIUM_ERROR; | 420 | cur_sense_data.sense_key=SENSE_MEDIUM_ERROR; |
411 | cur_sense_data.asc=ASC_READ_ERROR; | 421 | cur_sense_data.asc=ASC_READ_ERROR; |
422 | cur_sense_data.ascq=0; | ||
412 | return; | 423 | return; |
413 | } | 424 | } |
414 | send_block_data(current_cmd.data[current_cmd.data_select], | 425 | send_block_data(current_cmd.data[current_cmd.data_select], |
@@ -472,6 +483,13 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
472 | switch (cbw->command_block[0]) { | 483 | switch (cbw->command_block[0]) { |
473 | case SCSI_TEST_UNIT_READY: | 484 | case SCSI_TEST_UNIT_READY: |
474 | logf("scsi test_unit_ready %d",lun); | 485 | logf("scsi test_unit_ready %d",lun); |
486 | if(!usb_exclusive_ata()) { | ||
487 | send_csw(UMS_STATUS_FAIL); | ||
488 | cur_sense_data.sense_key=SENSE_NOT_READY; | ||
489 | cur_sense_data.asc=ASC_NOT_READY; | ||
490 | cur_sense_data.ascq=ASCQ_BECOMING_READY; | ||
491 | break; | ||
492 | } | ||
475 | if(lun_present) { | 493 | if(lun_present) { |
476 | send_csw(UMS_STATUS_GOOD); | 494 | send_csw(UMS_STATUS_GOOD); |
477 | } | 495 | } |
@@ -479,6 +497,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
479 | send_csw(UMS_STATUS_FAIL); | 497 | send_csw(UMS_STATUS_FAIL); |
480 | cur_sense_data.sense_key=SENSE_NOT_READY; | 498 | cur_sense_data.sense_key=SENSE_NOT_READY; |
481 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; | 499 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; |
500 | cur_sense_data.ascq=0; | ||
482 | } | 501 | } |
483 | break; | 502 | break; |
484 | 503 | ||
@@ -516,7 +535,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
516 | tb.sense_data->AdditionalSenseLength=10; | 535 | tb.sense_data->AdditionalSenseLength=10; |
517 | tb.sense_data->CommandSpecificInformation=0; | 536 | tb.sense_data->CommandSpecificInformation=0; |
518 | tb.sense_data->AdditionalSenseCode=cur_sense_data.asc; | 537 | tb.sense_data->AdditionalSenseCode=cur_sense_data.asc; |
519 | tb.sense_data->AdditionalSenseCodeQualifier=0; | 538 | tb.sense_data->AdditionalSenseCodeQualifier=cur_sense_data.ascq; |
520 | tb.sense_data->FieldReplaceableUnitCode=0; | 539 | tb.sense_data->FieldReplaceableUnitCode=0; |
521 | tb.sense_data->SKSV=0; | 540 | tb.sense_data->SKSV=0; |
522 | tb.sense_data->SenseKeySpecific=0; | 541 | tb.sense_data->SenseKeySpecific=0; |
@@ -531,6 +550,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
531 | send_csw(UMS_STATUS_FAIL); | 550 | send_csw(UMS_STATUS_FAIL); |
532 | cur_sense_data.sense_key=SENSE_NOT_READY; | 551 | cur_sense_data.sense_key=SENSE_NOT_READY; |
533 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; | 552 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; |
553 | cur_sense_data.ascq=0; | ||
534 | break; | 554 | break; |
535 | } | 555 | } |
536 | /*unsigned char pc = (cbw->command_block[2] & 0xc0) >>6;*/ | 556 | /*unsigned char pc = (cbw->command_block[2] & 0xc0) >>6;*/ |
@@ -563,6 +583,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
563 | send_csw(UMS_STATUS_FAIL); | 583 | send_csw(UMS_STATUS_FAIL); |
564 | cur_sense_data.sense_key=SENSE_ILLEGAL_REQUEST; | 584 | cur_sense_data.sense_key=SENSE_ILLEGAL_REQUEST; |
565 | cur_sense_data.asc=ASC_INVALID_FIELD_IN_CBD; | 585 | cur_sense_data.asc=ASC_INVALID_FIELD_IN_CBD; |
586 | cur_sense_data.ascq=0; | ||
566 | break; | 587 | break; |
567 | } | 588 | } |
568 | break; | 589 | break; |
@@ -573,6 +594,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
573 | send_csw(UMS_STATUS_FAIL); | 594 | send_csw(UMS_STATUS_FAIL); |
574 | cur_sense_data.sense_key=SENSE_NOT_READY; | 595 | cur_sense_data.sense_key=SENSE_NOT_READY; |
575 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; | 596 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; |
597 | cur_sense_data.ascq=0; | ||
576 | break; | 598 | break; |
577 | } | 599 | } |
578 | /*unsigned char pc = (cbw->command_block[2] & 0xc0) >>6;*/ | 600 | /*unsigned char pc = (cbw->command_block[2] & 0xc0) >>6;*/ |
@@ -608,6 +630,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
608 | send_csw(UMS_STATUS_FAIL); | 630 | send_csw(UMS_STATUS_FAIL); |
609 | cur_sense_data.sense_key=SENSE_ILLEGAL_REQUEST; | 631 | cur_sense_data.sense_key=SENSE_ILLEGAL_REQUEST; |
610 | cur_sense_data.asc=ASC_INVALID_FIELD_IN_CBD; | 632 | cur_sense_data.asc=ASC_INVALID_FIELD_IN_CBD; |
633 | cur_sense_data.ascq=0; | ||
611 | break; | 634 | break; |
612 | } | 635 | } |
613 | break; | 636 | break; |
@@ -641,6 +664,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
641 | send_csw(UMS_STATUS_FAIL); | 664 | send_csw(UMS_STATUS_FAIL); |
642 | cur_sense_data.sense_key=SENSE_NOT_READY; | 665 | cur_sense_data.sense_key=SENSE_NOT_READY; |
643 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; | 666 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; |
667 | cur_sense_data.ascq=0; | ||
644 | } | 668 | } |
645 | break; | 669 | break; |
646 | } | 670 | } |
@@ -660,6 +684,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
660 | send_csw(UMS_STATUS_FAIL); | 684 | send_csw(UMS_STATUS_FAIL); |
661 | cur_sense_data.sense_key=SENSE_NOT_READY; | 685 | cur_sense_data.sense_key=SENSE_NOT_READY; |
662 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; | 686 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; |
687 | cur_sense_data.ascq=0; | ||
663 | } | 688 | } |
664 | break; | 689 | break; |
665 | } | 690 | } |
@@ -671,6 +696,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
671 | send_csw(UMS_STATUS_FAIL); | 696 | send_csw(UMS_STATUS_FAIL); |
672 | cur_sense_data.sense_key=SENSE_NOT_READY; | 697 | cur_sense_data.sense_key=SENSE_NOT_READY; |
673 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; | 698 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; |
699 | cur_sense_data.ascq=0; | ||
674 | break; | 700 | break; |
675 | } | 701 | } |
676 | current_cmd.data[0] = tb.transfer_buffer; | 702 | current_cmd.data[0] = tb.transfer_buffer; |
@@ -692,6 +718,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
692 | send_csw(UMS_STATUS_FAIL); | 718 | send_csw(UMS_STATUS_FAIL); |
693 | cur_sense_data.sense_key=SENSE_ILLEGAL_REQUEST; | 719 | cur_sense_data.sense_key=SENSE_ILLEGAL_REQUEST; |
694 | cur_sense_data.asc=ASC_LBA_OUT_OF_RANGE; | 720 | cur_sense_data.asc=ASC_LBA_OUT_OF_RANGE; |
721 | cur_sense_data.ascq=0; | ||
695 | } | 722 | } |
696 | else { | 723 | else { |
697 | current_cmd.last_result = ata_read_sectors(IF_MV2(current_cmd.lun,) current_cmd.sector, | 724 | current_cmd.last_result = ata_read_sectors(IF_MV2(current_cmd.lun,) current_cmd.sector, |
@@ -708,6 +735,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
708 | send_csw(UMS_STATUS_FAIL); | 735 | send_csw(UMS_STATUS_FAIL); |
709 | cur_sense_data.sense_key=SENSE_NOT_READY; | 736 | cur_sense_data.sense_key=SENSE_NOT_READY; |
710 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; | 737 | cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; |
738 | cur_sense_data.ascq=0; | ||
711 | break; | 739 | break; |
712 | } | 740 | } |
713 | current_cmd.data[0] = tb.transfer_buffer; | 741 | current_cmd.data[0] = tb.transfer_buffer; |
@@ -727,6 +755,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
727 | send_csw(UMS_STATUS_FAIL); | 755 | send_csw(UMS_STATUS_FAIL); |
728 | cur_sense_data.sense_key=SENSE_ILLEGAL_REQUEST; | 756 | cur_sense_data.sense_key=SENSE_ILLEGAL_REQUEST; |
729 | cur_sense_data.asc=ASC_LBA_OUT_OF_RANGE; | 757 | cur_sense_data.asc=ASC_LBA_OUT_OF_RANGE; |
758 | cur_sense_data.ascq=0; | ||
730 | } | 759 | } |
731 | else { | 760 | else { |
732 | receive_block_data(current_cmd.data[0], | 761 | receive_block_data(current_cmd.data[0], |
@@ -776,6 +805,7 @@ static void send_csw(int status) | |||
776 | cur_sense_data.sense_key=0; | 805 | cur_sense_data.sense_key=0; |
777 | cur_sense_data.information=0; | 806 | cur_sense_data.information=0; |
778 | cur_sense_data.asc=0; | 807 | cur_sense_data.asc=0; |
808 | cur_sense_data.ascq=0; | ||
779 | } | 809 | } |
780 | } | 810 | } |
781 | 811 | ||