Merge lp:~ara/gesturetest/apport_hook_lp_622817 into lp:~oif-team/gesturetest/packaging

Proposed by Ara Pulido
Status: Merged
Merged at revision: 23
Proposed branch: lp:~ara/gesturetest/apport_hook_lp_622817
Merge into: lp:~oif-team/gesturetest/packaging
Diff against target: 162 lines (+145/-0)
3 files modified
debian/changelog (+6/-0)
debian/source_utouch-gesturetest.py (+137/-0)
debian/utouch-gesturetest.install (+2/-0)
To merge this branch: bzr merge lp:~ara/gesturetest/apport_hook_lp_622817
Reviewer Review Type Date Requested Status
Chase Douglas (community) Approve
Open Input Framework Team Pending
Review via email: mp+33653@code.launchpad.net

Description of the change

This branch contains the apport hook for utouch packages. (LP: 622817)

Basically, the hook is the same for all the utouch packages, but it requires installation in those that do not depend in any others.

* mtdev (it includes symlinks to utouch and utouch-grail)
* utouch-gesturetest
* utouch-geis

These changes do not require a feature freeze exception (I already discussed it with pitti)

To post a comment you must log in.
Revision history for this message
Chase Douglas (chasedouglas) wrote :

As stated in the mtdev review, the release name should be UNRELEASED instead of maverick right now. That's the only issue I see.

review: Needs Fixing
24. By Ara Pulido

Changed release name to UNRELEASED per utouch team policy

Revision history for this message
Ara Pulido (ara) wrote :

Modified accordingly. Thanks for the review!

