smartie.scsi package¶
- class smartie.scsi.SCSIDevice(path: Path | str)[source]¶
Bases:
Device
,ABC
- property device_type¶
Get the device’s type, if available.
- get_filters() List[str] [source]¶
Returns a list of filters that should be used when looking up this device in the device database.
- identify(try_atapi_on_failure=True) Tuple[IdentifyResponse, SCSIResponse] [source]¶
Issues a standard ATA IDENTIFY command.
- Parameters:
try_atapi_on_failure – If True, will try an ATAPI IDENTIFY command if the ATA IDENTIFY command fails.
- inquiry() Tuple[InquiryResponse, SCSIResponse] [source]¶
Issues a standard SCSI INQUIRY command.
- issue_command(direction: Direction, command: Structure, data: Array | Structure | None, *, timeout: int = 3000) SCSIResponse [source]¶
Issues an SCSI passthrough command to the disk.
- Parameters:
direction – Direction for this command.
command – Command to be sent to the device.
data – Command data to be sent/received to/from the device.
timeout – Timeout in milliseconds. Setting this to MAX_INT results in no timeout.
- property model: str | None¶
Returns the model name of the device.
- classmethod parse_sense(sense_blob) FixedFormatSense | DescriptorFormatSense | None [source]¶
Parses the sense response from an SCSI command, raising a
smartie.errors.SenseError
if an error occurred.Will return either a
structures.FixedFormatSense
or astructures.DescriptorFormatSense
depending on the error code.- Parameters:
sense_blob – A bytearray (or similar) object containing the unparsed sense response.
- property serial: str | None¶
Returns the serial number of the device.
- smart() Tuple[SmartDataResponse, SCSIResponse] [source]¶
Issues an ATA SMART READ_DATA command.
- property smart_table: Dict[int, SMARTAttribute]¶
Returns a parsed and processed dictionary of SMART attributes.
- smart_thresholds() Tuple[SmartThresholdResponse, SCSIResponse] [source]¶
Issues an ATA SMART READ_THRESHOLDS command.
- property temperature: int | None¶
Returns the temperature of the device in degrees Celsius.
- class smartie.scsi.SCSIResponse(succeeded: bool | None, sense: FixedFormatSense | DescriptorFormatSense | None, command: Command16 | Command12, bytes_transferred: int | None, platform_header: Any)[source]¶
Bases:
object
Common response object for SCSI commands.
This object attempts to encapsulate the response from an SCSI command in a platform-agnostic way. It contains the sense data, the command that was issued, and whether the command succeeded or not.
For additional platform-specific information, the platform_header attribute contains the platform-specific header that was used to issue the command.
- bytes_transferred: int | None¶
The actual number of bytes transferred.
- platform_header: Any¶
The platform-specific header that was used to issue the command. For example this may be an
SCSIPassThroughDirectWithBuffer
on Windows.
- sense: FixedFormatSense | DescriptorFormatSense | None¶
The sense data returned by the device.
- succeeded: bool | None¶
Whether the command succeeded. If None, the status is unknown.
Submodules¶
- smartie.scsi.linux module
- smartie.scsi.structures module
ATACommands
ATAPICommands
ATAProtocol
ATAProtocol.DEVICE_DIAGNOSTIC
ATAProtocol.DEVICE_RESET
ATAProtocol.DMA
ATAProtocol.DMA_QUEUED
ATAProtocol.FPDMA
ATAProtocol.HARD_RESET
ATAProtocol.NON_DATA
ATAProtocol.PIO_DATA_IN
ATAProtocol.PIO_DATA_OUT
ATAProtocol.RETURN_RESPONSE_INFORMATION
ATAProtocol.SRST
ATAProtocol.UDMA_DATA_IN
ATAProtocol.UDMA_DATA_OUT
ATASmartFeature
ATASmartFeature.SMART_DISABLE_OPERATIONS
ATASmartFeature.SMART_ENABLE_OPERATIONS
ATASmartFeature.SMART_EXECUTE_OFF_LINE_IMMEDIATE
ATASmartFeature.SMART_READ_DATA
ATASmartFeature.SMART_READ_LOG
ATASmartFeature.SMART_READ_THRESHOLDS
ATASmartFeature.SMART_RETURN_STATUS
ATASmartFeature.SMART_TOGGLE_ATTRIBUTE_AUTOSAVE
ATASmartFeature.SMART_WRITE_LOG
Command12
Command12.command
Command12.control
Command12.device
Command12.features
Command12.flags
Command12.lba_high
Command12.lba_low
Command12.lba_mid
Command12.operation_code
Command12.protocol
Command12.reserved_1
Command12.reserved_2
Command12.reserved_3
Command12.reserved_4
Command12.reserved_5
Command12.sector_count
Command16
CommandFlags
DescriptorFormatSense
DeviceType
Direction
FixedFormatSense
FixedFormatSense.additional_sense_code
FixedFormatSense.additional_sense_code_qualifier
FixedFormatSense.additional_sense_length
FixedFormatSense.command_specific_information
FixedFormatSense.eom
FixedFormatSense.error_code
FixedFormatSense.field_replaceable_unit_code
FixedFormatSense.filemark
FixedFormatSense.ili
FixedFormatSense.information
FixedFormatSense.reserved_1
FixedFormatSense.segment_number
FixedFormatSense.sense_key
FixedFormatSense.sense_key_specific
FixedFormatSense.valid
IOCTL_SCSI_PASS_THROUGH_DIRECT
IOCTL_SG_IO
IdentifyResponse
IdentifyResponse.device_type
IdentifyResponse.firmware_revision
IdentifyResponse.fixed_device
IdentifyResponse.model_number
IdentifyResponse.padding_1
IdentifyResponse.padding_2
IdentifyResponse.removable_media
IdentifyResponse.reserved_1
IdentifyResponse.response_incomplete
IdentifyResponse.retired_1
IdentifyResponse.retired_2
IdentifyResponse.retired_3
IdentifyResponse.serial_number
InquiryCommand
InquiryResponse
InquiryResponse.additional_length
InquiryResponse.cmd_que
InquiryResponse.enc_serv
InquiryResponse.hi_sup
InquiryResponse.hot_pluggable
InquiryResponse.lu_cong
InquiryResponse.multi_p
InquiryResponse.norm_aca
InquiryResponse.obsolete_1
InquiryResponse.obsolete_2
InquiryResponse.obsolete_3
InquiryResponse.obsolete_4
InquiryResponse.obsolete_5
InquiryResponse.obsolete_6
InquiryResponse.obsolete_7
InquiryResponse.obsolete_8
InquiryResponse.peripheral_device_type
InquiryResponse.peripheral_qualifier
InquiryResponse.product_identification
InquiryResponse.product_revision_level
InquiryResponse.protect
InquiryResponse.reserved_1
InquiryResponse.reserved_10
InquiryResponse.reserved_11
InquiryResponse.reserved_2
InquiryResponse.reserved_3
InquiryResponse.reserved_4
InquiryResponse.reserved_5
InquiryResponse.reserved_6
InquiryResponse.reserved_7
InquiryResponse.reserved_8
InquiryResponse.reserved_9
InquiryResponse.response_data_format
InquiryResponse.rmb
InquiryResponse.sccs
InquiryResponse.t10_vendor_identification
InquiryResponse.three_pc
InquiryResponse.tpgs
InquiryResponse.vendor_specific_1
InquiryResponse.version
InquiryResponse.version_descriptors
InquiryResponse.vs_1
InquiryResponse.vs_2
OperationCode
SCSIPassThroughDirect
SCSIPassThroughDirect.cdb
SCSIPassThroughDirect.cdb_length
SCSIPassThroughDirect.data_buffer
SCSIPassThroughDirect.data_in
SCSIPassThroughDirect.data_transfer_length
SCSIPassThroughDirect.length
SCSIPassThroughDirect.lun
SCSIPassThroughDirect.path_id
SCSIPassThroughDirect.scsi_status
SCSIPassThroughDirect.sense_info_length
SCSIPassThroughDirect.sense_info_offset
SCSIPassThroughDirect.target_id
SCSIPassThroughDirect.timeout_value
SCSIPassThroughDirectWithBuffer
SGIOHeader
SGIOHeader.cmd_len
SGIOHeader.cmdp
SGIOHeader.driver_status
SGIOHeader.duration
SGIOHeader.dxfer_direction
SGIOHeader.dxfer_len
SGIOHeader.dxferp
SGIOHeader.flags
SGIOHeader.host_status
SGIOHeader.info
SGIOHeader.interface_id
SGIOHeader.iovec_count
SGIOHeader.masked_status
SGIOHeader.msg_status
SGIOHeader.mx_sb_len
SGIOHeader.pack_id
SGIOHeader.resid
SGIOHeader.sb_len_wr
SGIOHeader.sbp
SGIOHeader.status
SGIOHeader.timeout
SGIOHeader.usr_ptr
SenseErrorCode
SmartDataEntry
SmartDataResponse
SmartDataResponse.attributes
SmartDataResponse.conveyance_self_test_recommended_time
SmartDataResponse.data_checksum_structure
SmartDataResponse.error_logging_capability
SmartDataResponse.extended_self_test_recommended_time
SmartDataResponse.extended_self_test_recommended_time_wide
SmartDataResponse.offline_data_collection_capability
SmartDataResponse.offline_data_collection_status
SmartDataResponse.reserved_1
SmartDataResponse.self_test_execution_status_buyte
SmartDataResponse.short_self_test_recommended_time
SmartDataResponse.smart_capability
SmartDataResponse.vendor_specific_2
SmartDataResponse.vendor_specific_3
SmartDataResponse.vendor_specific_4
SmartDataResponse.version
SmartThresholdEntry
SmartThresholdResponse
StatusCode
- smartie.scsi.windows module