Merge lp:~bladernr/checkbox/953160-mmc-not-sdio into lp:checkbox

Proposed by Jeff Lane on 2012-03-15
Status: Merged
Merged at revision: 1322
Proposed branch: lp:~bladernr/checkbox/953160-mmc-not-sdio
Merge into: lp:checkbox
Diff against target: 273 lines (+40/-29) (has conflicts)
4 files modified
debian/changelog (+10/-0)
jobs/mediacard.txt.in (+16/-16)
scripts/removable_storage_test (+3/-2)
scripts/removable_storage_watcher (+11/-11)
Text conflict in debian/changelog
To merge this branch: bzr merge lp:~bladernr/checkbox/953160-mmc-not-sdio
Reviewer Review Type Date Requested Status
TienFu Chen (community) Approve on 2012-03-16
Checkbox Developers 2012-03-15 Pending
Review via email: mp+97677@code.launchpad.net

Description of the change

Changes to the scripts to allow us to specify a list of busses to watch/test. This handles those pesky MMC readers that appear as SDIO, USB or SCSI devices :/

To post a comment you must log in.
Brendan Donegan (brendan-donegan) wrote :

Not quite sure why it was necessary to mess around with the way imports were done but otherwise it looks fine. I'm going to give it a test now and see how it works.

Jeff Lane (bladernr) wrote :

Ummm... I'll just say it seemed like a good idea at the time... I think at one point I changed that because I was using more than just ArgumentParser, but then removed those changes and forgot to reset the import.

TienFu Chen (ctf) wrote :

Looks good,
I ran the command as below, but got the message "Expected device usb inserted" for twice.
-------------------------------------
sudo ./removable_storage_watcher insert usb sdio scsi
Expected device usb inserted
Expected device usb inserted
-------------------------------------
I examined the parameters of function job_change_detected: devices, job_in_progress, job_id, job_num_tasks, job_cur_task_id, job_cur_task_percentage, from the first and second run of job_change_detected. Those parameters are the same. So it implies when the usb is inserted, the usb is being mounted for twice?

---------------------
/org/freedesktop/UDisks/devices/sdb1
1
FilesystemMount
1000
0
-1.0
Expected device usb inserted
/org/freedesktop/UDisks/devices/sdb1
1
FilesystemMount
1000
0
-1.0
---------------------

review: Approve
Brendan Donegan (brendan-donegan) wrote :

This is fine. There's no point adding code to get around this - as long as the script detects one mount at least then it will pass.

Daniel Manrique (roadmr) wrote :

