public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* add NO_REPORT_LUNS quirk for at least a few Seagate external drives to fix smartctl with uas
@ 2024-06-10 19:25 Alban Browaeys
  2024-06-11  6:08 ` Greg KH
  2024-06-11  8:21 ` Oliver Neukum
  0 siblings, 2 replies; 7+ messages in thread
From: Alban Browaeys @ 2024-06-10 19:25 UTC (permalink / raw)
  To: linux-usb

I found that for "smartctl" to work on my two Seagate Expansion
external USB3  I had to add the "j" usb-storage quirks ie
"US_FL_NO_REPORT_LUNS".
(They are years apart).



Bus 002 Device 008: ID 0bc2:231a Seagate RSS LLC Expansion Portable
Bus 002 Device 007: ID 0bc2:2037 Seagate RSS LLC Expansion HDD


Could these be added to drivers/usb/storage/unusual_uas.h
with the "US_FL_NO_REPORT_LUNS" quirk, after the existing
"UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999," for the Seagate
"Expansion Desk"?

Or could you send me hacks to fix the REPORT_LUNS support for Seagate?

For now, I use "0bc2:2037:j" and "u,0x0bc2:0x231a:j" in
"/sys/module/usb_storage/parameters/quirks".


I got the idea from:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1363074667a6b7d0507527742ccd7bbed5e3ceaa
"
USB: uas: Add a new NO_REPORT_LUNS quirk
Add a new NO_REPORT_LUNS quirk and set it for Seagate drives with
an usb-id of: 0bc2:331a, as these will fail to respond to a
REPORT_LUNS command.
"

Discussion on
https://lore.kernel.org/all/1459426971-11927-1-git-send-email-hdegoede@redhat.com/
of which 
https://lore.kernel.org/all/7977162.W24Fksp8b7@ok64/ tells that Seagate
at least back then had issues with REPORT_LUNS but not always: "
> Actually it does support REPORT LUNS, some of the time. When you first
> boot the computer with uas blacklisted for this device, so initialize
> it once with usb-storage, and then reboot with out the blacklist
> (and without removing power to the drive) uas will work with REPORT LUNS
> bit cold-booting directly into uas mode and then doing a REPORT LUNS
> upsets the drive / disk enclosure (this has all been observed by
> David Webb, I do not own such a drive).

Just to confirm what Hans has reported.  After power has been removed the 
Seagate Expansion usb disk always produces faults unless it has been 
blacklisted in some way.  Once the disk is working the computer can be powered 
off and restarted without the blacklist and, as long as its power has not been 
removed, the disk can be reconnected many times without any error.

With Hans's changes the disk mounts correctly with the uas module every time.

My guess is that one of the interface registers is not or cannot be 
initialized correctly.  If after a failure I try unplugging and reinserting 
the usb connector many times it has sometimes connected correctly - which to 
me means that some random bit eventually has the right value. 

"


Regards,
Alban

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: add NO_REPORT_LUNS quirk for at least a few Seagate external drives to fix smartctl with uas
  2024-06-10 19:25 add NO_REPORT_LUNS quirk for at least a few Seagate external drives to fix smartctl with uas Alban Browaeys
@ 2024-06-11  6:08 ` Greg KH
  2024-06-11  8:21 ` Oliver Neukum
  1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2024-06-11  6:08 UTC (permalink / raw)
  To: Alban Browaeys; +Cc: linux-usb

On Mon, Jun 10, 2024 at 09:25:54PM +0200, Alban Browaeys wrote:
> I found that for "smartctl" to work on my two Seagate Expansion
> external USB3  I had to add the "j" usb-storage quirks ie
> "US_FL_NO_REPORT_LUNS".
> (They are years apart).
> 
> 
> 
> Bus 002 Device 008: ID 0bc2:231a Seagate RSS LLC Expansion Portable
> Bus 002 Device 007: ID 0bc2:2037 Seagate RSS LLC Expansion HDD
> 
> 
> Could these be added to drivers/usb/storage/unusual_uas.h
> with the "US_FL_NO_REPORT_LUNS" quirk, after the existing
> "UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999," for the Seagate
> "Expansion Desk"?

Sure, want to send a patch for this?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: add NO_REPORT_LUNS quirk for at least a few Seagate external drives to fix smartctl with uas
  2024-06-10 19:25 add NO_REPORT_LUNS quirk for at least a few Seagate external drives to fix smartctl with uas Alban Browaeys
  2024-06-11  6:08 ` Greg KH
@ 2024-06-11  8:21 ` Oliver Neukum
  2024-06-12  1:39   ` Alban Browaeys
  1 sibling, 1 reply; 7+ messages in thread
From: Oliver Neukum @ 2024-06-11  8:21 UTC (permalink / raw)
  To: Alban Browaeys, linux-usb

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]



On 10.06.24 21:25, Alban Browaeys wrote:
> I found that for "smartctl" to work on my two Seagate Expansion
> external USB3  I had to add the "j" usb-storage quirks ie
> "US_FL_NO_REPORT_LUNS".
> (They are years apart).

Hi,

does the attached patch do the job?

	Regards
		Oliver

[-- Attachment #2: 0001-usb-uas-set-two-more-quirks-for-Seagate-drives.patch --]
[-- Type: text/x-patch, Size: 1281 bytes --]

From f7f2fa579d23a45d4011b79155bdcf1d179f1044 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@suse.com>
Date: Tue, 11 Jun 2024 10:14:47 +0200
Subject: [PATCH] usb: uas: set two more quirks for Seagate drives

These drives need US_FL_NO_REPORT_LUNS

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/usb/storage/unusual_uas.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
index 1f8c9b16a0fb..12c2fda6905b 100644
--- a/drivers/usb/storage/unusual_uas.h
+++ b/drivers/usb/storage/unusual_uas.h
@@ -76,6 +76,20 @@ UNUSUAL_DEV(0x0b05, 0x1932, 0x0000, 0x9999,
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_IGNORE_UAS),
 
+/* Reported-by: Alban Browaeys <alban.browaeys@gmail.com> */
+UNUSUAL_DEV(0x0bc2, 0x2037, 0x0000, 0x9999,
+		"Seagate",
+		"RSS LLC Expansion HDD",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_NO_REPORT_LUNS),
+
+/* Reported-by: Alban Browaeys <alban.browaeys@gmail.com> */
+UNUSUAL_DEV(0x0bc2, 0x231a, 0x0000, 0x9999,
+		"Seagate",
+		"RSS LLC Expansion Portable",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_NO_REPORT_LUNS),
+
 /* Reported-by: David Webb <djw@noc.ac.uk> */
 UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999,
 		"Seagate",
-- 
2.45.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: add NO_REPORT_LUNS quirk for at least a few Seagate external drives to fix smartctl with uas
  2024-06-11  8:21 ` Oliver Neukum
@ 2024-06-12  1:39   ` Alban Browaeys
  2024-06-12 15:13     ` Alban Browaeys
  0 siblings, 1 reply; 7+ messages in thread
From: Alban Browaeys @ 2024-06-12  1:39 UTC (permalink / raw)
  To: Oliver Neukum, linux-usb

Le mardi 11 juin 2024 à 10:21 +0200, Oliver Neukum a écrit :
> 
> 
> On 10.06.24 21:25, Alban Browaeys wrote:
> > I found that for "smartctl" to work on my two Seagate Expansion
> > external USB3  I had to add the "j" usb-storage quirks ie
> > "US_FL_NO_REPORT_LUNS".
> > (They are years apart).
> 
> Hi,
> 
> does the attached patch do the job?
> 
> 	Regards
> 		Oliver

No, it does not work.
smartctl is still broken with the US_FL_NO_REPORT_LUNS in
drivers/usb/storage/unusual_uas.h.

But if I add back the "j" usb.quirks flag back with:
echo -n "0x0bc2:0x2037:j" | sudo tee  /sys/module/usb_storage/parameters/quirks
and then:
echo -n "2-2:1.0" | sudo tee /sys/bus/usb/drivers/uas/unbind
echo -n "2-2:1.0" | sudo tee /sys/bus/usb/drivers/uas/bind
then smartctl works.

I tested on tw kernels with the two different seagate drives.

sudo grep Seagate /sys/devices/ -r |& grep Seagate
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/manufacturer:Seagate
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/host8/target8:0:0/8:0:0:0/vendor:Seagate

head /sys/devices/pci0000\:00/0000\:00\:14.0/usb2/2-2/quirks 
0x0

 


lrwxrwxrwx 1 root root  9 12 juin  03:14 usb-
Seagate_Expansion_HDD_00000000NACSHZWL-0:0 -> ../../sdc
lrwxrwxrwx 1 root root 10 12 juin  03:14 usb-Seagate_Expansion_HDD_00000000NACSHZWL-0:0-part1 -> ../../sdc1

sudo smartctl -i /dev/sdc
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.10.0-rc3+] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

Read Device Identity failed: scsi error unsupported field in scsi command

If this is a USB connected device, look at the various --device=TYPE variants
A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.


lsusb -t
/:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/12p, 480M
    |__ Port 001: Dev 002, If 0, Class=Vendor Specific Class, Driver=[none], 12M
    |__ Port 001: Dev 002, If 1, Class=Audio, Driver=[none], 12M
    |__ Port 001: Dev 002, If 2, Class=Audio, Driver=[none], 12M
    |__ Port 005: Dev 003, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 002: Dev 005, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
        |__ Port 003: Dev 008, If 0, Class=Wireless, Driver=btusb, 12M
        |__ Port 003: Dev 008, If 1, Class=Wireless, Driver=btusb, 12M
    |__ Port 009: Dev 004, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 003: Dev 009, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 003: Dev 009, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 004: Dev 010, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 004: Dev 010, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
/:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    |__ Port 002: Dev 002, If 0, Class=Mass Storage, Driver=uas, 5000M
    |__ Port 003: Dev 003, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
    |__ Port 005: Dev 004, If 0, Class=Hub, Driver=hub/4p, 5000M
    |__ Port 006: Dev 005, If 0, Class=Mass Storage, Driver=usb-storage, 5000M

with the "j" usb.quirks flag:
sudo smartctl -i /dev/sdc
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.10.0-rc3+] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke,
www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 2.5 5400
Device Model:     ST4000LM024-2AN17V
Serial Number:    WCKAEWZZ
LU WWN Device Id: 5 000c50 0e732b6d8
Firmware Version: 0001
User Capacity:    4 000 787 030 016 bytes [4,00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5526 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database 7.3/5528
ATA Version is:   ACS-3 T13/2161-D revision 5
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Wed Jun 12 03:30:47 2024 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled



Regards,
Alban

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: add NO_REPORT_LUNS quirk for at least a few Seagate external drives to fix smartctl with uas
  2024-06-12  1:39   ` Alban Browaeys
@ 2024-06-12 15:13     ` Alban Browaeys
  2024-06-14  0:18       ` Alban Browaeys
  0 siblings, 1 reply; 7+ messages in thread
From: Alban Browaeys @ 2024-06-12 15:13 UTC (permalink / raw)
  To: Oliver Neukum, linux-usb

Le mercredi 12 juin 2024 à 03:39 +0200, Alban Browaeys a écrit :
> Le mardi 11 juin 2024 à 10:21 +0200, Oliver Neukum a écrit :
> > 
> > 
> > On 10.06.24 21:25, Alban Browaeys wrote:
> > > I found that for "smartctl" to work on my two Seagate Expansion
> > > external USB3  I had to add the "j" usb-storage quirks ie
> > > "US_FL_NO_REPORT_LUNS".
> > > (They are years apart).
> > 
> > Hi,
> > 
> > does the attached patch do the job?
> > 
> > 	Regards
> > 		Oliver
> 
> No, it does not work.
> smartctl is still broken with the US_FL_NO_REPORT_LUNS in
> drivers/usb/storage/unusual_uas.h.
> 
> But if I add back the "j" usb.quirks flag back with:
> echo -n "0x0bc2:0x2037:j" | sudo tee 
> /sys/module/usb_storage/parameters/quirks
> and then:
> echo -n "2-2:1.0" | sudo tee /sys/bus/usb/drivers/uas/unbind
> echo -n "2-2:1.0" | sudo tee /sys/bus/usb/drivers/uas/bind
> then smartctl works.
> 
> I tested on tw kernels with the two different seagate drives.
> 
> sudo grep Seagate /sys/devices/ -r |& grep Seagate
> /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/manufacturer:Seagate
> /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-
> 2:1.0/host8/target8:0:0/8:0:0:0/vendor:Seagate
> 
> head /sys/devices/pci0000\:00/0000\:00\:14.0/usb2/2-2/quirks 
> 0x0
> 
>  
> 
> 
> lrwxrwxrwx 1 root root  9 12 juin  03:14 usb-
> Seagate_Expansion_HDD_00000000NACSHZWL-0:0 -> ../../sdc
> lrwxrwxrwx 1 root root 10 12 juin  03:14 usb-
> Seagate_Expansion_HDD_00000000NACSHZWL-0:0-part1 -> ../../sdc1
> 
> sudo smartctl -i /dev/sdc
> smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.10.0-rc3+] (local
> build)
> Copyright (C) 2002-23, Bruce Allen, Christian Franke,
> www.smartmontools.org
> 
> Read Device Identity failed: scsi error unsupported field in scsi
> command
> 
> If this is a USB connected device, look at the various --device=TYPE
> variants
> A mandatory SMART command failed: exiting. To continue, add one or
> more '-T permissive' options.
> 
> 
> lsusb -t
> /:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/12p,
> 480M
>     |__ Port 001: Dev 002, If 0, Class=Vendor Specific Class,
> Driver=[none], 12M
>     |__ Port 001: Dev 002, If 1, Class=Audio, Driver=[none], 12M
>     |__ Port 001: Dev 002, If 2, Class=Audio, Driver=[none], 12M
>     |__ Port 005: Dev 003, If 0, Class=Hub, Driver=hub/4p, 480M
>         |__ Port 002: Dev 005, If 0, Class=Vendor Specific Class,
> Driver=cp210x, 12M
>         |__ Port 003: Dev 008, If 0, Class=Wireless, Driver=btusb,
> 12M
>         |__ Port 003: Dev 008, If 1, Class=Wireless, Driver=btusb,
> 12M
>     |__ Port 009: Dev 004, If 0, Class=Hub, Driver=hub/4p, 480M
>         |__ Port 003: Dev 009, If 0, Class=Human Interface Device,
> Driver=usbhid, 1.5M
>         |__ Port 003: Dev 009, If 1, Class=Human Interface Device,
> Driver=usbhid, 1.5M
>         |__ Port 004: Dev 010, If 0, Class=Human Interface Device,
> Driver=usbhid, 1.5M
>         |__ Port 004: Dev 010, If 1, Class=Human Interface Device,
> Driver=usbhid, 1.5M
> /:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/6p,
> 5000M
>     |__ Port 002: Dev 002, If 0, Class=Mass Storage, Driver=uas,
> 5000M
>     |__ Port 003: Dev 003, If 0, Class=Mass Storage, Driver=usb-
> storage, 5000M
>     |__ Port 005: Dev 004, If 0, Class=Hub, Driver=hub/4p, 5000M
>     |__ Port 006: Dev 005, If 0, Class=Mass Storage, Driver=usb-
> storage, 5000M
> 
> with the "j" usb.quirks flag:
> sudo smartctl -i /dev/sdc
> smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.10.0-rc3+] (local
> build)
> Copyright (C) 2002-23, Bruce Allen, Christian Franke,
> www.smartmontools.org
> 
> === START OF INFORMATION SECTION ===
> Model Family:     Seagate Barracuda 2.5 5400
> Device Model:     ST4000LM024-2AN17V
> Serial Number:    WCKAEWZZ
> LU WWN Device Id: 5 000c50 0e732b6d8
> Firmware Version: 0001
> User Capacity:    4 000 787 030 016 bytes [4,00 TB]
> Sector Sizes:     512 bytes logical, 4096 bytes physical
> Rotation Rate:    5526 rpm
> Form Factor:      2.5 inches
> Device is:        In smartctl database 7.3/5528
> ATA Version is:   ACS-3 T13/2161-D revision 5
> SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
> Local Time is:    Wed Jun 12 03:30:47 2024 CEST
> SMART support is: Available - device has SMART capability.
> SMART support is: Enabled
> 
> 



Your patch had:
+UNUSUAL_DEV(0x0bc2, 0x2037, 0x0000, 0x9999,
+		"Seagate",
+		"RSS LLC Expansion HDD",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_NO_REPORT_LUNS),
+
+/* Reported-by: Alban Browaeys <alban.browaeys@gmail.com> */
+UNUSUAL_DEV(0x0bc2, 0x231a, 0x0000, 0x9999,
+		"Seagate",
+		"RSS LLC Expansion Portable",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_NO_REPORT_LUNS),
+

but:
head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/manufacturer
Seagate

head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/product
Expansion HDD

head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/id*
==> /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/idProduct <==
2037

==> /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/idVendor <==
0bc2
head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/quirks
0x0



and:

head /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/manufacturer 
Seagate
head /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/product 
Expansion
head /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/id*
==> /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/idProduct <==
231a

==> /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/idVendor <==
0bc2


I replace the product name with the one from sysfs in your patch but the patch still does not work.
+UNUSUAL_DEV(0x0bc2, 0x2037, 0x0000, 0x9999,
+               "Seagate",
+               "Expansion HDD",
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_NO_REPORT_LUNS),

+UNUSUAL_DEV(0x0bc2, 0x231a, 0x0000, 0x9999,
+               "Seagate",
+               "Expansion",
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_NO_REPORT_LUNS),



How could I see if the quirk is applied?
Does sysfs:
head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/quirks
0x0
tells it was not?


On the 0x2037 box:
lsusb -t
/:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/12p, 480M
    |__ Port 001: Dev 002, If 0, Class=Vendor Specific Class, Driver=[none], 12M
    |__ Port 001: Dev 002, If 1, Class=Audio, Driver=[none], 12M
    |__ Port 001: Dev 002, If 2, Class=Audio, Driver=[none], 12M
    |__ Port 005: Dev 003, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 002: Dev 005, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
        |__ Port 003: Dev 008, If 0, Class=Wireless, Driver=btusb, 12M
        |__ Port 003: Dev 008, If 1, Class=Wireless, Driver=btusb, 12M
    |__ Port 009: Dev 004, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 003: Dev 009, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 003: Dev 009, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 004: Dev 010, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 004: Dev 010, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
/:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    |__ Port 002: Dev 002, If 0, Class=Mass Storage, Driver=uas, 5000M
    |__ Port 003: Dev 003, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
    |__ Port 005: Dev 004, If 0, Class=Hub, Driver=hub/4p, 5000M
    |__ Port 006: Dev 005, If 0, Class=Mass Storage, Driver=usb-storage, 5000M


lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 046d:08ae Logitech, Inc. QuickCam for Notebooks
Bus 001 Device 003: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 001 Device 004: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 001 Device 005: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Bus 001 Device 008: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 009: ID 17ef:608c Lenovo Lenovo Calliope USB Keyboard
Bus 001 Device 010: ID 046d:c517 Logitech, Inc. LX710 Cordless Desktop Laser
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002: ID 0bc2:2037 Seagate RSS LLC Expansion HDD
Bus 002 Device 003: ID 1058:1078 Western Digital Technologies, Inc. Elements Portable (WDBUZG)
Bus 002 Device 004: ID 05e3:0626 Genesys Logic, Inc. Hub
Bus 002 Device 005: ID 08e4:017a Pioneer Corp. BD-XD07 BD/DVD/CD Writer



Mind I have not test the 0x231a device on 6.9 branch yet as the kernel
build with the patch change is till building. I only tested the 0x2037
one on 6.10.0-rc3.



Regards,
Alban


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: add NO_REPORT_LUNS quirk for at least a few Seagate external drives to fix smartctl with uas
  2024-06-12 15:13     ` Alban Browaeys
@ 2024-06-14  0:18       ` Alban Browaeys
  2024-06-14  1:20         ` Remove NO_ATA_1X quirk for at least a few Seagate external drives to fix smartctl with uas ? Alban Browaeys
  0 siblings, 1 reply; 7+ messages in thread
From: Alban Browaeys @ 2024-06-14  0:18 UTC (permalink / raw)
  To: Oliver Neukum, linux-usb

Le mercredi 12 juin 2024 à 17:13 +0200, Alban Browaeys a écrit :
> Le mercredi 12 juin 2024 à 03:39 +0200, Alban Browaeys a écrit :
> > Le mardi 11 juin 2024 à 10:21 +0200, Oliver Neukum a écrit :
> > > 
> > > 
> > > On 10.06.24 21:25, Alban Browaeys wrote:
> > > > I found that for "smartctl" to work on my two Seagate Expansion
> > > > external USB3  I had to add the "j" usb-storage quirks ie
> > > > "US_FL_NO_REPORT_LUNS".
> > > > (They are years apart).
> > > 
> > > Hi,
> > > 
> > > does the attached patch do the job?
> > > 
> > > 	Regards
> > > 		Oliver
> > 
> > No, it does not work.
> > smartctl is still broken with the US_FL_NO_REPORT_LUNS in
> > drivers/usb/storage/unusual_uas.h.
> > 
> > But if I add back the "j" usb.quirks flag back with:
> > echo -n "0x0bc2:0x2037:j" | sudo tee 
> > /sys/module/usb_storage/parameters/quirks
> > and then:
> > echo -n "2-2:1.0" | sudo tee /sys/bus/usb/drivers/uas/unbind
> > echo -n "2-2:1.0" | sudo tee /sys/bus/usb/drivers/uas/bind
> > then smartctl works.
> > 
> > I tested on tw kernels with the two different seagate drives.
> > 
> > sudo grep Seagate /sys/devices/ -r |& grep Seagate
> > /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/manufacturer:Seagate
> > /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-
> > 2:1.0/host8/target8:0:0/8:0:0:0/vendor:Seagate
> > 
> > head /sys/devices/pci0000\:00/0000\:00\:14.0/usb2/2-2/quirks 
> > 0x0
> > 
> >  
> > 
> > 
> > lrwxrwxrwx 1 root root  9 12 juin  03:14 usb-
> > Seagate_Expansion_HDD_00000000NACSHZWL-0:0 -> ../../sdc
> > lrwxrwxrwx 1 root root 10 12 juin  03:14 usb-
> > Seagate_Expansion_HDD_00000000NACSHZWL-0:0-part1 -> ../../sdc1
> > 
> > sudo smartctl -i /dev/sdc
> > smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.10.0-rc3+] (local
> > build)
> > Copyright (C) 2002-23, Bruce Allen, Christian Franke,
> > www.smartmontools.org
> > 
> > Read Device Identity failed: scsi error unsupported field in scsi
> > command
> > 
> > If this is a USB connected device, look at the various --
> > device=TYPE
> > variants
> > A mandatory SMART command failed: exiting. To continue, add one or
> > more '-T permissive' options.
> > 
> > 
> > lsusb -t
> > /:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/12p,
> > 480M
> >     |__ Port 001: Dev 002, If 0, Class=Vendor Specific Class,
> > Driver=[none], 12M
> >     |__ Port 001: Dev 002, If 1, Class=Audio, Driver=[none], 12M
> >     |__ Port 001: Dev 002, If 2, Class=Audio, Driver=[none], 12M
> >     |__ Port 005: Dev 003, If 0, Class=Hub, Driver=hub/4p, 480M
> >         |__ Port 002: Dev 005, If 0, Class=Vendor Specific Class,
> > Driver=cp210x, 12M
> >         |__ Port 003: Dev 008, If 0, Class=Wireless, Driver=btusb,
> > 12M
> >         |__ Port 003: Dev 008, If 1, Class=Wireless, Driver=btusb,
> > 12M
> >     |__ Port 009: Dev 004, If 0, Class=Hub, Driver=hub/4p, 480M
> >         |__ Port 003: Dev 009, If 0, Class=Human Interface Device,
> > Driver=usbhid, 1.5M
> >         |__ Port 003: Dev 009, If 1, Class=Human Interface Device,
> > Driver=usbhid, 1.5M
> >         |__ Port 004: Dev 010, If 0, Class=Human Interface Device,
> > Driver=usbhid, 1.5M
> >         |__ Port 004: Dev 010, If 1, Class=Human Interface Device,
> > Driver=usbhid, 1.5M
> > /:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/6p,
> > 5000M
> >     |__ Port 002: Dev 002, If 0, Class=Mass Storage, Driver=uas,
> > 5000M
> >     |__ Port 003: Dev 003, If 0, Class=Mass Storage, Driver=usb-
> > storage, 5000M
> >     |__ Port 005: Dev 004, If 0, Class=Hub, Driver=hub/4p, 5000M
> >     |__ Port 006: Dev 005, If 0, Class=Mass Storage, Driver=usb-
> > storage, 5000M
> > 
> > with the "j" usb.quirks flag:
> > sudo smartctl -i /dev/sdc
> > smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.10.0-rc3+] (local
> > build)
> > Copyright (C) 2002-23, Bruce Allen, Christian Franke,
> > www.smartmontools.org
> > 
> > === START OF INFORMATION SECTION ===
> > Model Family:     Seagate Barracuda 2.5 5400
> > Device Model:     ST4000LM024-2AN17V
> > Serial Number:    WCKAEWZZ
> > LU WWN Device Id: 5 000c50 0e732b6d8
> > Firmware Version: 0001
> > User Capacity:    4 000 787 030 016 bytes [4,00 TB]
> > Sector Sizes:     512 bytes logical, 4096 bytes physical
> > Rotation Rate:    5526 rpm
> > Form Factor:      2.5 inches
> > Device is:        In smartctl database 7.3/5528
> > ATA Version is:   ACS-3 T13/2161-D revision 5
> > SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
> > Local Time is:    Wed Jun 12 03:30:47 2024 CEST
> > SMART support is: Available - device has SMART capability.
> > SMART support is: Enabled
> > 
> > 
> 
> 
> 
> Your patch had:
> +UNUSUAL_DEV(0x0bc2, 0x2037, 0x0000, 0x9999,
> +		"Seagate",
> +		"RSS LLC Expansion HDD",
> +		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
> +		US_FL_NO_REPORT_LUNS),
> +
> +/* Reported-by: Alban Browaeys <alban.browaeys@gmail.com> */
> +UNUSUAL_DEV(0x0bc2, 0x231a, 0x0000, 0x9999,
> +		"Seagate",
> +		"RSS LLC Expansion Portable",
> +		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
> +		US_FL_NO_REPORT_LUNS),
> +
> 
> but:
> head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/manufacturer
> Seagate
> 
> head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/product
> Expansion HDD
> 
> head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/id*
> ==> /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/idProduct <==
> 2037
> 
> ==> /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/idVendor <==
> 0bc2
> head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/quirks
> 0x0
> 
> 
> 
> and:
> 
> head /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-
> hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/manufacturer
> Seagate
> head /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-
> hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/product
> Expansion
> head /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-
> hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/id*
> ==> /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-
> hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/idProduct <==
> 231a
> 
> ==> /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-
> hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/idVendor <==
> 0bc2
> 
> 
> I replace the product name with the one from sysfs in your patch but
> the patch still does not work.
> +UNUSUAL_DEV(0x0bc2, 0x2037, 0x0000, 0x9999,
> +               "Seagate",
> +               "Expansion HDD",
> +               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
> +               US_FL_NO_REPORT_LUNS),
> 
> +UNUSUAL_DEV(0x0bc2, 0x231a, 0x0000, 0x9999,
> +               "Seagate",
> +               "Expansion",
> +               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
> +               US_FL_NO_REPORT_LUNS),
> 
> 
> 
> How could I see if the quirk is applied?
> Does sysfs:
> head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/quirks
> 0x0
> tells it was not?
> 
> 
> On the 0x2037 box:
> lsusb -t
> /:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/12p,
> 480M
>     |__ Port 001: Dev 002, If 0, Class=Vendor Specific Class,
> Driver=[none], 12M
>     |__ Port 001: Dev 002, If 1, Class=Audio, Driver=[none], 12M
>     |__ Port 001: Dev 002, If 2, Class=Audio, Driver=[none], 12M
>     |__ Port 005: Dev 003, If 0, Class=Hub, Driver=hub/4p, 480M
>         |__ Port 002: Dev 005, If 0, Class=Vendor Specific Class,
> Driver=cp210x, 12M
>         |__ Port 003: Dev 008, If 0, Class=Wireless, Driver=btusb,
> 12M
>         |__ Port 003: Dev 008, If 1, Class=Wireless, Driver=btusb,
> 12M
>     |__ Port 009: Dev 004, If 0, Class=Hub, Driver=hub/4p, 480M
>         |__ Port 003: Dev 009, If 0, Class=Human Interface Device,
> Driver=usbhid, 1.5M
>         |__ Port 003: Dev 009, If 1, Class=Human Interface Device,
> Driver=usbhid, 1.5M
>         |__ Port 004: Dev 010, If 0, Class=Human Interface Device,
> Driver=usbhid, 1.5M
>         |__ Port 004: Dev 010, If 1, Class=Human Interface Device,
> Driver=usbhid, 1.5M
> /:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/6p,
> 5000M
>     |__ Port 002: Dev 002, If 0, Class=Mass Storage, Driver=uas,
> 5000M
>     |__ Port 003: Dev 003, If 0, Class=Mass Storage, Driver=usb-
> storage, 5000M
>     |__ Port 005: Dev 004, If 0, Class=Hub, Driver=hub/4p, 5000M
>     |__ Port 006: Dev 005, If 0, Class=Mass Storage, Driver=usb-
> storage, 5000M
> 
> 
> lsusb
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 001 Device 002: ID 046d:08ae Logitech, Inc. QuickCam for
> Notebooks
> Bus 001 Device 003: ID 05e3:0610 Genesys Logic, Inc. Hub
> Bus 001 Device 004: ID 05e3:0610 Genesys Logic, Inc. Hub
> Bus 001 Device 005: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
> Bus 001 Device 008: ID 0a12:0001 Cambridge Silicon Radio, Ltd
> Bluetooth Dongle (HCI mode)
> Bus 001 Device 009: ID 17ef:608c Lenovo Lenovo Calliope USB Keyboard
> Bus 001 Device 010: ID 046d:c517 Logitech, Inc. LX710 Cordless
> Desktop Laser
> Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
> Bus 002 Device 002: ID 0bc2:2037 Seagate RSS LLC Expansion HDD
> Bus 002 Device 003: ID 1058:1078 Western Digital Technologies, Inc.
> Elements Portable (WDBUZG)
> Bus 002 Device 004: ID 05e3:0626 Genesys Logic, Inc. Hub
> Bus 002 Device 005: ID 08e4:017a Pioneer Corp. BD-XD07 BD/DVD/CD
> Writer
> 
> 
> 
> Mind I have not test the 0x231a device on 6.9 branch yet as the
> kernel
> build with the patch change is till building. I only tested the
> 0x2037
> one on 6.10.0-rc3.
> 
> 
> 
> Regards,
> Alban
> 

