Add new testcase for USB mass storage.
This commit is contained in:
parent
0b7cffde5f
commit
527d91ca5c
@ -255,6 +255,35 @@ do_msc_cmd(uint8_t *pcmd, uint8_t cmdlen, void *pdata, uint32_t datalen,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
do_msc_shorter_cmd(uint8_t lun)
|
||||
{
|
||||
uint8_t buffer[sizeof(umass_bbb_cbw_t)];
|
||||
int actlen;
|
||||
int error;
|
||||
int x;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
|
||||
for (x = 0; x != (sizeof(buffer) - 1); x++) {
|
||||
error = libusb20_tr_bulk_intr_sync(xfer_out,
|
||||
buffer, x, &actlen, 250);
|
||||
|
||||
printf("Sent short %d of %d bytes wrapper block, "
|
||||
"status = %d\n", x, (int)(sizeof(buffer) - 1),
|
||||
error);
|
||||
|
||||
do_msc_reset(lun);
|
||||
|
||||
if (error != 0) {
|
||||
printf("ERROR: Too short command wrapper "
|
||||
"was not accepted\n");
|
||||
stats.xfer_error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
do_read_10(uint32_t lba, uint32_t len, void *buf, uint8_t lun)
|
||||
{
|
||||
@ -564,6 +593,11 @@ usb_msc_test(struct usb_msc_params *p)
|
||||
if (capacity_bs != 512)
|
||||
printf("INFO: Blocksize is not 512 bytes\n");
|
||||
|
||||
if (p->try_shorter_wrapper_block) {
|
||||
printf("Trying too short command wrapper:\n");
|
||||
do_msc_shorter_cmd(lun);
|
||||
}
|
||||
|
||||
if (p->try_invalid_scsi_command) {
|
||||
int status;
|
||||
|
||||
@ -1195,6 +1229,7 @@ show_host_msc_test(uint8_t level, uint16_t vid,
|
||||
"14) Toggle try aborted write transfer: <%s>\n"
|
||||
"15) Toggle request sense on error: <%s>\n"
|
||||
"16) Toggle try all LUN: <%s>\n"
|
||||
"17) Toggle try too short wrapper block: <%s>\n"
|
||||
"20) Reset parameters\n"
|
||||
"30) Start test (VID=0x%04x, PID=0x%04x)\n"
|
||||
"40) Select another device\n"
|
||||
@ -1215,6 +1250,7 @@ show_host_msc_test(uint8_t level, uint16_t vid,
|
||||
(params.try_abort_data_write ? "YES" : "NO"),
|
||||
(params.try_sense_on_error ? "YES" : "NO"),
|
||||
(params.try_all_lun ? "YES" : "NO"),
|
||||
(params.try_shorter_wrapper_block ? "YES" : "NO"),
|
||||
vid, pid);
|
||||
switch (retval) {
|
||||
case 0:
|
||||
@ -1274,6 +1310,9 @@ show_host_msc_test(uint8_t level, uint16_t vid,
|
||||
case 16:
|
||||
params.try_all_lun ^= 1;
|
||||
break;
|
||||
case 17:
|
||||
params.try_shorter_wrapper_block ^= 1;
|
||||
break;
|
||||
case 20:
|
||||
set_defaults(¶ms);
|
||||
break;
|
||||
|
@ -109,6 +109,7 @@ struct usb_msc_params {
|
||||
uint8_t try_invalid_scsi_command;
|
||||
uint8_t try_invalid_wrapper_block;
|
||||
uint8_t try_invalid_max_packet_size;
|
||||
uint8_t try_shorter_wrapper_block;
|
||||
uint8_t try_last_lba;
|
||||
uint8_t try_abort_data_write;
|
||||
uint8_t try_sense_on_error;
|
||||
|
Loading…
Reference in New Issue
Block a user