Back to index

apport  2.3
Functions
dump_acpi_tables Namespace Reference

Functions

def dump_acpi_table
def dump_acpi_tables

Function Documentation

def dump_acpi_tables.dump_acpi_table (   filename,
  tablename,
  out 
)
Dump a single ACPI table

Definition at line 6 of file dump_acpi_tables.py.

00006 
00007 def dump_acpi_table(filename, tablename, out):
00008     '''Dump a single ACPI table'''
00009 
00010     out.write('%s @ 0x00000000\n' % tablename)
00011     n = 0
00012     f = open(filename, 'rb')
00013     hex_str = ''
00014     try:
00015         byte = f.read(1)
00016         while byte != b'':
00017             val = ord(byte)
00018             if (n & 15) == 0:
00019                 hex_str = '  %4.4x: ' % n
00020                 ascii_str = ''
00021 
00022             hex_str = hex_str + '%2.2x ' % val
00023 
00024             if (val < 32) or (val > 126):
00025                 ascii_str = ascii_str + '.'
00026             else:
00027                 ascii_str = ascii_str + chr(val)
00028             n = n + 1
00029             if (n & 15) == 0:
00030                 out.write('%s %s\n' % (hex_str, ascii_str))
00031             byte = f.read(1)
00032     finally:
00033         for i in range(n & 15, 16):
00034             hex_str = hex_str + '   '
00035 
00036         if (n & 15) != 15:
00037             out.write('%s %s\n' % (hex_str, ascii_str))
00038         f.close()
00039     out.write('\n')
00040 

Here is the caller graph for this function:

def dump_acpi_tables.dump_acpi_tables (   path,
  out 
)
Dump ACPI tables

Definition at line 41 of file dump_acpi_tables.py.

00041 
00042 def dump_acpi_tables(path, out):
00043     '''Dump ACPI tables'''
00044 
00045     tables = os.listdir(path)
00046     for tablename in tables:
00047         pathname = os.path.join(path, tablename)
00048         mode = os.stat(pathname).st_mode
00049         if stat.S_ISDIR(mode):
00050             dump_acpi_tables(pathname, out)
00051         else:
00052             dump_acpi_table(pathname, tablename, out)

Here is the call graph for this function: