Linux USB
 help / color / mirror / Atom feed
From: Aaron Dewes <aaron.dewes@web.de>
To: linux-usb@vger.kernel.org
Subject: A question about UAS
Date: Sat, 6 Mar 2021 17:34:32 +0100	[thread overview]
Message-ID: <2ad0d2f9-0ef1-05b5-76db-b178107bfccb@web.de> (raw)

Hello!

Sorry if this suggestion/question sounds stupid, I don't have experience
with the kernel code and this mailing list.

I'm a contributor to Umbrel (getumbrel.com), and we provide a software
that allows to run a bitcoin node easily, and we've run into many people
having UAS issues, and we were manually adding quirks in this case. Now
I'm wondering if it is possible to disable UAS for all devices in the
kernel cmdline. This is my first question, but I also have another
suggestion. We've developed the following bash script to check for UAS
issues and automatically add quirks:

------

get_uas_string () {
   UDEVADM_DATA=$(sudo -u umbrel udevadm test /block/${block_device} 2> /dev/null) # Umbrel is the  main user on umbrel, and udevadm doesn't report the vendor id if running as root, which this script is
   ID_VENDOR=$(echo "${UDEVADM_DATA}" | grep "ID_VENDOR_ID" | sed 's/ID_VENDOR_ID=//')
   ID_MODEL=$(echo "${UDEVADM_DATA}" | grep "ID_MODEL_ID" | sed 's/ID_MODEL_ID=//')
   echo "${ID_VENDOR}:${ID_MODEL}:u"
}

if [[ $(dmesg) == *"uas_eh_abort_handler"* ]]; then
   echo "External storage might have UAS issues"
   UAS_STRING=$(get_uas_string)
   if [[ $(cat /boot/cmdline.txt) == *"${UAS_STRING}"* ]]; then
     sed "s/usb-storage.quirks=/usb-storage.quirks=$(get_uas_string),/g" -i /boot/cmdline.txt
     echo "Rebooting"
     sudo reboot
   fi
fi

-----

I was wondering if a check like this could be added to the kernel, so
every time uas_eh_abort_handler gets logged, which AFAIK only happens if
UAS has issues, a counter could be increased, so that, if it happens to
often, UAS gets disabled for that drive.

Are there any reasons not do do this because false positives could
happen? If yes, please let me know.

Aaron


             reply	other threads:[~2021-03-06 16:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-06 16:34 Aaron Dewes [this message]
2021-03-06 17:02 ` A question about UAS Greg KH
2021-03-06 17:20   ` Alan Stern
2021-03-06 17:27   ` Aaron Dewes
2021-03-06 18:25     ` Alan Stern
     [not found]       ` <1e60a591-7b7e-ca80-41cf-16fa440d7248@web.de>
2021-03-06 18:39         ` Aaron Dewes
2021-03-06 18:54           ` Greg KH
2021-03-08 13:39 ` Oliver Neukum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ad0d2f9-0ef1-05b5-76db-b178107bfccb@web.de \
    --to=aaron.dewes@web.de \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox