apport-hackers team mailing list archive
-
apport-hackers team
-
Mailing list archive
-
Message #00158
[Merge] lp:~sforshee/apport/iwlwifi-fw-error into lp:apport
Seth Forshee has proposed merging lp:~sforshee/apport/iwlwifi-fw-error into lp:apport.
Requested reviews:
Apport upstream developers (apport-hackers)
For more details, see:
https://code.launchpad.net/~sforshee/apport/iwlwifi-fw-error/+merge/212680
Add data/iwlwifi_error_dump for reporting bugs when iwlwifi generates
a firmware dump. Also make assoicated changes to support this new
problem type and add an upstart job to trigger the script from the
associated uevent.
--
https://code.launchpad.net/~sforshee/apport/iwlwifi-fw-error/+merge/212680
Your team Apport upstream developers is requested to review the proposed merge of lp:~sforshee/apport/iwlwifi-fw-error into lp:apport.
=== modified file 'apport/report.py'
--- apport/report.py 2014-03-22 11:34:02 +0000
+++ apport/report.py 2014-03-25 17:02:47 +0000
@@ -274,7 +274,7 @@
'''
if not package:
# the kernel does not have a executable path but a package
- if not 'ExecutablePath' in self and self['ProblemType'] == 'KernelCrash':
+ if not 'ExecutablePath' in self and self['ProblemType'] in ('KernelCrash', 'IwlErrorDump'):
package = self['Package']
else:
package = apport.fileutils.find_file_package(self['ExecutablePath'])
@@ -1194,6 +1194,12 @@
return title
+ if self['ProblemType'] == 'IwlErrorDump':
+ title = 'iwlwifi firmware error'
+ if 'IwlErrorCode' in self:
+ title += ': ' + self['IwlErrorCode']
+ return title
+
return None
def obsolete_packages(self):
@@ -1232,7 +1238,7 @@
it exists.
'''
if 'ExecutablePath' not in self:
- if not self['ProblemType'] in ('KernelCrash', 'KernelOops'):
+ if not self['ProblemType'] in ('KernelCrash', 'KernelOops', 'IwlErrorDump'):
return None
# kernel crash
@@ -1342,6 +1348,10 @@
in_trace_body = False
if parts:
return ':'.join(parts)
+
+ # iwlwifi firmware error dumps
+ if self['ProblemType'] == 'IwlErrorDump' and 'IwlFwVersion' in self and 'IwlErrorCode' in self:
+ return 'iwlwifi:' + self['IwlFwVersion'] + ':' + self['IwlErrorCode']
return None
def _extract_function_and_address(self, line):
=== added file 'data/iwlwifi_error_dump'
--- data/iwlwifi_error_dump 1970-01-01 00:00:00 +0000
+++ data/iwlwifi_error_dump 2014-03-25 17:02:47 +0000
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+#
+# Collect information about an iwlwifi firmware error dump.
+#
+# Copyright (c) 2014 Canonical Ltd.
+# Author: Seth Forshee <seth.forshee@xxxxxxxxxxxxx>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
+# the full text of the license.
+
+import os, sys, re
+import apport, apport.fileutils
+from apport.hookutils import command_output
+
+if len(sys.argv) != 2:
+ sys.exit(1)
+
+phy = sys.argv[1]
+sysfs_path = '/sys/kernel/debug/ieee80211/' + phy + '/iwlwifi/iwlmvm/fw_error_dump'
+if not os.path.exists(sysfs_path):
+ sys.exit(1)
+
+pr = apport.Report('IwlErrorDump')
+pr['Package'] = apport.packaging.get_kernel_package()
+pr.add_os_info()
+
+# Get iwl firmware version and error code from dmesg
+dmesg = command_output(['dmesg'])
+regex = re.compile('^.*iwlwifi [0-9a-fA-F:]{10}\.[0-9a-fA-F]: Loaded firmware version: ([0-9\.]+).*\\n.*iwlwifi [0-9a-fA-F:]{10}\.[0-9a-fA-F]: (0x[0-9A-F]{8} \| [A-Z_]+)', re.MULTILINE)
+m = regex.findall(dmesg)
+if m:
+ l = m[len(m) - 1]
+ pr['IwlFwVersion'] = l[0]
+ pr['IwlErrorCode'] = l[1]
+
+# Get iwl firmware dump file from debugfs
+try:
+ with open(sysfs_path, 'rb') as f:
+ pr['IwlFwDump'] = f.read()
+except IOError:
+ pass
+
+try:
+ with open(apport.fileutils.make_report_path(pr), 'wb') as f:
+ pr.write(f)
+except IOError as e:
+ apport.fatal('Cannot create report: ' + str(e))
=== added directory 'etc/init'
=== added file 'etc/init/iwlwifi-error-dump.conf'
--- etc/init/iwlwifi-error-dump.conf 1970-01-01 00:00:00 +0000
+++ etc/init/iwlwifi-error-dump.conf 2014-03-25 17:02:47 +0000
@@ -0,0 +1,6 @@
+start on ieee80211-device-changed DRIVER=iwlwifi EVENT=error_dump
+
+script
+ phyname=$(basename ${DEVPATH})
+ /usr/share/apport/iwlwifi_error_dump "$phyname"
+end script
Follow ups