コード例 #1
0
ファイル: mptable.py プロジェクト: Tourountzis/bits
 def __init__(self, u):
     super(IOInterrupt, self).__init__(u)
     u = self.u
     self.add_field('interrupt_type', u.unpack_one("B"), unpack.format_table("{}", _int_types))
     self.add_field('io_interrupt_flags', u.unpack_one("B"))
     self.add_field('polarity', bitfields.getbits(self.io_interrupt_flags, 1, 0), unpack.format_table("io_interrupt_flags[1:0]={}", _polarity))
     self.add_field('trigger', bitfields.getbits(self.io_interrupt_flags, 3, 2), unpack.format_table("io_interrupt_flags[3:2]={}", _trigger_modes))
     u.skip(1)
     self.add_field('source_bus_id', u.unpack_one("B"))
     self.add_field('source_bus_irq', u.unpack_one("B"))
     self.add_field('destination_io_apic_id', u.unpack_one("B"))
     self.add_field('destination_io_apic_int_pin', u.unpack_one("B"))
     self.fini()
コード例 #2
0
ファイル: smbios.py プロジェクト: kirkboy/bits
 def __init__(self, u, sm):
     super(SystemInformation, self).__init__(u, sm)
     u = self.u
     try:
         self.add_field('manufacturer', u.unpack_one("B"), self.fmtstr)
         self.add_field('product_name', u.unpack_one("B"), self.fmtstr)
         self.add_field('version', u.unpack_one("B"), self.fmtstr)
         self.add_field('serial_number', u.unpack_one("B"), self.fmtstr)
         if self.length > 0x8:
             self.add_field('uuid', uuid.UUID(bytes_le=u.unpack_one("16s")))
             wakeup_types = {
                 0: 'Reserved',
                 1: 'Other',
                 2: 'Unknown',
                 3: 'APM Timer',
                 4: 'Modem Ring',
                 5: 'LAN Remote',
                 6: 'Power Switch',
                 7: 'PCI PME#',
                 8: 'AC Power Restored'
             }
             self.add_field('wakeup_type', u.unpack_one("B"), unpack.format_table("{}", wakeup_types))
         if self.length > 0x19:
             self.add_field('sku_number', u.unpack_one("B"), self.fmtstr)
             self.add_field('family', u.unpack_one("B"), self.fmtstr)
     except:
         self.decode_failure = True
         print "Error parsing SystemInformation"
         import traceback
         traceback.print_exc()
     self.fini()
コード例 #3
0
ファイル: mptable.py プロジェクト: sykeben/BITS-PyOS
 def __init__(self, u):
     super(IOInterrupt, self).__init__(u)
     u = self.u
     self.add_field('interrupt_type', u.unpack_one("B"),
                    unpack.format_table("{}", _int_types))
     self.add_field('io_interrupt_flags', u.unpack_one("B"))
     self.add_field(
         'polarity', bitfields.getbits(self.io_interrupt_flags, 1, 0),
         unpack.format_table("io_interrupt_flags[1:0]={}", _polarity))
     self.add_field(
         'trigger', bitfields.getbits(self.io_interrupt_flags, 3, 2),
         unpack.format_table("io_interrupt_flags[3:2]={}", _trigger_modes))
     u.skip(1)
     self.add_field('source_bus_id', u.unpack_one("B"))
     self.add_field('source_bus_irq', u.unpack_one("B"))
     self.add_field('destination_io_apic_id', u.unpack_one("B"))
     self.add_field('destination_io_apic_int_pin', u.unpack_one("B"))
     self.fini()
コード例 #4
0
ファイル: mptable.py プロジェクト: kirkboy/bits
 def __init__(self, u):
     super(SystemAddressSpaceMapping, self).__init__(u)
     u = self.u
     _address_types = {0: "I/O address", 1: " Memory address", 2: "Prefetch address"}
     self.add_field("bus_id", u.unpack_one("B"))
     self.add_field("address_type", u.unpack_one("B"), unpack.format_table("{}", _address_types))
     self.add_field("address_base", u.unpack_one("<Q"))
     self.add_field("address_length", u.unpack_one("<Q"))
     self.fini()
