當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。