From b01c0a062121e48623623f323fc12f9bee34c4dd Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Fri, 12 Mar 2010 22:23:08 +0000
Subject: [PATCH] Linux: Add '/dev/sd[a-c][a-z]' to smartd DEVICESCAN.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@3076 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/CHANGELOG    | 2 ++
 smartmontools/NEWS         | 1 +
 smartmontools/os_linux.cpp | 8 ++++++--
 smartmontools/smartd.8.in  | 3 ++-
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/smartmontools/CHANGELOG b/smartmontools/CHANGELOG
index f08e9e763..e369aee8b 100644
--- a/smartmontools/CHANGELOG
+++ b/smartmontools/CHANGELOG
@@ -43,6 +43,8 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [CF] Linux: Add '/dev/sd[a-c][a-z]' to smartd DEVICESCAN.
+
   [CF] smartd: Other config entries may precede DEVICESCAN.
        Very first step towards a more flexible device scanning.
 
diff --git a/smartmontools/NEWS b/smartmontools/NEWS
index 4317ed6a9..56661b221 100644
--- a/smartmontools/NEWS
+++ b/smartmontools/NEWS
@@ -17,6 +17,7 @@ Summary: smartmontools release 5.40
 - smartd libcap-ng support, option '-C, --capabilities'.
 - smartctl option '-l scterc[,...]' to get/set the
   SCT Error Recovery Control time limit.
+- Linux: Add '/dev/sd[a-c][a-z]' to smartd DEVICESCAN.
 - Windows: Support for 64-bit executables.
 - Windows: Support for cross compilation on Linux.
 - Fix SCT temperature table commands on big endian CPUs.
diff --git a/smartmontools/os_linux.cpp b/smartmontools/os_linux.cpp
index 103af7b26..f78e6deab 100644
--- a/smartmontools/os_linux.cpp
+++ b/smartmontools/os_linux.cpp
@@ -2948,8 +2948,12 @@ bool linux_smart_interface::scan_smart_devices(smart_device_list & devlist,
 
   if (scan_ata)
     get_dev_list(devlist, "/dev/hd[a-t]", true, false, type, false);
-  if (scan_scsi) // Try USB autodetection if no type specifed
-    get_dev_list(devlist, "/dev/sd[a-z]", false, true, type, !*type);
+  if (scan_scsi) {
+    bool autodetect = !*type; // Try USB autodetection if no type specifed
+    get_dev_list(devlist, "/dev/sd[a-z]", false, true, type, autodetect);
+    // Support up to 104 devices
+    get_dev_list(devlist, "/dev/sd[a-c][a-z]", false, true, type, autodetect);
+  }
 
   // if we found traditional links, we are done
   if (devlist.size() > 0)
diff --git a/smartmontools/smartd.8.in b/smartmontools/smartd.8.in
index 6b94f6fe6..fb872059b 100644
--- a/smartmontools/smartd.8.in
+++ b/smartmontools/smartd.8.in
@@ -89,7 +89,8 @@ On startup, in the absence of the configuration file
 devices that support SMART.  The scanning is done as follows:
 .IP \fBLINUX:\fP 9
 Examine all entries \fB"/dev/hd[a-t]"\fP for IDE/ATA
-devices, and \fB"/dev/sd[a-z]"\fP for SCSI devices.
+devices, and \fB"/dev/sd[a-z]"\fP, \fB"/dev/sd[a-c][a-z]"\fP
+for SCSI or SATA devices.
 .IP \fBFREEBSD:\fP 9
 Authoritative list of disk devices is obtained from SCSI (CAM) and ATA subsystems.
 .IP \fBNETBSD/OPENBSD:\fP 9
-- 
GitLab