Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / apport / | server ip : 104.21.89.46 your ip : 172.69.214.188 H O M E |
Filename | /usr/share/apport/dump_acpi_tables.py |
Size | 1.4 kb |
Permission | rwxr-xr-x |
Owner | root : root |
Create time | 27-Apr-2025 09:55 |
Last modified | 15-Apr-2014 23:38 |
Last accessed | 27-Apr-2025 09:57 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
#!/usr/bin/python3
import os, sys, stat
def dump_acpi_table(filename, tablename, out):
'''Dump a single ACPI table'''
out.write('%s @ 0x00000000\n' % tablename)
n = 0
f = open(filename, 'rb')
hex_str = ''
try:
byte = f.read(1)
while byte != b'':
val = ord(byte)
if (n & 15) == 0:
hex_str = ' %4.4x: ' % n
ascii_str = ''
hex_str = hex_str + '%2.2x ' % val
if (val < 32) or (val > 126):
ascii_str = ascii_str + '.'
else:
ascii_str = ascii_str + chr(val)
n = n + 1
if (n & 15) == 0:
out.write('%s %s\n' % (hex_str, ascii_str))
byte = f.read(1)
finally:
for i in range(n & 15, 16):
hex_str = hex_str + ' '
if (n & 15) != 15:
out.write('%s %s\n' % (hex_str, ascii_str))
f.close()
out.write('\n')
def dump_acpi_tables(path, out):
'''Dump ACPI tables'''
tables = os.listdir(path)
for tablename in tables:
pathname = os.path.join(path, tablename)
mode = os.stat(pathname).st_mode
if stat.S_ISDIR(mode):
dump_acpi_tables(pathname, out)
else:
dump_acpi_table(pathname, tablename, out)
if os.path.isdir('/sys/firmware/acpi/tables'):
dump_acpi_tables('/sys/firmware/acpi/tables', sys.stdout)
import os, sys, stat
def dump_acpi_table(filename, tablename, out):
'''Dump a single ACPI table'''
out.write('%s @ 0x00000000\n' % tablename)
n = 0
f = open(filename, 'rb')
hex_str = ''
try:
byte = f.read(1)
while byte != b'':
val = ord(byte)
if (n & 15) == 0:
hex_str = ' %4.4x: ' % n
ascii_str = ''
hex_str = hex_str + '%2.2x ' % val
if (val < 32) or (val > 126):
ascii_str = ascii_str + '.'
else:
ascii_str = ascii_str + chr(val)
n = n + 1
if (n & 15) == 0:
out.write('%s %s\n' % (hex_str, ascii_str))
byte = f.read(1)
finally:
for i in range(n & 15, 16):
hex_str = hex_str + ' '
if (n & 15) != 15:
out.write('%s %s\n' % (hex_str, ascii_str))
f.close()
out.write('\n')
def dump_acpi_tables(path, out):
'''Dump ACPI tables'''
tables = os.listdir(path)
for tablename in tables:
pathname = os.path.join(path, tablename)
mode = os.stat(pathname).st_mode
if stat.S_ISDIR(mode):
dump_acpi_tables(pathname, out)
else:
dump_acpi_table(pathname, tablename, out)
if os.path.isdir('/sys/firmware/acpi/tables'):
dump_acpi_tables('/sys/firmware/acpi/tables', sys.stdout)