コード例 #5
0
ファイル: mptable.py プロジェクト: kirkboy/bits
 def __init__(self, u):
     super(LocalInterrupt, self).__init__(u)
     u = self.u
     self.add_field("interrupt_type", u.unpack_one("B"), unpack.format_table("{}", _int_types))
     self.add_field("local_interrupt_flags", u.unpack_one("B"))
     self.add_field(
         "polarity",
         bitfields.getbits(self.local_interrupt_flags, 1, 0),
         unpack.format_table("local_interrupt_flags[1:0]={}", _polarity),
     )
     self.add_field(
         "trigger",
         bitfields.getbits(self.local_interrupt_flags, 3, 2),
         unpack.format_table("local_interrupt_flags[3:2]={}", _trigger_modes),
     )
     u.skip(1)
     self.add_field("source_bus_id", u.unpack_one("B"))
     self.add_field("source_bus_irq", u.unpack_one("B"))
     self.add_field("destination_local_apic_id", u.unpack_one("B"))
     self.add_field("destination_local_apic_lint_pin", u.unpack_one("B"))
     self.fini()
コード例 #6
0
ファイル: smbios.py プロジェクト: kirkboy/bits
 def __init__(self, u, length):
     super(SystemEnclosureContainedElement, self).__init__()
     self.start_offset = u.offset
     self.raw_data = u.unpack_raw(length)
     self.u = unpack.Unpackable(self.raw_data)
     u = self.u
     self.add_field('contained_element_type', u.unpack_one("B"))
     type_selections = {
         0: 'SMBIOS baseboard type enumeration',
         1: 'SMBIOS structure type enumeration',
     }
     self.add_field('type_select', bitfields.getbits(self.type, 7), unpack.format_table("contained_element_type[7]={}", type_selections))
     self.add_field('type', bitfields.getbits(self.type, 6, 0))
     if self.type_select == 0:
         self.add_field('smbios_board_type', self.type, unpack.format_table("{}", _board_types))
     else:
         self.add_field('smbios_structure_type', self.type)
     self.add_field('minimum', u.unpack_one("B"))
     self.add_field('maximum', u.unpack_one("B"))
     if not u.at_end():
         self.add_field('data', u.unpack_rest())
     del self.u
コード例 #7
0
ファイル: mptable.py プロジェクト: sykeben/BITS-PyOS
 def __init__(self, u):
     super(SystemAddressSpaceMapping, self).__init__(u)
     u = self.u
     _address_types = {
         0: "I/O address",
         1: " Memory address",
         2: "Prefetch address",
     }
     self.add_field('bus_id', u.unpack_one("B"))
     self.add_field('address_type', u.unpack_one("B"),
                    unpack.format_table("{}", _address_types))
     self.add_field('address_base', u.unpack_one("<Q"))
     self.add_field('address_length', u.unpack_one("<Q"))
     self.fini()
コード例 #8
0
ファイル: smbios.py プロジェクト: kirkboy/bits
    def __init__(self, u, sm):
        super(BaseboardInformation, self).__init__(u, sm)
        u = self.u
        try:
            self.add_field('manufacturer', u.unpack_one("B"), self.fmtstr)
            self.add_field('product', u.unpack_one("B"), self.fmtstr)
            self.add_field('version', u.unpack_one("B"), self.fmtstr)
            self.add_field('serial_number', u.unpack_one("B"), self.fmtstr)

            if self.length > 0x8:
                self.add_field('asset_tag', u.unpack_one("B"), self.fmtstr)

            if self.length > 0x9:
                self.add_field('feature_flags', u.unpack_one("B"))
                self.add_field('hosting_board', bool(bitfields.getbits(self.feature_flags, 0)), "feature_flags[0]={}")
                self.add_field('requires_daughter_card', bool(bitfields.getbits(self.feature_flags, 1)), "feature_flags[1]={}")
                self.add_field('removable', bool(bitfields.getbits(self.feature_flags, 2)), "feature_flags[2]={}")
                self.add_field('replaceable', bool(bitfields.getbits(self.feature_flags, 3)), "feature_flags[3]={}")
                self.add_field('hot_swappable', bool(bitfields.getbits(self.feature_flags, 4)), "feature_flags[4]={}")

            if self.length > 0xA:
                self.add_field('location', u.unpack_one("B"), self.fmtstr)

            if self.length > 0xB:
                self.add_field('chassis_handle', u.unpack_one("<H"))

            if self.length > 0xD:
                self.add_field('board_type', u.unpack_one("B"), unpack.format_table("{}", _board_types))

            if self.length > 0xE:
                self.add_field('handle_count', u.unpack_one("B"))
                if self.handle_count > 0:
                    self.add_field('contained_object_handles', tuple(u.unpack_one("<H") for i in range(self.handle_count)))
        except:
            self.decode_failure = True
            print "Error parsing BaseboardInformation"
            import traceback
            traceback.print_exc()
        self.fini()
