当前位置: 首页>>代码示例>>Python>>正文


Python SCSI.read16方法代码示例

本文整理汇总了Python中pyscsi.pyscsi.scsi.SCSI.read16方法的典型用法代码示例。如果您正苦于以下问题:Python SCSI.read16方法的具体用法?Python SCSI.read16怎么用?Python SCSI.read16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyscsi.pyscsi.scsi.SCSI的用法示例。


在下文中一共展示了SCSI.read16方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from pyscsi.pyscsi.scsi import SCSI [as 别名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import read16 [as 别名]
def main():
    dev = MockRead16()
    dev.opcodes = sbc
    s = SCSI(dev)
    s.blocksize = 512

    r = s.read16(1024, 27)
    cdb = r.cdb
    assert cdb[0] == s.device.opcodes.READ_16.value
    assert cdb[1] == 0
    assert scsi_ba_to_int(cdb[2:10]) == 1024
    assert scsi_ba_to_int(cdb[10:14]) == 27
    assert cdb[14] == 0
    assert cdb[15] == 0
    cdb = r.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.READ_16.value
    assert cdb['rdprotect'] == 0
    assert cdb['dpo'] == 0
    assert cdb['fua'] == 0
    assert cdb['rarc'] == 0
    assert cdb['lba'] == 1024
    assert cdb['group'] == 0
    assert cdb['tl'] == 27

    d = Read16.unmarshall_cdb(Read16.marshall_cdb(cdb))
    assert d == cdb

    r = s.read16(1024, 27, rdprotect=2, dpo=1, fua=1, rarc=1, group=19)
    cdb = r.cdb
    assert cdb[0] == s.device.opcodes.READ_16.value
    assert cdb[1] == 0x5c
    assert scsi_ba_to_int(cdb[2:10]) == 1024
    assert scsi_ba_to_int(cdb[10:14]) == 27
    assert cdb[14] == 0x13
    assert cdb[15] == 0
    cdb = r.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.READ_16.value
    assert cdb['rdprotect'] == 2
    assert cdb['dpo'] == 1
    assert cdb['fua'] == 1
    assert cdb['rarc'] == 1
    assert cdb['lba'] == 1024
    assert cdb['group'] == 19
    assert cdb['tl'] == 27

    d = Read16.unmarshall_cdb(Read16.marshall_cdb(cdb))
    assert d == cdb
开发者ID:Katana-Steel,项目名称:python-scsi,代码行数:49,代码来源:test_cdb_read16.py

示例2: main

# 需要导入模块: from pyscsi.pyscsi.scsi import SCSI [as 别名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import read16 [as 别名]
def main(device):
    try:
        sd = SCSIDevice(device)
        s = SCSI(sd, 512)
        r = s.read16(1, 1,).datain
        print 'Read16 - GPT Header'
        print '==========================================\n'
        print('signature: %s' % r[:8])
        print('revision: %.1f' % float(ba_to_int(r[8:12])))
        print('header size: %s byte' % ba_to_int(r[12:16]))
        print('crc32 of header: %s' % ba_to_hex(r[16:20]))
        print('reserved: %s' % ba_to_int(r[20:24]))
        print('current LBA: %s' % ba_to_int(r[24:32]))
        print('backup LBA: %s' % ba_to_int(r[32:40]))
        print('first usable LBA for partitions: %s' % ba_to_int(r[40:48]))
        print('last usable LBA: %s' % ba_to_int(r[48:56]))
        print('Disk GUID: %s' % ba_to_hex(r[56:72]))
        print('Starting LBA of array of partition entries: %s' % ba_to_int(r[72:80]))
        print('number of partition entries in array: %s' % ba_to_int(r[80:84]))
        print('size of a single partition entry: %s' % ba_to_int(r[84:88]))
        print('crc32 of header: %s' % ba_to_hex(r[88:92]))
    except Exception as e:
        print (e.message)
开发者ID:Katana-Steel,项目名称:python-scsi,代码行数:25,代码来源:read16.py


注:本文中的pyscsi.pyscsi.scsi.SCSI.read16方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。