summaryrefslogtreecommitdiff
path: root/include/smartmon/dev_interface.h
diff options
context:
space:
mode:
authorChristian Franke <christian.franke@t-online.de>2026-11-20 15:05:32 +0100
committerChristian Franke <christian.franke@t-online.de>2026-11-20 15:05:32 +0100
commitd788ad8c38ee301f43185cd986b091d79383a11a (patch)
tree2c2b9786b931fb54911431e0afc013e4f7958448 /include/smartmon/dev_interface.h
parent1440bbd39a45a70f77f462fa6c6b05d826b82175 (diff)
downloadsmartmontools-master.tar.gz
smartmontools-master.zip
SCSI: avoid READ CAPACITY(16) for CD/DVD devicesHEADlocal/smartmontoolsmaster
Rework 'scsiGetSize()'. Fix the check for the supported variant of READ CAPACITY. Add 'scsi_device::get/set_rcap_mode()' to preserve the selected variant. Preselect READ CAPACITY(10) in 'scsiStdInquiry()' if a CD/DVD peripheral device type is detected. Signed-off-by: Christian Franke <christian.franke@t-online.de>
Diffstat (limited to 'include/smartmon/dev_interface.h')
-rw-r--r--include/smartmon/dev_interface.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/include/smartmon/dev_interface.h b/include/smartmon/dev_interface.h
index c7f1a0f2..4e07525c 100644
--- a/include/smartmon/dev_interface.h
+++ b/include/smartmon/dev_interface.h
@@ -626,13 +626,15 @@ public:
bool scsi_pass_through_and_check(scsi_cmnd_io * iop,
const char * msg = "");
- /// Always try READ CAPACITY(10) (rcap10) first but once we know
- /// rcap16 is needed, use it instead.
- void set_rcap16_first()
- { rcap16_first = true; }
+ // Preserve result of READ CAPACITY(10/16) support check
+ // or preset READ CAPACITY(10) for CD/DVD drives.
+ enum rcap_mode { try_rcap16, use_rcap10, use_rcap16 };
- bool use_rcap16() const
- { return rcap16_first; }
+ void set_rcap_mode(rcap_mode mode)
+ { m_rcap_mode = mode; }
+
+ rcap_mode get_rcap_mode() const
+ { return m_rcap_mode; }
void set_spc4_or_higher() { spc4_or_above = true; }
@@ -654,7 +656,6 @@ protected:
/// Default constructor, registers device as SCSI.
scsi_device()
: smart_device(never_called),
- rcap16_first(false),
spc4_or_above(false),
rsoc_queried(false),
rsoc_sup(SC_SUPPORT_UNKNOWN),
@@ -666,7 +667,7 @@ protected:
{ hide_scsi(false); }
private:
- bool rcap16_first;
+ rcap_mode m_rcap_mode = try_rcap16;
bool spc4_or_above;
bool rsoc_queried;