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


Python SCSI.modesense10方法代码示例

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


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

示例1: main

# 需要导入模块: from pyscsi.pyscsi.scsi import SCSI [as 别名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import modesense10 [as 别名]
def main():
    dev = MockModeSense10()
    dev.opcodes = smc
    s = SCSI(dev)

    # cdb for SMC: ElementAddressAssignment
    m = s.modesense10(page_code=MODESENSE10.PAGE_CODE.ELEMENT_ADDRESS_ASSIGNMENT)
    cdb = m.cdb
    assert cdb[0] == s.device.opcodes.MODE_SENSE_10.value
    assert cdb[1] == 0
    assert cdb[2] == MODESENSE10.PAGE_CODE.ELEMENT_ADDRESS_ASSIGNMENT
    assert cdb[3] == 0
    assert cdb[4:6] == bytearray(2)
    assert scsi_ba_to_int(cdb[7:9]) == 96
    assert cdb[9] == 0
    cdb = m.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.MODE_SENSE_10.value
    assert cdb['dbd'] == 0
    assert cdb['llbaa'] == 0
    assert cdb['page_code'] == MODESENSE10.PAGE_CODE.ELEMENT_ADDRESS_ASSIGNMENT
    assert cdb['pc'] == 0
    assert cdb['sub_page_code'] == 0
    assert cdb['alloc_len'] == 96

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

    m = s.modesense10(page_code=0, sub_page_code=3, llbaa=1, dbd=1, pc=MODESENSE10.PC.DEFAULT, alloclen=90)
    cdb = m.cdb
    assert cdb[0] == s.device.opcodes.MODE_SENSE_10.value
    assert cdb[1] == 0x18
    assert cdb[2] == MODESENSE10.PC.DEFAULT << 6
    assert cdb[3] == 3
    assert scsi_ba_to_int(cdb[7:9]) == 90
    cdb = m.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.MODE_SENSE_10.value
    assert cdb['dbd'] == 1
    assert cdb['pc'] == MODESENSE10.PC.DEFAULT
    assert cdb['page_code'] == 0
    assert cdb['sub_page_code'] == 3
    assert cdb['alloc_len'] == 90
    assert cdb['llbaa'] == 1

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

示例2: main

