コード例 #1
0
 def _get_scsi_standard_inquiry_the_right_way():
     allocation_length = STANDARD_INQUIRY_MINIMAL_DATA_LENGTH
     with self.asi_context() as asi:
         command = StandardInquiryCommand(allocation_length=allocation_length)
         result = sync_wait(command.execute(asi))
         if result.additional_length >= 0:
             allocation_length += result.additional_length
             command = StandardInquiryCommand(allocation_length=allocation_length)
             result = sync_wait(command.execute(asi))
     return result
コード例 #2
0
 def get_scsi_standard_inquiry(self):
     """:returns: the standard inquiry data"""
     from infi.asi.cdb.inquiry.standard import StandardInquiryCommand
     from infi.asi.coroutines.sync_adapter import sync_wait
     with self.asi_context() as asi:
         command = StandardInquiryCommand()
         return sync_wait(command.execute(asi))
コード例 #3
0
def get_scsi_standard_inquiry(access_path):
    from infi.asi.coroutines.sync_adapter import sync_wait
    from infi.asi.cdb.inquiry.standard import StandardInquiryCommand, STANDARD_INQUIRY_MINIMAL_DATA_LENGTH

    with asi_context(access_path) as asi:
        command = StandardInquiryCommand(allocation_length=STANDARD_INQUIRY_MINIMAL_DATA_LENGTH)
        result = sync_wait(command.execute(asi))
        return result
コード例 #4
0
def get_scsi_standard_inquiry(access_path):
    from infi.asi.coroutines.sync_adapter import sync_wait
    from infi.asi.cdb.inquiry.standard import StandardInquiryCommand, STANDARD_INQUIRY_MINIMAL_DATA_LENGTH

    with asi_context(access_path) as asi:
        command = StandardInquiryCommand(
            allocation_length=STANDARD_INQUIRY_MINIMAL_DATA_LENGTH)
        result = sync_wait(command.execute(asi))
        return result
コード例 #5
0
 def _get_scsi_standard_inquiry_the_fastest_way(allocation_length=219):
     try:
         with self.asi_context() as asi:
             command = StandardInquiryCommand(allocation_length=allocation_length)
             return sync_wait(command.execute(asi))
     except AsiCheckConditionError, e:
         (key, code) = (e.sense_obj.sense_key, e.sense_obj.additional_sense_code.code_name)
         if (key, code) == ('ILLEGAL_REQUEST', 'INVALID FIELD IN CDB'):
             return
         raise
コード例 #6
0
import sys
from infi.asi import create_platform_command_executer
from infi.asi.cdb.inquiry.standard import StandardInquiryCommand
from infi.asi.coroutines.sync_adapter import sync_wait
from infi.asi import create_os_file
from infi.exceptools import print_exc

if len(sys.argv) != 2:
    sys.stderr.write("usage: %s device_name\n" % sys.argv[0])
    sys.exit(1)

path = sys.argv[1]

f = create_os_file(path)

try:
    executer = create_platform_command_executer(f)

    inquiry = StandardInquiryCommand()
    data = sync_wait(inquiry.execute(executer))

    print(data)

    f.close()
except:
    print_exc()