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
=== modified file 'debian/changelog'
--- debian/changelog 2012-03-15 14:05:42 +0000
+++ debian/changelog 2012-03-15 15:18:21 +0000
@@ -11,12 +11,19 @@
11 [Jeff Lane]11 [Jeff Lane]
12 * Reset default checkbox log level to INFO from DEBUG to make logs less12 * Reset default checkbox log level to INFO from DEBUG to make logs less
13 confusing and verbose. (LP: #949745) 13 confusing and verbose. (LP: #949745)
14<<<<<<< TREE
14 * Removed dependency on bluetooth/detect-output on the 15 * Removed dependency on bluetooth/detect-output on the
15 suspend/suspend_advanced job. (LP: #955375)16 suspend/suspend_advanced job. (LP: #955375)
17=======
18 * Modified removable_storage_watcher and removable_storage_test to accept
19 list of busses to watch to resolve problems on systems with MMC readers
20 that present themselves as USB devices rather than SDIO (LP: #953160)
21>>>>>>> MERGE-SOURCE
1622
17 [Marc Tardif]23 [Marc Tardif]
18 * Linted qt_interface which had a few syntax errors (LP: #949957)24 * Linted qt_interface which had a few syntax errors (LP: #949957)
1925
26<<<<<<< TREE
20 [Daniel Manrique]27 [Daniel Manrique]
21 * Bumpted revision number to 0.13.5 in trunk28 * Bumpted revision number to 0.13.5 in trunk
22 * jobs/keys.txt.in: Fix definition for keys/media-keys test which failed to29 * jobs/keys.txt.in: Fix definition for keys/media-keys test which failed to
@@ -25,6 +32,9 @@
25 undesirable secondary effects.32 undesirable secondary effects.
2633
27 -- Jeff Lane <jeff@ubuntu.com> Wed, 14 Mar 2012 18:10:57 -040034 -- Jeff Lane <jeff@ubuntu.com> Wed, 14 Mar 2012 18:10:57 -0400
35=======
36 -- Jeff Lane <jeff@ubuntu.com> Tue, 13 Mar 2012 18:18:04 -0400
37>>>>>>> MERGE-SOURCE
2838
29checkbox (0.13.4) precise; urgency=low39checkbox (0.13.4) precise; urgency=low
3040
3141
=== modified file 'jobs/mediacard.txt.in'
--- jobs/mediacard.txt.in 2012-02-05 13:07:59 +0000
+++ jobs/mediacard.txt.in 2012-03-15 15:18:21 +0000
@@ -1,6 +1,6 @@
1plugin: manual1plugin: manual
2name: mediacard/mmc-insert2name: mediacard/mmc-insert
3command: removable_storage_watcher insert sdio3command: removable_storage_watcher insert sdio usb scsi
4_description:4_description:
5 PURPOSE:5 PURPOSE:
6 This test will check that the systems media card reader can6 This test will check that the systems media card reader can
@@ -24,7 +24,7 @@
24plugin: manual24plugin: manual
25name: mediacard/mmc-remove25name: mediacard/mmc-remove
26depends: mediacard/mmc-storage26depends: mediacard/mmc-storage
27command: removable_storage_watcher remove sdio27command: removable_storage_watcher remove sdio usb scsi
28_description:28_description:
29 PURPOSE:29 PURPOSE:
30 This test will check that the system correctly detects 30 This test will check that the system correctly detects
@@ -39,7 +39,7 @@
39plugin: manual39plugin: manual
40name: mediacard/mmc-insert-after-suspend40name: mediacard/mmc-insert-after-suspend
41depends: suspend/suspend_advanced41depends: suspend/suspend_advanced
42command: removable_storage_watcher insert sdio42command: removable_storage_watcher insert sdio usb scsi
43_description:43_description:
44 PURPOSE:44 PURPOSE:
45 This test will check that the systems media card reader can45 This test will check that the systems media card reader can
@@ -63,7 +63,7 @@
63plugin: manual63plugin: manual
64name: mediacard/mmc-remove-after-suspend64name: mediacard/mmc-remove-after-suspend
65depends: mediacard/mmc-storage-after-suspend65depends: mediacard/mmc-storage-after-suspend
66command: removable_storage_watcher remove sdio66command: removable_storage_watcher remove sdio usb scsi
67_description:67_description:
68 PURPOSE:68 PURPOSE:
69 This test will check that the system correctly detects the removal69 This test will check that the system correctly detects the removal
@@ -77,7 +77,7 @@
7777
78plugin: manual78plugin: manual
79name: mediacard/sd-insert79name: mediacard/sd-insert
80command: removable_storage_watcher insert sdio80command: removable_storage_watcher insert sdio usb scsi
81_description:81_description:
82 PURPOSE:82 PURPOSE:
83 This test will check that the systems media card reader can83 This test will check that the systems media card reader can
@@ -101,7 +101,7 @@
101plugin: manual101plugin: manual
102name: mediacard/sd-remove102name: mediacard/sd-remove
103depends: mediacard/sd-storage103depends: mediacard/sd-storage
104command: removable_storage_watcher remove sdio104command: removable_storage_watcher remove sdio usb scsi
105_description:105_description:
106 PURPOSE:106 PURPOSE:
107 This test will check that the system correctly detects 107 This test will check that the system correctly detects
@@ -116,7 +116,7 @@
116plugin: manual116plugin: manual
117name: mediacard/sd-insert-after-suspend117name: mediacard/sd-insert-after-suspend
118depends: suspend/suspend_advanced118depends: suspend/suspend_advanced
119command: removable_storage_watcher insert sdio119command: removable_storage_watcher insert sdio usb scsi
120_description:120_description:
121 PURPOSE:121 PURPOSE:
122 This test will check that the systems media card reader can122 This test will check that the systems media card reader can
@@ -140,7 +140,7 @@
140plugin: manual140plugin: manual
141name: mediacard/sd-remove-after-suspend141name: mediacard/sd-remove-after-suspend
142depends: mediacard/sd-storage-after-suspend142depends: mediacard/sd-storage-after-suspend
143command: removable_storage_watcher remove sdio143command: removable_storage_watcher remove sdio usb scsi
144_description:144_description:
145 PURPOSE:145 PURPOSE:
146 This test will check that the system correctly detects 146 This test will check that the system correctly detects
@@ -154,7 +154,7 @@
154154
155plugin: manual155plugin: manual
156name: mediacard/sdhc-insert156name: mediacard/sdhc-insert
157command: removable_storage_watcher insert sdio157command: removable_storage_watcher insert sdio usb scsi
158_description:158_description:
159 PURPOSE:159 PURPOSE:
160 This test will check that the systems media card reader can160 This test will check that the systems media card reader can
@@ -178,7 +178,7 @@
178plugin: manual178plugin: manual
179name: mediacard/sdhc-remove179name: mediacard/sdhc-remove
180depends: mediacard/sdhc-storage180depends: mediacard/sdhc-storage
181command: removable_storage_watcher remove sdio181command: removable_storage_watcher remove sdio usb scsi
182_description:182_description:
183 PURPOSE:183 PURPOSE:
184 This test will check that the system correctly detects 184 This test will check that the system correctly detects
@@ -193,7 +193,7 @@
193plugin: manual193plugin: manual
194name: mediacard/sdhc-insert-after-suspend194name: mediacard/sdhc-insert-after-suspend
195depends: suspend/suspend_advanced195depends: suspend/suspend_advanced
196command: removable_storage_watcher insert sdio196command: removable_storage_watcher insert sdio usb scsi
197_description:197_description:
198 PURPOSE:198 PURPOSE:
199 This test will check that the systems media card reader can199 This test will check that the systems media card reader can
@@ -217,7 +217,7 @@
217plugin: manual217plugin: manual
218name: mediacard/sdhc-remove-after-suspend218name: mediacard/sdhc-remove-after-suspend
219depends: mediacard/sdhc-storage-after-suspend219depends: mediacard/sdhc-storage-after-suspend
220command: removable_storage_watcher remove sdio220command: removable_storage_watcher remove sdio usb scsi
221_description:221_description:
222 PURPOSE:222 PURPOSE:
223 This test will check that the system correctly detects the removal223 This test will check that the system correctly detects the removal
@@ -231,7 +231,7 @@
231231
232plugin: manual232plugin: manual
233name: mediacard/cf-insert233name: mediacard/cf-insert
234command: removable_storage_watcher insert sdio234command: removable_storage_watcher insert sdio usb scsi
235_description:235_description:
236 PURPOSE:236 PURPOSE:
237 This test will check that the systems media card reader can237 This test will check that the systems media card reader can
@@ -255,7 +255,7 @@
255plugin: manual255plugin: manual
256name: mediacard/cf-remove256name: mediacard/cf-remove
257depends: mediacard/cf-storage257depends: mediacard/cf-storage
258command: removable_storage_watcher remove sdio258command: removable_storage_watcher remove sdio usb scsi
259_description:259_description:
260 PURPOSE:260 PURPOSE:
261 This test will check that the system correctly detects 261 This test will check that the system correctly detects
@@ -270,7 +270,7 @@
270plugin: manual270plugin: manual
271name: mediacard/cf-insert-after-suspend271name: mediacard/cf-insert-after-suspend
272depends: suspend/suspend_advanced272depends: suspend/suspend_advanced
273command: removable_storage_watcher insert sdio273command: removable_storage_watcher insert sdio usb scsi
274_description:274_description:
275 PURPOSE:275 PURPOSE:
276 This test will check that the systems media card reader can276 This test will check that the systems media card reader can
@@ -294,7 +294,7 @@
294plugin: manual294plugin: manual
295name: mediacard/cf-remove-after-suspend295name: mediacard/cf-remove-after-suspend
296depends: mediacard/cf-storage-after-suspend296depends: mediacard/cf-storage-after-suspend
297command: removable_storage_watcher remove sdio297command: removable_storage_watcher remove sdio usb scsi
298_description:298_description:
299 PURPOSE:299 PURPOSE:
300 This test will check that the system correctly detects the removal300 This test will check that the system correctly detects the removal
301301
=== modified file 'scripts/removable_storage_test'
--- scripts/removable_storage_test 2012-03-05 08:23:50 +0000
+++ scripts/removable_storage_test 2012-03-15 15:18:21 +0000
@@ -79,7 +79,7 @@
79 device_obj = bus.get_object("org.freedesktop.UDisks", dev)79 device_obj = bus.get_object("org.freedesktop.UDisks", dev)
80 device_props = dbus.Interface(device_obj, dbus.PROPERTIES_IFACE)80 device_props = dbus.Interface(device_obj, dbus.PROPERTIES_IFACE)
81 if not device_props.Get('org.freedesktop.UDisks.Device',"DeviceIsDrive"):81 if not device_props.Get('org.freedesktop.UDisks.Device',"DeviceIsDrive"):
82 if device_props.Get('org.freedesktop.UDisks.Device', "DriveConnectionInterface") == device:82 if device_props.Get('org.freedesktop.UDisks.Device', "DriveConnectionInterface") in device:
83 dev_file = str(device_props.Get('org.freedesktop.UDisks.Device',"DeviceFile"))83 dev_file = str(device_props.Get('org.freedesktop.UDisks.Device',"DeviceFile"))
8484
85 if len(device_props.Get('org.freedesktop.UDisks.Device',"DeviceMountPaths")) > 0:85 if len(device_props.Get('org.freedesktop.UDisks.Device',"DeviceMountPaths")) > 0:
@@ -168,7 +168,8 @@
168def main():168def main():
169 parser = argparse.ArgumentParser()169 parser = argparse.ArgumentParser()
170 parser.add_argument('device',170 parser.add_argument('device',
171 choices=['usb','firewire','sdio'],171 choices=['usb','firewire','sdio', 'scsi'],
172 nargs = '+',
172 help="The type of removable media (usb, firewire, sdio) to test.")173 help="The type of removable media (usb, firewire, sdio) to test.")
173 parser.add_argument('-l','--list',174 parser.add_argument('-l','--list',
174 action='store_true',175 action='store_true',
175176
=== modified file 'scripts/removable_storage_watcher'
--- scripts/removable_storage_watcher 2012-01-23 15:04:52 +0000
+++ scripts/removable_storage_watcher 2012-03-15 15:18:21 +0000
@@ -3,16 +3,15 @@
3import sys3import sys
4import gobject4import gobject
5import dbus5import dbus
6import argparse
67
7from argparse import ArgumentParser
8from dbus.mainloop.glib import DBusGMainLoop8from dbus.mainloop.glib import DBusGMainLoop
99
10
11class StorageDeviceListener(object):10class StorageDeviceListener(object):
1211
13 def __init__(self, action, device):12 def __init__(self, action, devices):
14 self._action = action13 self._action = action
15 self._device = device14 self._devices = devices
16 self._bus = dbus.SystemBus(mainloop=DBusGMainLoop())15 self._bus = dbus.SystemBus(mainloop=DBusGMainLoop())
17 self._loop = gobject.MainLoop()16 self._loop = gobject.MainLoop()
18 self._error = False17 self._error = False
@@ -33,7 +32,7 @@
3332
34 return self._error33 return self._error
3534
36 def job_change_detected(self, device, job_in_progress, job_id, job_num_tasks, job_cur_task_id, job_cur_task_percentage):35 def job_change_detected(self, devices, job_in_progress, job_id, job_num_tasks, job_cur_task_id, job_cur_task_percentage):
37 if job_id == "FilesystemMount" and self.is_device_inserted():36 if job_id == "FilesystemMount" and self.is_device_inserted():
38 print "Expected device %s inserted" % self._device37 print "Expected device %s inserted" % self._device
39 self._loop.quit()38 self._loop.quit()
@@ -43,20 +42,21 @@
4342
44 def remove_detected(self, removed_path):43 def remove_detected(self, removed_path):
45 if not self.is_device_inserted():44 if not self.is_device_inserted():
46 print "Expected device %s has been removed" % self._device45 print "Removable storage device has been removed"
4746 #TODO: figure out a way to get the DriveConnectionInterface of the
47 #device that was just removed.
48 self._loop.quit()48 self._loop.quit()
4949
50 def is_device_inserted(self):50 def is_device_inserted(self):
51 ud_manager_obj = self._bus.get_object("org.freedesktop.UDisks", "/org/freedesktop/UDisks")51 ud_manager_obj = self._bus.get_object("org.freedesktop.UDisks", "/org/freedesktop/UDisks")
52 ud_manager = dbus.Interface(ud_manager_obj, 'org.freedesktop.UDisks')52 ud_manager = dbus.Interface(ud_manager_obj, 'org.freedesktop.UDisks')
53
54 for dev in ud_manager.EnumerateDevices():53 for dev in ud_manager.EnumerateDevices():
55 try:54 try:
56 device_obj = self._bus.get_object("org.freedesktop.UDisks", dev)55 device_obj = self._bus.get_object("org.freedesktop.UDisks", dev)
57 device_props = dbus.Interface(device_obj, dbus.PROPERTIES_IFACE)56 device_props = dbus.Interface(device_obj, dbus.PROPERTIES_IFACE)
57 self._device = device_props.Get('org.freedesktop.UDisks.Device', "DriveConnectionInterface")
58 if not device_props.Get('org.freedesktop.UDisks.Device',"DeviceIsDrive"):58 if not device_props.Get('org.freedesktop.UDisks.Device',"DeviceIsDrive"):
59 if device_props.Get('org.freedesktop.UDisks.Device', "DriveConnectionInterface") == self._device:59 if self._device in self._devices:
60 return True60 return True
61 except dbus.DBusException:61 except dbus.DBusException:
62 pass62 pass
@@ -64,9 +64,9 @@
64 return False64 return False
6565
66def main():66def main():
67 parser = ArgumentParser(description="Wait for the specified device to be inserted or removed.")67 parser = argparse.ArgumentParser(description="Wait for the specified device to be inserted or removed.")
68 parser.add_argument('action', choices=['insert','remove'])68 parser.add_argument('action', choices=['insert','remove'])
69 parser.add_argument('device', choices=['usb','firewire','sdio'])69 parser.add_argument('device', choices=['usb','sdio','firewire','scsi'],nargs=argparse.REMAINDER)
70 parser.add_argument('--timeout', type=int, default=10)70 parser.add_argument('--timeout', type=int, default=10)
71 args = parser.parse_args()71 args = parser.parse_args()
7272

Subscribers

People subscribed via source and target branches