コード例 #9
0
ファイル: smbios.py プロジェクト: kirkboy/bits
 def __init__(self, u, sm):
     super(SystemSlots, self).__init__(u, sm)
     u = self.u
     try:
         self.add_field('designation', u.unpack_one("B"), self.fmtstr)
         _slot_types = {
             0x01: 'Other',
             0x02: 'Unknown',
             0x03: 'ISA',
             0x04: 'MCA',
             0x05: 'EISA',
             0x06: 'PCI',
             0x07: 'PC Card (PCMCIA)',
             0x08: 'VL-VESA',
             0x09: 'Proprietary',
             0x0A: 'Processor Card Slot',
             0x0B: 'Proprietary Memory Card Slot',
             0x0C: 'I/O Riser Card Slot',
             0x0D: 'NuBus',
             0x0E: 'PCI 66MHz Capable',
             0x0F: 'AGP',
             0x10: 'AGP 2X',
             0x11: 'AGP 4X',
             0x12: 'PCI-X',
             0x13: 'AGP 8X',
             0xA0: 'PC-98/C20',
             0xA1: 'PC-98/C24',
             0xA2: 'PC-98/E',
             0xA3: 'PC-98/Local Bus',
             0xA4: 'PC-98/Card',
             0xA5: 'PCI Express',
             0xA6: 'PCI Express x1',
             0xA7: 'PCI Express x2',
             0xA8: 'PCI Express x4',
             0xA9: 'PCI Express x8',
             0xAA: 'PCI Express x16',
             0xAB: 'PCI Express Gen 2',
             0xAC: 'PCI Express Gen 2 x1',
             0xAD: 'PCI Express Gen 2 x2',
             0xAE: 'PCI Express Gen 2 x4',
             0xAF: 'PCI Express Gen 2 x8',
             0xB0: 'PCI Express Gen 2 x16',
             0xB1: 'PCI Express Gen 3',
             0xB2: 'PCI Express Gen 3 x1',
             0xB3: 'PCI Express Gen 3 x2',
             0xB4: 'PCI Express Gen 3 x4',
             0xB5: 'PCI Express Gen 3 x8',
             0xB6: 'PCI Express Gen 3 x16',
         }
         self.add_field('slot_type', u.unpack_one("B"), unpack.format_table("{}", _slot_types))
         _slot_data_bus_widths = {
             0x01: 'Other',
             0x02: 'Unknown',
             0x03: '8 bit',
             0x04: '16 bit',
             0x05: '32 bit',
             0x06: '64 bit',
             0x07: '128 bit',
             0x08: '1x or x1',
             0x09: '2x or x2',
             0x0A: '4x or x4',
             0x0B: '8x or x8',
             0x0C: '12x or x12',
             0x0D: '16x or x16',
             0x0E: '32x or x32',
         }
         self.add_field('slot_data_bus_width', u.unpack_one('B'), unpack.format_table("{}", _slot_data_bus_widths))
         _current_usages = {
             0x01: 'Other',
             0x02: 'Unknown',
             0x03: 'Available',
             0x04: 'In use',
         }
         self.add_field('current_usage', u.unpack_one('B'), unpack.format_table("{}", _current_usages))
         _slot_lengths = {
             0x01: 'Other',
             0x02: 'Unknown',
             0x03: 'Short Length',
             0x04: 'Long Length',
         }
         self.add_field('slot_length', u.unpack_one('B'), unpack.format_table("{}", _slot_lengths))
         self.add_field('slot_id', u.unpack_one('<H'))
         self.add_field('characteristics1', u.unpack_one('B'))
         self.add_field('characteristics_unknown', bool(bitfields.getbits(self.characteristics1, 0)), "characteristics1[0]={}")
         self.add_field('provides_5_0_volts', bool(bitfields.getbits(self.characteristics1, 1)), "characteristics1[1]={}")
         self.add_field('provides_3_3_volts', bool(bitfields.getbits(self.characteristics1, 2)), "characteristics1[2]={}")
         self.add_field('shared_slot', bool(bitfields.getbits(self.characteristics1, 3)), "characteristics1[3]={}")
         self.add_field('supports_pc_card_16', bool(bitfields.getbits(self.characteristics1, 4)), "characteristics1[4]={}")
         self.add_field('supports_cardbus', bool(bitfields.getbits(self.characteristics1, 5)), "characteristics1[5]={}")
         self.add_field('supports_zoom_video', bool(bitfields.getbits(self.characteristics1, 6)), "characteristics1[6]={}")
         self.add_field('supports_modem_ring_resume', bool(bitfields.getbits(self.characteristics1, 7)), "characteristics1[7]={}")
         if self.length > 0x0C:
             self.add_field('characteristics2', u.unpack_one('B'))
             self.add_field('supports_PME', bool(bitfields.getbits(self.characteristics2, 0)), "characteristics2[0]={}")
             self.add_field('supports_hot_plug', bool(bitfields.getbits(self.characteristics2, 1)), "characteristics2[1]={}")
             self.add_field('supports_smbus', bool(bitfields.getbits(self.characteristics2, 2)), "characteristics2[2]={}")
         if self.length > 0x0D:
             self.add_field('segment_group_number', u.unpack_one('<H'))
             self.add_field('bus_number', u.unpack_one('B'))
             self.add_field('device_function_number', u.unpack_one('B'))
             self.add_field('device_number', bitfields.getbits(self.device_function_number, 7, 3), "device_function_number[7:3]={}")
             self.add_field('function_number', bitfields.getbits(self.device_function_number, 2, 0), "device_function_number[2:0]={}")
     except:
         self.decodeFailure = True
         print "Error parsing SystemSlots"
         import traceback
         traceback.print_exc()
     self.fini()