# 需要导入模块: from pyscsi.pyscsi.scsi import SCSI [as 别名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import modesense10 [as 别名]
def main():
    # SMC ElementAddressAssignment
    dev = MockModeSenseEAA()
    dev.opcodes = smc
    s = SCSI(dev)
    i = s.modesense10(page_code=MODESENSE10.PAGE_CODE.ELEMENT_ADDRESS_ASSIGNMENT).result
    assert i["medium_type"] == 97
    assert i["device_specific_parameter"] == 98

    assert len(i["mode_pages"]) == 1

    assert i["mode_pages"][0]["ps"] == 1
    assert i["mode_pages"][0]["spf"] == 0
    assert i["mode_pages"][0]["page_code"] == MODESENSE10.PAGE_CODE.ELEMENT_ADDRESS_ASSIGNMENT
    assert i["mode_pages"][0]["first_medium_transport_element_address"] == 257
    assert i["mode_pages"][0]["num_medium_transport_elements"] == 258
    assert i["mode_pages"][0]["first_storage_element_address"] == 259
    assert i["mode_pages"][0]["num_storage_elements"] == 260
    assert i["mode_pages"][0]["first_import_element_address"] == 261
    assert i["mode_pages"][0]["num_import_elements"] == 262
    assert i["mode_pages"][0]["first_data_transfer_element_address"] == 263
    assert i["mode_pages"][0]["num_data_transfer_elements"] == 264

    d = ModeSense10.unmarshall_datain(ModeSense10.marshall_datain(i))
    assert d == i

    # SPC Control
    dev = MockModeSenseControl()
    dev.opcodes = smc
    s = SCSI(dev)
    i = s.modesense10(page_code=MODESENSE10.PAGE_CODE.CONTROL).result
    assert i["medium_type"] == 0
    assert i["device_specific_parameter"] == 0x90

    assert len(i["mode_pages"]) == 1

    assert i["mode_pages"][0]["ps"] == 1
    assert i["mode_pages"][0]["spf"] == 0
    assert i["mode_pages"][0]["page_code"] == MODESENSE10.PAGE_CODE.CONTROL
    assert i["mode_pages"][0]["tst"] == 4
    assert i["mode_pages"][0]["tmf_only"] == 1
    assert i["mode_pages"][0]["dpicz"] == 1
    assert i["mode_pages"][0]["d_sense"] == 1
    assert i["mode_pages"][0]["gltsd"] == 1
    assert i["mode_pages"][0]["rlec"] == 1
    assert i["mode_pages"][0]["queue_algorithm_modifier"] == 9
    assert i["mode_pages"][0]["nuar"] == 1
    assert i["mode_pages"][0]["qerr"] == 3
    assert i["mode_pages"][0]["vs"] == 1
    assert i["mode_pages"][0]["rac"] == 1
    assert i["mode_pages"][0]["ua_intlck_ctrl"] == 3
    assert i["mode_pages"][0]["swp"] == 1
    assert i["mode_pages"][0]["ato"] == 1
    assert i["mode_pages"][0]["tas"] == 1
    assert i["mode_pages"][0]["atmpe"] == 1
    assert i["mode_pages"][0]["rwwp"] == 1
    assert i["mode_pages"][0]["autoload_mode"] == 7
    assert i["mode_pages"][0]["busy_timeout_period"] == 500
    assert i["mode_pages"][0]["extended_self_test_completion_time"] == 700

    d = ModeSense10.unmarshall_datain(ModeSense10.marshall_datain(i))
    assert d == i

    # SPC Control Ext 1
    dev = MockModeSenseControlExt1()
    dev.opcodes = smc
    s = SCSI(dev)
    i = s.modesense10(page_code=MODESENSE10.PAGE_CODE.CONTROL, sub_page_code=1).result
    assert i["medium_type"] == 0
    assert i["device_specific_parameter"] == 0x90

    assert len(i["mode_pages"]) == 1

    assert i["mode_pages"][0]["ps"] == 1
    assert i["mode_pages"][0]["spf"] == 1
    assert i["mode_pages"][0]["page_code"] == MODESENSE10.PAGE_CODE.CONTROL
    assert i["mode_pages"][0]["sub_page_code"] == 1
    assert i["mode_pages"][0]["tcmos"] == 1
    assert i["mode_pages"][0]["scsip"] == 1
    assert i["mode_pages"][0]["ialuae"] == 1
    assert i["mode_pages"][0]["initial_command_priority"] == 15
    assert i["mode_pages"][0]["maximum_sense_data_length"] == 29

    d = ModeSense10.unmarshall_datain(ModeSense10.marshall_datain(i))
    assert d == i

    # SPC Disconnect
    dev = MockModeSenseDisconnect()
    dev.opcodes = smc
    s = SCSI(dev)
    i = s.modesense10(page_code=MODESENSE10.PAGE_CODE.DISCONNECT_RECONNECT).result
    assert i["medium_type"] == 0
    assert i["device_specific_parameter"] == 0x90

    assert len(i["mode_pages"]) == 1

    assert i["mode_pages"][0]["ps"] == 1
    assert i["mode_pages"][0]["spf"] == 0
    assert i["mode_pages"][0]["page_code"] == MODESENSE10.PAGE_CODE.DISCONNECT_RECONNECT
    assert i["mode_pages"][0]["buffer_full_ratio"] == 122
#.........这里部分代码省略.........
开发者ID:rosjat,项目名称:python-scsi,代码行数:103,代码来源:test_unmarshall_modesense10.py


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