How can I check whether USB3.0 UASP (USB Attached SCSI Protocol) mode is enabled in Linux?

26

3

I have a laptop running Ubuntu 15.04 (3.19.0-21-generic) and an external USB3.0 2.5" SATA HDD enclosure which claims that it supports UASP mode (the S2510BPU33 model by StarTech). I have no problems mounting the drive or reading/writing to it.

I'd like to be able to confirm the following:

  1. That the device itself actually supports UASP
  2. Whether my chipset also supports UASP
  3. Whether the device is using UASP when I mount it

Whereabouts can I find this information?

ali_m

Posted 2015-06-16T18:22:09.650

Reputation: 486

Answers

26

If you know the name of your device, find the USB Bus and Device numbers:

$ lsusb
...
Bus 002 Device 005: ID xxxx:yyyy MyDeviceManufacturer
...

Then look at the USB tree and find your device (mine was Bus 2, Dev 5):

$ lsusb -t
...
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    |__ Port 2: Dev 5, If 0, Class=Mass Storage, Driver=uas, 5000M
    |__ Port 4: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
...

You can see in my case the uas driver.

If UAS is not in use you would see usb-storage (like Dev 3 in my case).

austinmarton

Posted 2015-06-16T18:22:09.650

Reputation: 376

1Excellent - that nicely addresses point 3. If I don't see Driver=uas, it would be nice to be able to find out why - for example it could be that either the chipset or the device (or possibly both?) don't support UAS. I'll leave the question open until the end of the week in case someone can answer the other two points, but otherwise I'll accept your answer. – ali_m – 2015-06-24T17:13:10.407

1I'd like to know the answers to 1 & 2 also, will edit the answer if I figure it out – austinmarton – 2015-06-25T04:01:50.647

10

In addition to the answer austinmarton gave, you can run

lsusb -v -d VPID | grep -i interface

where VPID is the vendor/product ID reported in lsusb. For example:

$ lsusb -v -d 1234:5678 | grep -i interface
Couldn't open device, some information will be missing
  bDeviceClass            0 (Defined at Interface level)
    bNumInterfaces          1
    Interface Descriptor:
      bInterfaceNumber        0
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              6 

Notice that the only bInterfaceProtocol value listed is 80 Bulk-Only. This device would not be a UASP-configured device. However, if you see an additional bInterfaceProtocol 98, this would be a UASP-configured device.

These values are given in decimal, but the spec refers to them by their hex values...

50h (80d): USB Mass Storage Class Bulk-Only (BBB) Transport
62h (98d): Allocated by USB-IF for UAS. 

This information can be found in the Mass Storage Specification on usb.org, section 3 Protocol Codes, Table 2 — Mass Storage Transport Protocol.

I'm not sure if this answers your first or second questions, though, since it's unclear if this value would be reported on both machines/devices that do support UASP and those that do not.

user8675309

Posted 2015-06-16T18:22:09.650

Reputation: 117

4

To complete the answer:

If your controller does not support UAS, the linux kernel is kind enough to tell you so:

$ dmesg | grep "UAS"
[58669.959610] usb 4-2: USB controller 0000:03:00.0 does not support streams, which are required by the UAS driver.
[58669.959613] usb 4-2: Please try an other USB controller if you wish to use UAS.

Also, lsusb shows a line for bInterfaceProtocol 98, but it is empty:

$ lsusb -v -d 0080:a001 | grep -i interface
bDeviceClass            0 (Defined at Interface level)
  bNumInterfaces          1
  Interface Descriptor:
    bInterfaceNumber        0
    bInterfaceClass         8 Mass Storage
    bInterfaceSubClass      6 SCSI
    bInterfaceProtocol     80 Bulk-Only
    iInterface              0 
  Interface Descriptor:
    bInterfaceNumber        0
    bInterfaceClass         8 Mass Storage
    bInterfaceSubClass      6 SCSI
    bInterfaceProtocol     98 
    iInterface              0

HTH,

R. Daneel olivaw,
The Human Robot Inside.

R. Daneel Olivaw

Posted 2015-06-16T18:22:09.650

Reputation: 56

Just to clarify, the presence of the bInterfaceProtocol 98 line indicates that this particular device supports the protocol required for UAS -- but the line is always "empty" (i.e. has no text description string) whether or not UAS is supported. (In fact it's simply empty because no description for class 8/subclass 6/protocol 62 is given in /var/lib/usbutils/usb.ids , to go along with the description "Bulk-Only" given for protocol 50.) – Nathan – 2019-08-17T04:23:00.130

-1

You must check whether the UAS driver is being used for your disk. First, identify the disk in question:

   # dmesg | grep sdb
   ...................
   sd 9:0:0:1: [sdb] Attached SCSI disk

So my device is a SCSI disk. Here you find the information about the drivers currently in use,

   # ls /sys/bus/scsi/drivers
     sd  sr

So, in my case, the appropriate driver is either sd or sr. To check which one, I try

   # cd /sys/bus/scsi/drivers/sd/9:0:0:1
   # 

Hence my driver is sd.You can double-check that the directory /sys/bus/scsi/drivers/sr/9:0:0:1 does not exist. Hence my external disk is not UASP.

MariusMatutiae

Posted 2015-06-16T18:22:09.650

Reputation: 41 321

3

I don't think this answer is correct, the SD and SR drivers don't tell you about UAS. I've got a disk using UAS and it uses the SD driver (http://lxr.free-electrons.com/source/drivers/scsi/sd.c). Pretty sure the SR driver is for CD/DVD drivers (http://lxr.free-electrons.com/source/drivers/scsi/sr.c)

– austinmarton – 2015-06-22T07:07:47.313

That's because sd/sr work on a different layer than uas/usb-storage. – user1686 – 2016-10-20T13:23:46.447