Changes in uspace/drv/block/usbmast/scsi_ms.c [ae3a941:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/block/usbmast/scsi_ms.c
rae3a941 rb7fd2a0 2 2 * Copyright (c) 2011 Vojtech Horky 3 3 * Copyright (c) 2011 Jiri Svoboda 4 * Copyright (c) 2018 Ondrej Hlavaty5 4 * All rights reserved. 6 5 * … … 88 87 rc = usb_massstor_cmd(mfun, 0xDEADBEEF, &cmd); 89 88 90 89 if (rc != EOK) { 91 90 usb_log_error("Test Unit Ready failed on device %s: %s.", 92 91 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 93 92 return rc; 94 93 } … … 98 97 if (cmd.status != CMDS_GOOD) 99 98 usb_log_warning("Test Unit Ready command failed on device %s.", 100 99 usb_device_get_name(mfun->mdev->usb_dev)); 101 100 102 101 return EOK; … … 117 116 rc = usb_massstor_unit_ready(mfun); 118 117 if (rc != EOK) { 119 usb_log_error("Inquiry transport failed, device %s: %s. ",120 118 usb_log_error("Inquiry transport failed, device %s: %s.\n", 119 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 121 120 return rc; 122 121 } … … 124 123 rc = usb_massstor_cmd(mfun, 0xDEADBEEF, cmd); 125 124 if (rc != EOK) { 126 usb_log_error("Inquiry transport failed, device %s: %s. ",127 125 usb_log_error("Inquiry transport failed, device %s: %s.\n", 126 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 128 127 return rc; 129 128 } … … 132 131 return EOK; 133 132 134 usb_log_error("SCSI command failed, device %s. ",133 usb_log_error("SCSI command failed, device %s.\n", 135 134 usb_device_get_name(mfun->mdev->usb_dev)); 136 135 137 136 rc = usbmast_request_sense(mfun, &sense_buf, sizeof(sense_buf)); 138 137 if (rc != EOK) { 139 usb_log_error("Failed to read sense data. ");138 usb_log_error("Failed to read sense data.\n"); 140 139 return EIO; 141 140 } … … 183 182 184 183 if (rc != EOK) { 185 usb_log_error("Inquiry transport failed, device %s: %s. ",186 184 usb_log_error("Inquiry transport failed, device %s: %s.\n", 185 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 187 186 return rc; 188 187 } 189 188 190 189 if (cmd.status != CMDS_GOOD) { 191 usb_log_error("Inquiry command failed, device %s. ",192 190 usb_log_error("Inquiry command failed, device %s.\n", 191 usb_device_get_name(mfun->mdev->usb_dev)); 193 192 return EIO; 194 193 } 195 194 196 195 if (cmd.rcvd_size < SCSI_STD_INQUIRY_DATA_MIN_SIZE) { 197 usb_log_error("SCSI Inquiry response too short (%zu). ",198 196 usb_log_error("SCSI Inquiry response too short (%zu).\n", 197 cmd.rcvd_size); 199 198 return EIO; 200 199 } … … 250 249 rc = usb_massstor_cmd(mfun, 0xDEADBEEF, &cmd); 251 250 252 253 usb_log_error("Request Sense failed, device %s: %s. ",254 251 if (rc != EOK || cmd.status != CMDS_GOOD) { 252 usb_log_error("Request Sense failed, device %s: %s.\n", 253 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 255 254 return rc; 256 255 } … … 292 291 rc = usbmast_run_cmd(mfun, &cmd); 293 292 294 295 usb_log_error("Read Capacity (10) transport failed, device %s: %s. ",296 293 if (rc != EOK) { 294 usb_log_error("Read Capacity (10) transport failed, device %s: %s.\n", 295 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 297 296 return rc; 298 297 } 299 298 300 299 if (cmd.status != CMDS_GOOD) { 301 usb_log_error("Read Capacity (10) command failed, device %s. ",302 300 usb_log_error("Read Capacity (10) command failed, device %s.\n", 301 usb_device_get_name(mfun->mdev->usb_dev)); 303 302 return EIO; 304 303 } 305 304 306 305 if (cmd.rcvd_size < sizeof(data)) { 307 usb_log_error("SCSI Read Capacity response too short (%zu). ",308 306 usb_log_error("SCSI Read Capacity response too short (%zu).\n", 307 cmd.rcvd_size); 309 308 return EIO; 310 309 } … … 350 349 351 350 if (rc != EOK) { 352 usb_log_error("Read (10) transport failed, device %s: %s. ",353 351 usb_log_error("Read (10) transport failed, device %s: %s.\n", 352 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 354 353 return rc; 355 354 } 356 355 357 356 if (cmd.status != CMDS_GOOD) { 358 usb_log_error("Read (10) command failed, device %s. ",359 357 usb_log_error("Read (10) command failed, device %s.\n", 358 usb_device_get_name(mfun->mdev->usb_dev)); 360 359 return EIO; 361 360 } 362 361 363 362 if (cmd.rcvd_size < nblocks * mfun->block_size) { 364 usb_log_error("SCSI Read response too short (%zu). ",363 usb_log_error("SCSI Read response too short (%zu).\n", 365 364 cmd.rcvd_size); 366 365 return EIO; … … 405 404 rc = usbmast_run_cmd(mfun, &cmd); 406 405 407 408 usb_log_error("Write (10) transport failed, device %s: %s. ",409 406 if (rc != EOK) { 407 usb_log_error("Write (10) transport failed, device %s: %s.\n", 408 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 410 409 return rc; 411 410 } 412 411 413 412 if (cmd.status != CMDS_GOOD) { 414 usb_log_error("Write (10) command failed, device %s. ",415 413 usb_log_error("Write (10) command failed, device %s.\n", 414 usb_device_get_name(mfun->mdev->usb_dev)); 416 415 return EIO; 417 416 } … … 450 449 const errno_t rc = usbmast_run_cmd(mfun, &cmd); 451 450 452 453 usb_log_error("Synchronize Cache (10) transport failed, device %s: %s. ",454 451 if (rc != EOK) { 452 usb_log_error("Synchronize Cache (10) transport failed, device %s: %s.\n", 453 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 455 454 return rc; 456 455 } 457 456 458 457 if (cmd.status != CMDS_GOOD) { 459 usb_log_error("Synchronize Cache (10) command failed, device %s. ",460 458 usb_log_error("Synchronize Cache (10) command failed, device %s.\n", 459 usb_device_get_name(mfun->mdev->usb_dev)); 461 460 return EIO; 462 461 }
Note:
See TracChangeset
for help on using the changeset viewer.