コード例 #10
0
ファイル: smbios.py プロジェクト: kirkboy/bits
 def __init__(self, u, sm):
     super(PortConnectorInfo, self).__init__(u, sm)
     u = self.u
     try:
         self.add_field('internal_reference_designator', u.unpack_one("B"), self.fmtstr)
         connector_types = {
             0x00: 'None',
             0x01: 'Centronics',
             0x02: 'Mini Centronics',
             0x03: 'Proprietary',
             0x04: 'DB-25 pin male',
             0x05: 'DB-25 pin female',
             0x06: 'DB-15 pin male',
             0x07: 'DB-15 pin female',
             0x08: 'DB-9 pin male',
             0x09: 'DB-9 pin female',
             0x0A: 'RJ-11',
             0x0B: 'RJ-45',
             0x0C: '50-pin MiniSCSI',
             0x0D: 'Mini-DIN',
             0x0E: 'Micro-DIN',
             0x0F: 'PS/2',
             0x10: 'Infrared',
             0x11: 'HP-HIL',
             0x12: 'Access Bus (USB)',
             0x13: 'SSA SCSI',
             0x14: 'Circular DIN-8 male',
             0x15: 'Circular DIN-8 female',
             0x16: 'On Board IDE',
             0x17: 'On Board Floppy',
             0x18: '9-pin Dual Inline (pin 10 cut)',
             0x19: '25-pin Dual Inline (pin 26 cut)',
             0x1A: '50-pin Dual Inline',
             0x1B: '68-pin Dual Inline',
             0x1C: 'On Board Sound Input from CD-ROM',
             0x1D: 'Mini-Centronics Type-14',
             0x1E: 'Mini-Centronics Type-26',
             0x1F: 'Mini-jack (headphones)',
             0x20: 'BNC',
             0x21: '1394',
             0x22: 'SAS/SATA Plug Receptacle',
             0xA0: 'PC-98',
             0xA1: 'PC-98Hireso',
             0xA2: 'PC-H98',
             0xA3: 'PC-98Note',
             0xA4: 'PC-98Full',
             0xFF: 'Other',
         }
         self.add_field('internal_connector_type', u.unpack_one("B"), unpack.format_table("{}", connector_types))
         self.add_field('external_reference_designator', u.unpack_one("B"), self.fmtstr)
         self.add_field('external_connector_type', u.unpack_one("B"), unpack.format_table("{}", connector_types))
         port_types = {
             0x00: 'None',
             0x01: 'Parallel Port XT/AT Compatible',
             0x02: 'Parallel Port PS/2',
             0x03: 'Parallel Port ECP',
             0x04: 'Parallel Port EPP',
             0x05: 'Parallel Port ECP/EPP',
             0x06: 'Serial Port XT/AT Compatible',
             0x07: 'Serial Port 16450 Compatible',
             0x08: 'Serial Port 16550 Compatible',
             0x09: 'Serial Port 16550A Compatible',
             0x0A: 'SCSI Port',
             0x0B: 'MIDI Port',
             0x0C: 'Joy Stick Port',
             0x0D: 'Keyboard Port',
             0x0E: 'Mouse Port',
             0x0F: 'SSA SCSI',
             0x10: 'USB',
             0x11: 'FireWire (IEEE P1394)',
             0x12: 'PCMCIA Type I2',
             0x13: 'PCMCIA Type II',
             0x14: 'PCMCIA Type III',
             0x15: 'Cardbus',
             0x16: 'Access Bus Port',
             0x17: 'SCSI II',
             0x18: 'SCSI Wide',
             0x19: 'PC-98',
             0x1A: 'PC-98-Hireso',
             0x1B: 'PC-H98',
             0x1C: 'Video Port',
             0x1D: 'Audio Port',
             0x1E: 'Modem Port',
             0x1F: 'Network Port',
             0x20: 'SATA',
             0x21: 'SAS',
             0xA0: '8251 Compatible',
             0xA1: '8251 FIFO Compatible',
             0xFF: 'Other',
         }
         self.add_field('port_type', u.unpack_one("B"), unpack.format_table("{}", port_types))
     except:
         self.decodeFailure = True
         print "Error parsing PortConnectorInfo"
         import traceback
         traceback.print_exc()
     self.fini()
