本文整理匯總了Python中pyscsi.pyscsi.scsi.SCSI.initializeelementstatuswithrange方法的典型用法代碼示例。如果您正苦於以下問題:Python SCSI.initializeelementstatuswithrange方法的具體用法?Python SCSI.initializeelementstatuswithrange怎麽用?Python SCSI.initializeelementstatuswithrange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyscsi.pyscsi.scsi.SCSI
的用法示例。
在下文中一共展示了SCSI.initializeelementstatuswithrange方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from pyscsi.pyscsi.scsi import SCSI [as 別名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import initializeelementstatuswithrange [as 別名]
def main():
dev = MockInitializeElementStatusWithRange()
dev.opcodes = smc
s = SCSI(dev)
# we need to reassign the right enum again because the MockDevice will return the wrong
# peripheral_device_type and therefor assign the spc enum instead of smc.
s.device.opcodes = smc
r = s.initializeelementstatuswithrange(15, 3, rng=1, fast=1)
cdb = r.cdb
assert cdb[0] == s.device.opcodes.INITIALIZE_ELEMENT_STATUS_WITH_RANGE.value
assert cdb[1] == 0x03
assert scsi_ba_to_int(cdb[2:4]) == 15
assert scsi_ba_to_int(cdb[6:8]) == 3
cdb = r.unmarshall_cdb(cdb)
assert cdb['opcode'] == s.device.opcodes.INITIALIZE_ELEMENT_STATUS_WITH_RANGE.value
assert cdb['starting_element_address'] == 15
assert cdb['number_of_elements'] == 3
assert cdb['fast'] == 1
assert cdb['range'] == 1
d = InitializeElementStatusWithRange.unmarshall_cdb(InitializeElementStatusWithRange.marshall_cdb(cdb))
assert d == cdb