Merging this based on Tim's approval. Fixed changelog while I was at it. Thanks!

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 2012-03-15 14:05:42 +0000
3+++ debian/changelog 2012-03-15 15:18:21 +0000
4@@ -11,12 +11,19 @@
5 [Jeff Lane]
6 * Reset default checkbox log level to INFO from DEBUG to make logs less
7 confusing and verbose. (LP: #949745)
8+<<<<<<< TREE
9 * Removed dependency on bluetooth/detect-output on the
10 suspend/suspend_advanced job. (LP: #955375)
11+=======
12+ * Modified removable_storage_watcher and removable_storage_test to accept
13+ list of busses to watch to resolve problems on systems with MMC readers
14+ that present themselves as USB devices rather than SDIO (LP: #953160)
15+>>>>>>> MERGE-SOURCE
16
17 [Marc Tardif]
18 * Linted qt_interface which had a few syntax errors (LP: #949957)
19
20+<<<<<<< TREE
21 [Daniel Manrique]
22 * Bumpted revision number to 0.13.5 in trunk
23 * jobs/keys.txt.in: Fix definition for keys/media-keys test which failed to
24@@ -25,6 +32,9 @@
25 undesirable secondary effects.
26
27 -- Jeff Lane <jeff@ubuntu.com> Wed, 14 Mar 2012 18:10:57 -0400
28+=======
29+ -- Jeff Lane <jeff@ubuntu.com> Tue, 13 Mar 2012 18:18:04 -0400
30+>>>>>>> MERGE-SOURCE
31
32 checkbox (0.13.4) precise; urgency=low
33
34
35=== modified file 'jobs/mediacard.txt.in'
36--- jobs/mediacard.txt.in 2012-02-05 13:07:59 +0000
37+++ jobs/mediacard.txt.in 2012-03-15 15:18:21 +0000
38@@ -1,6 +1,6 @@
39 plugin: manual
40 name: mediacard/mmc-insert
41-command: removable_storage_watcher insert sdio
42+command: removable_storage_watcher insert sdio usb scsi
43 _description:
44 PURPOSE:
45 This test will check that the systems media card reader can
46@@ -24,7 +24,7 @@
47 plugin: manual
48 name: mediacard/mmc-remove
49 depends: mediacard/mmc-storage
50-command: removable_storage_watcher remove sdio
51+command: removable_storage_watcher remove sdio usb scsi
52 _description:
53 PURPOSE:
54 This test will check that the system correctly detects
55@@ -39,7 +39,7 @@
56 plugin: manual
57 name: mediacard/mmc-insert-after-suspend
58 depends: suspend/suspend_advanced
59-command: removable_storage_watcher insert sdio
60+command: removable_storage_watcher insert sdio usb scsi
61 _description:
62 PURPOSE:
63 This test will check that the systems media card reader can
64@@ -63,7 +63,7 @@
65 plugin: manual
66 name: mediacard/mmc-remove-after-suspend
67 depends: mediacard/mmc-storage-after-suspend
68-command: removable_storage_watcher remove sdio
69+command: removable_storage_watcher remove sdio usb scsi
70 _description:
71 PURPOSE:
72 This test will check that the system correctly detects the removal
73@@ -77,7 +77,7 @@
74
75 plugin: manual
76 name: mediacard/sd-insert
77-command: removable_storage_watcher insert sdio
78+command: removable_storage_watcher insert sdio usb scsi
79 _description:
80 PURPOSE:
81 This test will check that the systems media card reader can
82@@ -101,7 +101,7 @@
83 plugin: manual
84 name: mediacard/sd-remove
85 depends: mediacard/sd-storage
86-command: removable_storage_watcher remove sdio
87+command: removable_storage_watcher remove sdio usb scsi
88 _description:
89 PURPOSE:
90 This test will check that the system correctly detects
91@@ -116,7 +116,7 @@
92 plugin: manual
93 name: mediacard/sd-insert-after-suspend
94 depends: suspend/suspend_advanced
95-command: removable_storage_watcher insert sdio
96+command: removable_storage_watcher insert sdio usb scsi
97 _description:
98 PURPOSE:
99 This test will check that the systems media card reader can
100@@ -140,7 +140,7 @@
101 plugin: manual
102 name: mediacard/sd-remove-after-suspend
103 depends: mediacard/sd-storage-after-suspend
104-command: removable_storage_watcher remove sdio
105+command: removable_storage_watcher remove sdio usb scsi
106 _description:
107 PURPOSE:
108 This test will check that the system correctly detects
109@@ -154,7 +154,7 @@
110
111 plugin: manual
112 name: mediacard/sdhc-insert
113-command: removable_storage_watcher insert sdio
114+command: removable_storage_watcher insert sdio usb scsi
115 _description:
116 PURPOSE:
117 This test will check that the systems media card reader can
118@@ -178,7 +178,7 @@
119 plugin: manual
120 name: mediacard/sdhc-remove
121 depends: mediacard/sdhc-storage
122-command: removable_storage_watcher remove sdio
123+command: removable_storage_watcher remove sdio usb scsi
124 _description:
125 PURPOSE:
126 This test will check that the system correctly detects
127@@ -193,7 +193,7 @@
128 plugin: manual
129 name: mediacard/sdhc-insert-after-suspend
130 depends: suspend/suspend_advanced
131-command: removable_storage_watcher insert sdio
132+command: removable_storage_watcher insert sdio usb scsi
133 _description:
134 PURPOSE:
135 This test will check that the systems media card reader can
136@@ -217,7 +217,7 @@
137 plugin: manual
138 name: mediacard/sdhc-remove-after-suspend
139 depends: mediacard/sdhc-storage-after-suspend
140-command: removable_storage_watcher remove sdio
141+command: removable_storage_watcher remove sdio usb scsi
142 _description:
143 PURPOSE:
144 This test will check that the system correctly detects the removal
145@@ -231,7 +231,7 @@
146
147 plugin: manual
148 name: mediacard/cf-insert
149-command: removable_storage_watcher insert sdio
150+command: removable_storage_watcher insert sdio usb scsi
151 _description:
152 PURPOSE:
153 This test will check that the systems media card reader can
154@@ -255,7 +255,7 @@
155 plugin: manual
156 name: mediacard/cf-remove
157 depends: mediacard/cf-storage
158-command: removable_storage_watcher remove sdio
159+command: removable_storage_watcher remove sdio usb scsi
160 _description:
161 PURPOSE:
162 This test will check that the system correctly detects
163@@ -270,7 +270,7 @@
164 plugin: manual
165 name: mediacard/cf-insert-after-suspend
166 depends: suspend/suspend_advanced
167-command: removable_storage_watcher insert sdio
168+command: removable_storage_watcher insert sdio usb scsi
169 _description:
170 PURPOSE:
171 This test will check that the systems media card reader can
172@@ -294,7 +294,7 @@
173 plugin: manual
174 name: mediacard/cf-remove-after-suspend
175 depends: mediacard/cf-storage-after-suspend
176-command: removable_storage_watcher remove sdio
177+command: removable_storage_watcher remove sdio usb scsi
178 _description:
179 PURPOSE:
180 This test will check that the system correctly detects the removal
181
182=== modified file 'scripts/removable_storage_test'
183--- scripts/removable_storage_test 2012-03-05 08:23:50 +0000
184+++ scripts/removable_storage_test 2012-03-15 15:18:21 +0000
185@@ -79,7 +79,7 @@
186 device_obj = bus.get_object("org.freedesktop.UDisks", dev)
187 device_props = dbus.Interface(device_obj, dbus.PROPERTIES_IFACE)
188 if not device_props.Get('org.freedesktop.UDisks.Device',"DeviceIsDrive"):
189- if device_props.Get('org.freedesktop.UDisks.Device', "DriveConnectionInterface") == device:
190+ if device_props.Get('org.freedesktop.UDisks.Device', "DriveConnectionInterface") in device:
191 dev_file = str(device_props.Get('org.freedesktop.UDisks.Device',"DeviceFile"))
192
193 if len(device_props.Get('org.freedesktop.UDisks.Device',"DeviceMountPaths")) > 0:
194@@ -168,7 +168,8 @@
195 def main():
196 parser = argparse.ArgumentParser()
197 parser.add_argument('device',
198- choices=['usb','firewire','sdio'],
199+ choices=['usb','firewire','sdio', 'scsi'],
200+ nargs = '+',
201 help="The type of removable media (usb, firewire, sdio) to test.")
202 parser.add_argument('-l','--list',
203 action='store_true',
204
205=== modified file 'scripts/removable_storage_watcher'
206--- scripts/removable_storage_watcher 2012-01-23 15:04:52 +0000
207+++ scripts/removable_storage_watcher 2012-03-15 15:18:21 +0000
208@@ -3,16 +3,15 @@
209 import sys
210 import gobject
211 import dbus
212+import argparse
213
214-from argparse import ArgumentParser
215 from dbus.mainloop.glib import DBusGMainLoop
216
217-
218 class StorageDeviceListener(object):
219
220- def __init__(self, action, device):
221+ def __init__(self, action, devices):
222 self._action = action
223- self._device = device
224+ self._devices = devices
225 self._bus = dbus.SystemBus(mainloop=DBusGMainLoop())
226 self._loop = gobject.MainLoop()
227 self._error = False
228@@ -33,7 +32,7 @@
229
230 return self._error
231
232- def job_change_detected(self, device, job_in_progress, job_id, job_num_tasks, job_cur_task_id, job_cur_task_percentage):
233+ def job_change_detected(self, devices, job_in_progress, job_id, job_num_tasks, job_cur_task_id, job_cur_task_percentage):
234 if job_id == "FilesystemMount" and self.is_device_inserted():
235 print "Expected device %s inserted" % self._device
236 self._loop.quit()
237@@ -43,20 +42,21 @@
238
239 def remove_detected(self, removed_path):
240 if not self.is_device_inserted():
241- print "Expected device %s has been removed" % self._device
242-
243+ print "Removable storage device has been removed"
244+ #TODO: figure out a way to get the DriveConnectionInterface of the
245+ #device that was just removed.
246 self._loop.quit()
247
248 def is_device_inserted(self):
249 ud_manager_obj = self._bus.get_object("org.freedesktop.UDisks", "/org/freedesktop/UDisks")
250 ud_manager = dbus.Interface(ud_manager_obj, 'org.freedesktop.UDisks')
251-
252 for dev in ud_manager.EnumerateDevices():
253 try:
254 device_obj = self._bus.get_object("org.freedesktop.UDisks", dev)
255 device_props = dbus.Interface(device_obj, dbus.PROPERTIES_IFACE)
256+ self._device = device_props.Get('org.freedesktop.UDisks.Device', "DriveConnectionInterface")
257 if not device_props.Get('org.freedesktop.UDisks.Device',"DeviceIsDrive"):
258- if device_props.Get('org.freedesktop.UDisks.Device', "DriveConnectionInterface") == self._device:
259+ if self._device in self._devices:
260 return True
261 except dbus.DBusException:
262 pass
263@@ -64,9 +64,9 @@
264 return False
265
266 def main():
267- parser = ArgumentParser(description="Wait for the specified device to be inserted or removed.")
268+ parser = argparse.ArgumentParser(description="Wait for the specified device to be inserted or removed.")
269 parser.add_argument('action', choices=['insert','remove'])
270- parser.add_argument('device', choices=['usb','firewire','sdio'])
271+ parser.add_argument('device', choices=['usb','sdio','firewire','scsi'],nargs=argparse.REMAINDER)
272 parser.add_argument('--timeout', type=int, default=10)
273 args = parser.parse_args()
274

Subscribers

People subscribed via source and target branches