コード例 #11
0
ファイル: smbios.py プロジェクト: kirkboy/bits
 def __init__(self, u, sm):
     super(ProcessorInformation, self).__init__(u, sm)
     u = self.u
     try:
         self.add_field('socket_designation', u.unpack_one("B"), self.fmtstr)
         processor_types = {
             0x01: 'Other',
             0x02: 'Unknown',
             0x03: 'Central Processor',
             0x04: 'Math Processor',
             0x05: 'DSP Processor',
             0x06: 'Video Processor',
         }
         self.add_field('processor_type', u.unpack_one("B"), unpack.format_table("{}", processor_types))
         self.add_field('processor_family', u.unpack_one("B"))
         self.add_field('processor_manufacturer', u.unpack_one("B"), self.fmtstr)
         self.add_field('processor_id', u.unpack_one("<Q"))
         self.add_field('processor_version', u.unpack_one("B"), self.fmtstr)
         self.add_field('voltage', u.unpack_one("B"))
         self.add_field('external_clock', u.unpack_one("<H"))
         self.add_field('max_speed', u.unpack_one("<H"))
         self.add_field('current_speed', u.unpack_one("<H"))
         self.add_field('status', u.unpack_one("B"))
         processor_upgrades = {
             0x01: 'Other',
             0x02: 'Unknown',
             0x03: 'Daughter Board',
             0x04: 'ZIF Socket',
             0x05: 'Replaceable Piggy Back',
             0x06: 'None',
             0x07: 'LIF Socket',
             0x08: 'Slot 1',
             0x09: 'Slot 2',
             0x0A: '370-pin socket',
             0x0B: 'Slot A',
             0x0C: 'Slot M',
             0x0D: 'Socket 423',
             0x0E: 'Socket A (Socket 462)',
             0x0F: 'Socket 478',
             0x10: 'Socket 754',
             0x11: 'Socket 940',
             0x12: 'Socket 939',
             0x13: 'Socket mPGA604',
             0x14: 'Socket LGA771',
             0x15: 'Socket LGA775',
             0x16: 'Socket S1',
             0x17: 'Socket AM2',
             0x18: 'Socket F (1207)',
             0x19: 'Socket LGA1366',
             0x1A: 'Socket G34',
             0x1B: 'Socket AM3',
             0x1C: 'Socket C32',
             0x1D: 'Socket LGA1156',
             0x1E: 'Socket LGA1567',
             0x1F: 'Socket PGA988A',
             0x20: 'Socket BGA1288',
             0x21: 'Socket rPGA988B',
             0x22: 'Socket BGA1023',
             0x23: 'Socket BGA1224',
             0x24: 'Socket BGA1155',
             0x25: 'Socket LGA1356',
             0x26: 'Socket LGA2011',
             0x27: 'Socket FS1',
             0x28: 'Socket FS2',
             0x29: 'Socket FM1',
             0x2A: 'Socket FM2',
         }
         self.add_field('processor_upgrade', u.unpack_one("B"), unpack.format_table("{}", processor_upgrades))
         if self.length > 0x1A:
             self.add_field('l1_cache_handle', u.unpack_one("<H"))
             self.add_field('l2_cache_handle', u.unpack_one("<H"))
             self.add_field('l3_cache_handle', u.unpack_one("<H"))
         if self.length > 0x20:
             self.add_field('serial_number', u.unpack_one("B"), self.fmtstr)
             self.add_field('asset_tag', u.unpack_one("B"), self.fmtstr)
             self.add_field('part_number', u.unpack_one("B"), self.fmtstr)
         if self.length > 0x24:
             self.add_field('core_count', u.unpack_one("B"))
             self.add_field('core_enabled', u.unpack_one("B"))
             self.add_field('thread_count', u.unpack_one("B"))
             self.add_field('processor_characteristics', u.unpack_one("<H"))
         if self.length > 0x28:
             self.add_field('processor_family_2', u.unpack_one("<H"))
     except:
         self.decode_failure = True
         print "Error parsing Processor Information"
         import traceback
         traceback.print_exc()
     self.fini()
