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.SenseErrorif an error occurred.Will return either a
structures.FixedFormatSenseor astructures.DescriptorFormatSensedepending 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:
objectCommon 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
SCSIPassThroughDirectWithBufferon 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
ATACommandsATAPICommandsATAProtocolATAProtocol.DEVICE_DIAGNOSTICATAProtocol.DEVICE_RESETATAProtocol.DMAATAProtocol.DMA_QUEUEDATAProtocol.FPDMAATAProtocol.HARD_RESETATAProtocol.NON_DATAATAProtocol.PIO_DATA_INATAProtocol.PIO_DATA_OUTATAProtocol.RETURN_RESPONSE_INFORMATIONATAProtocol.SRSTATAProtocol.UDMA_DATA_INATAProtocol.UDMA_DATA_OUT
ATASmartFeatureATASmartFeature.SMART_DISABLE_OPERATIONSATASmartFeature.SMART_ENABLE_OPERATIONSATASmartFeature.SMART_EXECUTE_OFF_LINE_IMMEDIATEATASmartFeature.SMART_READ_DATAATASmartFeature.SMART_READ_LOGATASmartFeature.SMART_READ_THRESHOLDSATASmartFeature.SMART_RETURN_STATUSATASmartFeature.SMART_TOGGLE_ATTRIBUTE_AUTOSAVEATASmartFeature.SMART_WRITE_LOG
Command12Command12.commandCommand12.controlCommand12.deviceCommand12.featuresCommand12.flagsCommand12.lba_highCommand12.lba_lowCommand12.lba_midCommand12.operation_codeCommand12.protocolCommand12.reserved_1Command12.reserved_2Command12.reserved_3Command12.reserved_4Command12.reserved_5Command12.sector_count
Command16CommandFlagsDescriptorFormatSenseDeviceTypeDirectionFixedFormatSenseFixedFormatSense.additional_sense_codeFixedFormatSense.additional_sense_code_qualifierFixedFormatSense.additional_sense_lengthFixedFormatSense.command_specific_informationFixedFormatSense.eomFixedFormatSense.error_codeFixedFormatSense.field_replaceable_unit_codeFixedFormatSense.filemarkFixedFormatSense.iliFixedFormatSense.informationFixedFormatSense.reserved_1FixedFormatSense.segment_numberFixedFormatSense.sense_keyFixedFormatSense.sense_key_specificFixedFormatSense.valid
IOCTL_SCSI_PASS_THROUGH_DIRECTIOCTL_SG_IOIdentifyResponseIdentifyResponse.device_typeIdentifyResponse.firmware_revisionIdentifyResponse.fixed_deviceIdentifyResponse.model_numberIdentifyResponse.padding_1IdentifyResponse.padding_2IdentifyResponse.removable_mediaIdentifyResponse.reserved_1IdentifyResponse.response_incompleteIdentifyResponse.retired_1IdentifyResponse.retired_2IdentifyResponse.retired_3IdentifyResponse.serial_number
InquiryCommandInquiryResponseInquiryResponse.additional_lengthInquiryResponse.cmd_queInquiryResponse.enc_servInquiryResponse.hi_supInquiryResponse.hot_pluggableInquiryResponse.lu_congInquiryResponse.multi_pInquiryResponse.norm_acaInquiryResponse.obsolete_1InquiryResponse.obsolete_2InquiryResponse.obsolete_3InquiryResponse.obsolete_4InquiryResponse.obsolete_5InquiryResponse.obsolete_6InquiryResponse.obsolete_7InquiryResponse.obsolete_8InquiryResponse.peripheral_device_typeInquiryResponse.peripheral_qualifierInquiryResponse.product_identificationInquiryResponse.product_revision_levelInquiryResponse.protectInquiryResponse.reserved_1InquiryResponse.reserved_10InquiryResponse.reserved_11InquiryResponse.reserved_2InquiryResponse.reserved_3InquiryResponse.reserved_4InquiryResponse.reserved_5InquiryResponse.reserved_6InquiryResponse.reserved_7InquiryResponse.reserved_8InquiryResponse.reserved_9InquiryResponse.response_data_formatInquiryResponse.rmbInquiryResponse.sccsInquiryResponse.t10_vendor_identificationInquiryResponse.three_pcInquiryResponse.tpgsInquiryResponse.vendor_specific_1InquiryResponse.versionInquiryResponse.version_descriptorsInquiryResponse.vs_1InquiryResponse.vs_2
OperationCodeSCSIPassThroughDirectSCSIPassThroughDirect.cdbSCSIPassThroughDirect.cdb_lengthSCSIPassThroughDirect.data_bufferSCSIPassThroughDirect.data_inSCSIPassThroughDirect.data_transfer_lengthSCSIPassThroughDirect.lengthSCSIPassThroughDirect.lunSCSIPassThroughDirect.path_idSCSIPassThroughDirect.scsi_statusSCSIPassThroughDirect.sense_info_lengthSCSIPassThroughDirect.sense_info_offsetSCSIPassThroughDirect.target_idSCSIPassThroughDirect.timeout_value
SCSIPassThroughDirectWithBufferSGIOHeaderSGIOHeader.cmd_lenSGIOHeader.cmdpSGIOHeader.driver_statusSGIOHeader.durationSGIOHeader.dxfer_directionSGIOHeader.dxfer_lenSGIOHeader.dxferpSGIOHeader.flagsSGIOHeader.host_statusSGIOHeader.infoSGIOHeader.interface_idSGIOHeader.iovec_countSGIOHeader.masked_statusSGIOHeader.msg_statusSGIOHeader.mx_sb_lenSGIOHeader.pack_idSGIOHeader.residSGIOHeader.sb_len_wrSGIOHeader.sbpSGIOHeader.statusSGIOHeader.timeoutSGIOHeader.usr_ptr
SenseErrorCodeSmartDataEntrySmartDataResponseSmartDataResponse.attributesSmartDataResponse.conveyance_self_test_recommended_timeSmartDataResponse.data_checksum_structureSmartDataResponse.error_logging_capabilitySmartDataResponse.extended_self_test_recommended_timeSmartDataResponse.extended_self_test_recommended_time_wideSmartDataResponse.offline_data_collection_capabilitySmartDataResponse.offline_data_collection_statusSmartDataResponse.reserved_1SmartDataResponse.self_test_execution_status_buyteSmartDataResponse.short_self_test_recommended_timeSmartDataResponse.smart_capabilitySmartDataResponse.vendor_specific_2SmartDataResponse.vendor_specific_3SmartDataResponse.vendor_specific_4SmartDataResponse.version
SmartThresholdEntrySmartThresholdResponseStatusCode
- smartie.scsi.windows module