Revision history for this message
Chase Douglas (chasedouglas) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2010-08-12 16:35:36 +0000
3+++ debian/changelog 2010-08-25 15:37:47 +0000
4@@ -1,3 +1,9 @@
5+utouch-gesturetest (1.0.4-0ubuntu2) UNRELEASED; urgency=low
6+
7+ * Added apport hook for utouch-gesturetest (LP: #622817)
8+
9+ -- Ara Pulido <ara@ubuntu.com> Wed, 25 Aug 2010 16:28:06 +0200
10+
11 utouch-gesturetest (1.0.4-0ubuntu1) maverick; urgency=low
12
13 * New upstream release.
14
15=== added file 'debian/source_utouch-gesturetest.py'
16--- debian/source_utouch-gesturetest.py 1970-01-01 00:00:00 +0000
17+++ debian/source_utouch-gesturetest.py 2010-08-25 15:37:47 +0000
18@@ -0,0 +1,137 @@
19+# Multitouch device related problems
20+# Author: Ara Pulido <ara@ubuntu.com>
21+# (C) 2010 Canonical Ltd.
22+# License: GPL v2 or later.
23+
24+from glob import glob
25+from subprocess import Popen, PIPE
26+import sys
27+import apport.hookutils
28+import time
29+import os
30+
31+# See linux/input.h
32+ABS_MT_POSITION_X = 0x35
33+
34+# scan-for-mt-devices written by Marc Tardif,
35+# based on a script by Henrik Rydberg
36+class Input(object):
37+
38+ def __init__(self, path):
39+ self.path = path
40+
41+ @property
42+ def device(self):
43+ base = os.path.basename(self.path)
44+ return os.path.join("/dev", "input", base)
45+
46+ @property
47+ def name(self):
48+ path = os.path.join(self.path, "device", "name")
49+ return read_line(path)
50+
51+ def get_capabilities(self):
52+ path = os.path.join(self.path, "device", "capabilities", "abs")
53+ line = read_line(path)
54+ capabilities = []
55+ long_bit = getconf("LONG_BIT")
56+ for i, word in enumerate(line.split(" ")):
57+ word = int(word, 16)
58+ subcapabilities = [bool(word & 1<<i) for i in range(long_bit)]
59+ capabilities[:0] = subcapabilities
60+
61+ return capabilities
62+
63+ def has_capability(self, capability):
64+ capabilities = self.get_capabilities()
65+ return len(capabilities) > capability and capabilities[capability]
66+
67+
68+def getconf(var):
69+ output = Popen(["getconf", var], stdout=PIPE).communicate()[0]
70+ return int(output)
71+
72+def get_inputs(path):
73+ event_glob = os.path.join(path, "event*")
74+ for event_path in glob(event_glob):
75+ yield Input(event_path)
76+
77+def read_line(path):
78+ f = open(path)
79+ try:
80+ return f.readline().strip()
81+ finally:
82+ f.close()
83+
84+def scan_for_mt_devices(report):
85+
86+ capability = ABS_MT_POSITION_X
87+ input = "/sys/class/input"
88+
89+ inputs = get_inputs(input)
90+ inputs = [i for i in inputs if i.has_capability(capability)]
91+
92+ report['MtDevices'] = ''
93+
94+ if inputs:
95+ for input in inputs:
96+ report['MtDevices'] += "%s: %s\n" % (input.name, input.device)
97+
98+ return 0
99+ else:
100+ report['MtDevices'] += "No capable devices found..."
101+ return 1
102+
103+##################################
104+
105+description = 'Multitouch device problem'
106+RELATED_PACKAGES = ['xserver-xorg', 'xserver-xorg-video-intel', 'xserver-xorg-video-ati', 'libmtdev1', 'libutouch-grail1', 'libutouch-geis1']
107+
108+
109+def add_info(report, ui):
110+
111+ report.setdefault('Tags', '')
112+ report['Tags'] += ' hci touch'
113+
114+ # Capture hardware
115+ apport.hookutils.attach_hardware(report)
116+ report['PciDisplay'] = apport.hookutils.pci_devices(apport.hookutils.PCI_DISPLAY)
117+
118+ # Attach the results of scan mt devices
119+ scan_for_mt_devices(report)
120+
121+ # Only collect the following data if X11 is available
122+ if os.environ.get('DISPLAY'):
123+ # For resolution/multi-head bugs
124+ report['Xrandr'] = apport.hookutils.command_output(['xrandr', '--verbose'])
125+ apport.hookutils.attach_file_if_exists(report,
126+ os.path.expanduser('~/.config/monitors.xml'),
127+ 'monitors.xml')
128+
129+ # Attach the Xorg logs and config
130+ apport.hookutils.attach_file_if_exists(report, '/etc/X11/xorg.conf', 'XorgConf')
131+ apport.hookutils.attach_file(report, '/var/log/Xorg.0.log', 'XorgLog')
132+ apport.hookutils.attach_file_if_exists(report, '/var/log/Xorg.0.log.old', 'XorgLogOld')
133+ apport.hookutils.attach_file_if_exists(report, '/var/log/gdm/:0.log', 'GdmLog')
134+ apport.hookutils.attach_file_if_exists(report, '/var/log/gdm/:0.log.1', 'GdmLogOld')
135+
136+
137+ # Attach the output of xinput
138+ report['XInput'] = apport.hookutils.command_output(['xinput', 'input'])
139+
140+ # Attach the output of lsinput
141+ report['LsInput'] = apport.hookutils.root_command_output(["lsinput"])
142+
143+ # Attach descriptors
144+ attach_descriptors(report)
145+
146+ apport.hookutils.attach_related_packages(report, RELATED_PACKAGES)
147+
148+def attach_descriptors(report):
149+ path = '/sys/kernel/debug/hid/*/rdesc'
150+ for desc in glob(path):
151+ name = desc.split('/')[5]
152+ name = name.replace(":", "").replace(".", "")
153+ report[name] = apport.hookutils.root_command_output(["cat", desc])
154+
155+
156
157=== added file 'debian/utouch-gesturetest.install'
158--- debian/utouch-gesturetest.install 1970-01-01 00:00:00 +0000
159+++ debian/utouch-gesturetest.install 2010-08-25 15:37:47 +0000
160@@ -0,0 +1,2 @@
161+debian/source_utouch-gesturetest.py usr/share/apport/package-hooks
162+

Subscribers

People subscribed via source and target branches