コード例 #12
0
ファイル: smbios.py プロジェクト: kirkboy/bits
 def __init__(self, u, sm):
     super(SystemEnclosure, self).__init__(u, sm)
     u = self.u
     try:
         self.add_field('manufacturer', u.unpack_one("B"), self.fmtstr)
         self.add_field('enumerated_type', u.unpack_one("B"))
         self.add_field('chassis_lock_present', bool(bitfields.getbits(self.enumerated_type, 7)), "type[7]={}")
         board_types = {
             0x01: 'Other',
             0x02: 'Unknown',
             0x03: 'Desktop',
             0x04: 'Low Profile Desktop',
             0x05: 'Pizza Box',
             0x06: 'Mini Tower',
             0x07: 'Tower',
             0x08: 'Portable',
             0x09: 'Laptop',
             0x0A: 'Notebook',
             0x0B: 'Hand Held',
             0x0C: 'Docking Station',
             0x0D: 'All in One',
             0x0E: 'Sub Notebook',
             0x0F: 'Space-saving',
             0x10: 'Lunch Box',
             0x11: 'Main Server Chassis',
             0x12: 'Expansion Chassis',
             0x13: 'SubChassis',
             0x14: 'Bus Expansion Chassis',
             0x15: 'Peripheral Chassis',
             0x16: 'RAID Chassis',
             0x17: 'Rack Mount Chassis',
             0x18: 'Sealed-case PC',
             0x19: 'Multi-system chassis W',
             0x1A: 'Compact PCI',
             0x1B: 'Advanced TCA',
             0x1C: 'Blade',
             0x1D: 'Blade Enclosure',
         }
         self.add_field('system_enclosure_type', bitfields.getbits(self.enumerated_type, 6, 0), unpack.format_table("enumerated_type[6:0]={}", board_types))
         self.add_field('version', u.unpack_one("B"), self.fmtstr)
         self.add_field('serial_number', u.unpack_one("B"), self.fmtstr)
         self.add_field('asset_tag', u.unpack_one("B"), self.fmtstr)
         minor_version_str = str(sm.header.minor_version) # 34 is .34, 4 is .4, 41 is .41; compare ASCIIbetically to compare initial digits rather than numeric value
         if self.length > 9:
             chassis_states = {
                 0x01: 'Other',
                 0x02: 'Unknown',
                 0x03: 'Safe',
                 0x04: 'Warning',
                 0x05: 'Critical',
                 0x06: 'Non-recoverable',
             }
             self.add_field('bootup_state', u.unpack_one("B"), unpack.format_table("{}", chassis_states))
             self.add_field('power_supply_state', u.unpack_one("B"), unpack.format_table("{}", chassis_states))
             self.add_field('thermal_state', u.unpack_one("B"), unpack.format_table("{}", chassis_states))
             security_states = {
                 0x01: 'Other',
                 0x02: 'Unknown',
                 0x03: 'None',
                 0x04: 'External interface locked out',
                 0x05: 'External interface enabled',
             }
             self.add_field('security_status', u.unpack_one("B"), unpack.format_table("{}", security_states))
         if self.length > 0xd:
             self.add_field('oem_defined', u.unpack_one("<I"))
         if self.length > 0x11:
             self.add_field('height', u.unpack_one("B"))
             self.add_field('num_power_cords', u.unpack_one("B"))
             self.add_field('contained_element_count', u.unpack_one("B"))
             self.add_field('contained_element_length', u.unpack_one("B"))
         if getattr(self, 'contained_element_count', 0):
             self.add_field('contained_elements', tuple(SystemEnclosureContainedElement(u, self.contained_element_length) for i in range(self.contained_element_count)))
         if self.length > (0x15 + (getattr(self, 'contained_element_count', 0) * getattr(self, 'contained_element_length', 0))):
             self.add_field('sku_number', u.unpack_one("B"), self.fmtstr)
     except:
         self.decode_failure = True
         print "Error parsing SystemEnclosure"
         import traceback
         traceback.print_exc()
     self.fini()