本文整理汇总了Python中pyscsi.pyscsi.scsi.SCSI.write12方法的典型用法代码示例。如果您正苦于以下问题:Python SCSI.write12方法的具体用法?Python SCSI.write12怎么用?Python SCSI.write12使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyscsi.pyscsi.scsi.SCSI
的用法示例。
在下文中一共展示了SCSI.write12方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pyscsi.pyscsi.scsi import SCSI [as 别名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import write12 [as 别名]
def main():
dev = MockWrite12()
dev.opcodes = sbc
s = SCSI(dev)
s.blocksize = 512
data = bytearray(27 * 512)
w = s.write12(1024, 27, data)
cdb = w.cdb
assert cdb[0] == s.device.opcodes.WRITE_12.value
assert cdb[1] == 0
assert scsi_ba_to_int(cdb[2:6]) == 1024
assert scsi_ba_to_int(cdb[6:10]) == 27
assert cdb[10] == 0
assert cdb[11] == 0
cdb = w.unmarshall_cdb(cdb)
assert cdb['opcode'] == s.device.opcodes.WRITE_12.value
assert cdb['wrprotect'] == 0
assert cdb['dpo'] == 0
assert cdb['fua'] == 0
assert cdb['lba'] == 1024
assert cdb['group'] == 0
assert cdb['tl'] == 27
d = Write12.unmarshall_cdb(Write12.marshall_cdb(cdb))
assert d == cdb
w = s.write12(65536, 27, data, wrprotect=2, dpo=1, fua=1, group=19)
cdb = w.cdb
assert cdb[0] == s.device.opcodes.WRITE_12.value
assert cdb[1] == 0x58
assert scsi_ba_to_int(cdb[2:6]) == 65536
assert scsi_ba_to_int(cdb[6:10]) == 27
assert cdb[10] == 0x13
assert cdb[11] == 0
cdb = w.unmarshall_cdb(cdb)
assert cdb['opcode'] == s.device.opcodes.WRITE_12.value
assert cdb['wrprotect'] == 2
assert cdb['dpo'] == 1
assert cdb['fua'] == 1
assert cdb['lba'] == 65536
assert cdb['group'] == 19
assert cdb['tl'] == 27
d = Write12.unmarshall_cdb(Write12.marshall_cdb(cdb))
assert d == cdb