From e680e840140d19cb3419ff92595bc2c91de3368a Mon Sep 17 00:00:00 2001
From: Douglas Gilbert <dgilbert@interlog.com>
Date: Mon, 26 Sep 2022 21:41:45 +0000
Subject: [PATCH 1/2] rescan-scsi-bus.sh speed testonline()

speed testonline() function when
peripheral_qualifier != 0 in the standard INQUIRY
response. See:
https://github.com/doug-gilbert/sg3_utils/issues/24

git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@972 6180dd3e-e324-4e3e-922d-17de1ae2f315

Conflict: Reserve changes about rescan-scsi-bus only
---
 scripts/rescan-scsi-bus.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 67dccf3..0e7697b 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -276,7 +276,7 @@ testonline ()
 
   # Handle in progress of becoming ready and unit attention
   while [ $RC = 2 -o $RC = 6 ] && [ $ctr -le 30 ] ; do
-    if [ $RC = 2 ] && [ "$RMB" != "1" ] ; then
+    if [ $RC = 2 ] && [ "$RMB" != "1" ] && [ sg_inq /dev/$SGDEV | grep -q -i "PQual=0" ] ; then
       echo -n "."
       let LN+=1
       sleep 1
-- 
2.35.3

