Changeset ce25903 in mainline
- Timestamp:
- 2015-07-03T20:02:58Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 34c9cfc
- Parents:
- 8fc61c8
- Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmast/scsi_ms.c
r8fc61c8 rce25903 63 63 static void usbmast_dump_sense(scsi_sense_data_t *sense_buf) 64 64 { 65 unsigned sense_key; 66 67 sense_key = sense_buf->flags_key & 0x0f; 65 const unsigned sense_key = sense_buf->flags_key & 0x0f; 68 66 printf("Got sense data. Sense key: 0x%x (%s), ASC 0x%02x, " 69 67 "ASCQ 0x%02x.\n", sense_key, … … 73 71 } 74 72 73 static int usb_massstor_unit_ready(usbmast_fun_t *mfun) 74 { 75 scsi_cmd_t cmd; 76 scsi_cdb_test_unit_ready_t cdb; 77 int rc; 78 79 memset(&cdb, 0, sizeof(cdb)); 80 cdb.op_code = SCSI_CMD_TEST_UNIT_READY; 81 82 memset(&cmd, 0, sizeof(cmd)); 83 cmd.cdb = &cdb; 84 cmd.cdb_size = sizeof(cdb); 85 86 rc = usb_massstor_cmd(mfun, 0xDEADBEEF, &cmd); 87 88 if (rc != EOK || cmd.status != CMDS_GOOD) { 89 usb_log_error("Test Unit Ready failed, device %s: %s.\n", 90 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 91 return rc; 92 } 93 94 return EOK; 95 } 96 75 97 /** Run SCSI command. 76 98 * … … 85 107 86 108 do { 109 rc = usb_massstor_unit_ready(mfun); 110 if (rc != EOK) { 111 usb_log_error("Inquiry transport failed, device %s: %s.\n", 112 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 113 return rc; 114 } 115 87 116 rc = usb_massstor_cmd(mfun, 0xDEADBEEF, cmd); 88 117 if (rc != EOK) { -
uspace/lib/scsi/include/scsi/spc.h
r8fc61c8 rce25903 42 42 /** SCSI command codes defined in SCSI-SPC */ 43 43 enum scsi_cmd_spc { 44 SCSI_CMD_INQUIRY = 0x12, 45 SCSI_CMD_REQUEST_SENSE = 0x03 44 SCSI_CMD_TEST_UNIT_READY = 0x00, 45 SCSI_CMD_REQUEST_SENSE = 0x03, 46 SCSI_CMD_INQUIRY = 0x12, 46 47 }; 47 48 … … 220 221 extern const char *scsi_get_sense_key_str(unsigned); 221 222 223 /** SCSI Test Unit Ready command */ 224 typedef struct { 225 /** Operation code (SCSI_CMD_TEST_UNIT_READY) */ 226 uint8_t op_code; 227 /** Reserved */ 228 uint32_t reserved; 229 /* Control */ 230 uint8_t control; 231 } __attribute__((packed)) scsi_cdb_test_unit_ready_t; 232 222 233 #endif 223 234
Note:
See TracChangeset
for help on using the changeset viewer.