Note: Should I add Hans de Goede to the recipients, or only when the
patch is ready?



I read the code but I cannot find where the flags are applied in the
uas driver (drivers/usb/storage/uas.c).

In usb-storage the flow is:
storage_probe drivers/usb/storage/usb.c
> uas_use_uas_driver if true exit
> usb_stor_probe1
	> get_device_info
		> usb_stor_adjust_quirks
			> usb-storage.quirks applied

but for my uas diver when usb-storage driver probe it exits in
storage_probe before usb_stor_probe1 because uas_use_uas is true.


When uas probe:
uas_init drivers/usb/storage/uas.c
> usb_register
	> usb_device_match+0x43/0xa0
		> usb_match_id+0x70/0xb0
			> usb_match_device+0x13a/0x210
				usb_match_device: SUCCESS id_table idVendor 0xbc2 idProduct 0x2037 driver_info 0x10000000 devive id vendor 0xbc2 device id product 0x2037
but then I see no code to apply the flag US_FL_NO_REPORT_LUNS.
Could you help me find it?

I don't understand how the usb-storage.quirks "j" flag could help if
the uas has no code to apply the flag.



I alos see in the code that I was supposed to add more info:

for 0x0bc2 0x2037:
- /sys/kernel/debug/usb/devices
T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
P:  Vendor=0bc2 ProdID=2037 Rev=19.01
S:  Manufacturer=Seagate
S:  Product=Expansion HDD
S:  SerialNumber=00000000NACSHZWL
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=896mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=uas
E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:* If#= 0 Alt= 1 #EPs= 4 Cls=08(stor.) Sub=06 Prot=62 Driver=uas
E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms

- lsusb -v
Bus 002 Device 002: ID 0bc2:2037 Seagate RSS LLC Expansion HDD
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.20
  bDeviceClass            0 [unknown]
  bDeviceSubClass         0 [unknown]
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x0bc2 Seagate RSS LLC
  idProduct          0x2037 Expansion HDD
  bcdDevice           19.01
  iManufacturer           1 Seagate
  iProduct                2 Expansion HDD
  iSerial                 3 00000000NACSHZWL
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0079
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              896mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           4
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     98 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               0
        Command pipe (0x01)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               0
        MaxStreams             32
        Status pipe (0x02)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
        MaxStreams             32
        Data-in pipe (0x03)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               7
        MaxStreams             32
        Data-out pipe (0x04)
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x0016
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000f0e
      BESL Link Power Management (LPM) Supported
    BESL value     3840 us 
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat          32 micro seconds
Device Status:     0x000c
  (Bus Powered)
  U1 Enabled
  U2 Enabled


for 0x0bc2 0x231a
- /sys/kernel/debug/usb/devices
T:  Bus=02 Lev=04 Prnt=05 Port=03 Cnt=02 Dev#=  8 Spd=5000 MxCh= 0
D:  Ver= 3.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
P:  Vendor=0bc2 ProdID=231a Rev= 7.10
S:  Manufacturer=Seagate
S:  Product=Expansion
S:  SerialNumber=NAADEE3G
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=896mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=uas
E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:* If#= 0 Alt= 1 #EPs= 4 Cls=08(stor.) Sub=06 Prot=62 Driver=uas
E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms


- lsusb -v
Bus 002 Device 008: ID 0bc2:231a Seagate RSS LLC Expansion Portable
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x0bc2 Seagate RSS LLC
  idProduct          0x231a Expansion Portable
  bcdDevice            7.10
  iManufacturer           1 Seagate
  iProduct                2 Expansion
  iSerial                 3 NAADEE3G
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0079
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              896mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           4
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     98 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               0
        Command pipe (0x01)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               0
        MaxStreams             32
        Status pipe (0x02)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
        MaxStreams             32
        Data-in pipe (0x03)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               7
        MaxStreams             32
        Data-out pipe (0x04)
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x0016
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000f0e
      BESL Link Power Management (LPM) Supported
    BESL value     3840 us 
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat          32 micro seconds
Device Status:     0x0000
  (Bus Powered)



Cheers,
Alban

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Remove NO_ATA_1X quirk for at least a few Seagate external drives to fix smartctl with uas ?
  2024-06-14  0:18       ` Alban Browaeys
@ 2024-06-14  1:20         ` Alban Browaeys
  0 siblings, 0 replies; 7+ messages in thread
From: Alban Browaeys @ 2024-06-14  1:20 UTC (permalink / raw)
  To: Oliver Neukum, linux-usb

I found where the quirk from usb-storage.quirks applies to uas:
uas_probe drivers/usb/storage/uas.c u64 dev_flags;
> uas_use_uas_driver(intf, id, &dev_flags) drivers/usb/storage/uas-detect.h u64 flags = id->driver_info;
	> usb_stor_adjust_quirks(udev, &flags); 

