Skip to content

Commit 42d1c6d

Browse files
oneukumgregkh
authored andcommitted
usb: uas: add support for more quirk flags
The hope that UAS devices would be less broken than old style storage devices has turned out to be unfounded. Make UAS support more of the quirk flags of the old driver. Signed-off-by: Oliver Neukum <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f45681f commit 42d1c6d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/usb/storage/uas.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,27 @@ static int uas_slave_configure(struct scsi_device *sdev)
842842
sdev->skip_ms_page_8 = 1;
843843
sdev->wce_default_on = 1;
844844
}
845+
846+
/*
847+
* Some disks return the total number of blocks in response
848+
* to READ CAPACITY rather than the highest block number.
849+
* If this device makes that mistake, tell the sd driver.
850+
*/
851+
if (devinfo->flags & US_FL_FIX_CAPACITY)
852+
sdev->fix_capacity = 1;
853+
854+
/*
855+
* Some devices don't like MODE SENSE with page=0x3f,
856+
* which is the command used for checking if a device
857+
* is write-protected. Now that we tell the sd driver
858+
* to do a 192-byte transfer with this command the
859+
* majority of devices work fine, but a few still can't
860+
* handle it. The sd driver will simply assume those
861+
* devices are write-enabled.
862+
*/
863+
if (devinfo->flags & US_FL_NO_WP_DETECT)
864+
sdev->skip_ms_page_3f = 1;
865+
845866
scsi_change_queue_depth(sdev, devinfo->qdepth - 2);
846867
return 0;
847868
}

0 commit comments

Comments
 (0)