Thus I found why the patch does not work.
The fix to get smartctl working is not to set NO_REPORT_LUNS (though
this lead me to debug why and find why smarttl was broken).

I found that with the NO_REPORT_LUNS patch the flags set by
usb_stor_adjust_quirks were 12000000, ie:
	US_FLAG(NO_ATA_1X,      0x02000000
	US_FLAG(NO_REPORT_LUNS, 0x10000000)
and without the patch the value is likely: 0x02000000

But with the working "0x0bc2:0x2037:j" usb-storage.quirks the flags
value was 10000000, thus the NO_ATA_1X was removed.

So I though that maybe teh issue was with NO_ATA_1X being applied by
default and not with a missing NO_REPORT_LUNS.

So I tried:
 echo -n "0x0bc2:0x2037:" | sudo tee  /sys/module/usb_storage/parameters/quirks
and I get a flags value of "0" and smartctl is working.

sudo smartctl -i /dev/sdd
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.10.0-rc3+] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 2.5 5400
Device Model:     ST4000LM024-2AN17V
Serial Number:    WCKAEWZZ
LU WWN Device Id: 5 000c50 0e732b6d8
Firmware Version: 0001
User Capacity:    4 000 787 030 016 bytes [4,00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5526 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database 7.3/5528
ATA Version is:   ACS-3 T13/2161-D revision 5
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Fri Jun 14 02:58:20 2024 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled



The issue is US_FL_NO_ATA_1X is harcoded in uas_use_uas_driver drivers/usb/storage/uas-detect.h.
/* All Seagate disk enclosures have broken ATA pass-through support */
if (le16_to_cpu(udev->descriptor.idVendor) == 0x0bc2)
        flags |= US_FL_NO_ATA_1X;

How can I confirm that indeed at least my two Seagate drives are fine
with US_FL_NO_ATA_1X and how would you suggest disabling this flag if
these drives are stable? Add a new flag to force enable US_FL_NO_ATA_1X
via quirks only for specific Seagate drives?

Regards,
Alban

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-06-14  1:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-10 19:25 add NO_REPORT_LUNS quirk for at least a few Seagate external drives to fix smartctl with uas Alban Browaeys
2024-06-11  6:08 ` Greg KH
2024-06-11  8:21 ` Oliver Neukum
2024-06-12  1:39   ` Alban Browaeys
2024-06-12 15:13     ` Alban Browaeys
2024-06-14  0:18       ` Alban Browaeys
2024-06-14  1:20         ` Remove NO_ATA_1X quirk for at least a few Seagate external drives to fix smartctl with uas ? Alban Browaeys

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox