summaryrefslogtreecommitdiff
path: root/bin
diff options
authorTaihsiang Ho <taihsiang.ho@canonical.com>2014-10-15 13:38:11 +0800
committerTaihsiang Ho <taihsiang.ho@canonical.com>2014-10-15 13:38:11 +0800
commitb0c13985f54aadebd282ec9cb1a61c2c7c8ee0a1 (patch)
tree1d5059b12cb2417c50f0740a02aea56c13eeb134 /bin
parent2ec5ec2d49a8548d61ab4f66a1d7a253bd11ce36 (diff)
Implement xhci driver detection for the controller
of superspeed usb as udisks1 device. Now both of udisks1 and udisks2 USB disk device xhci detection are integrated and works. LP: #1378724
Diffstat (limited to 'bin')
-rwxr-xr-xbin/removable_storage_test70
1 files changed, 46 insertions, 24 deletions
diff --git a/bin/removable_storage_test b/bin/removable_storage_test
index 97734de..5df6d78 100755
--- a/bin/removable_storage_test
+++ b/bin/removable_storage_test
@@ -253,24 +253,6 @@ class DiskTest():
else:
self.rem_disks_memory_cards_nm[dev_file] = None
self.rem_disks_nm[dev_file] = None
- # LP: #1313581
- # Compare the pci slot name of the devices using xhci and
- # the pci slot name of the disks,
- # which is usb3 disks in this case so far,
- # to make sure the usb3 disk does be on the bus using xhci
- # TODO: it will be better to extend to be all kinds of drivers.
- try:
- udev_devices_xhci = get_udev_xhci_devices(udev_client)
- for udev_device_xhci in udev_devices_xhci:
- pci_slot_name = udev_device_xhci.get_property('PCI_SLOT_NAME')
- for udev_device in udev_devices:
- devpath = udev_device.get_property('DEVPATH')
- if (self._compare_pci_slot_from_devpath(devpath,
- pci_slot_name)):
- self.rem_disks_xhci[
- udev_device.get_property('DEVNAME')] = 'xhci'
- except:
- logging.error("Failed to get driver information.")
def _probe_disks_udisks1(self, bus):
"""
@@ -321,6 +303,32 @@ class DiskTest():
self.rem_disks_nm[dev_file] = None
self.rem_disks_memory_cards_nm[dev_file] = None
+ def get_disks_xhci(self):
+ """
+ Compare
+ 1. the pci slot name of the devices using xhci
+ 2. the pci slot name of the disks,
+ which is usb3 disks in this case so far,
+ to make sure the usb3 disk does be on the controller using xhci
+ """
+ # LP: #1378724
+ udev_client = GUdev.Client()
+ # Get a collection of all udev devices corresponding to block devices
+ udev_devices = get_udev_block_devices(udev_client)
+ try:
+ udev_devices_xhci = get_udev_xhci_devices(udev_client)
+ for udev_device_xhci in udev_devices_xhci:
+ pci_slot_name = udev_device_xhci.get_property('PCI_SLOT_NAME')
+ for udev_device in udev_devices:
+ devpath = udev_device.get_property('DEVPATH')
+ if (self._compare_pci_slot_from_devpath(devpath,
+ pci_slot_name)):
+ self.rem_disks_xhci[
+ udev_device.get_property('DEVNAME')] = 'xhci'
+ return self.rem_disks_xhci
+ except:
+ logging.error("Failed to get driver information.")
+
def mount(self):
passed_mount = {}
@@ -647,17 +655,31 @@ def main():
else:
# LP: 1313581
if (args.driver == 'xhci_hcd'):
- if(5000000000 == test.rem_disks_speed[disk] and
- 'xhci' == test.rem_disks_xhci[disk]):
+ # The speed reported by udisks is sometimes
+ # less than 5G bits/s, for example, it may be 705032705 bits/s
+ # So using
+ # 500000000 = 500 M bits/s > 480 M bits/s ( USB 2.0 spec.)
+ # to make sure that it is higher USB version than 2.0
+ #
+ # int() for int(test.rem_disks_speed[disk])
+ # is necessary
+ # because the speed value of the dictionary rem_disks_speed is
+ # 1. str or int from _probe_disks_udisks2
+ # 2. int from _probe_disks_udisks1.
+ # This is really a mess. : (
+ #
+ print("\t\t--------------------------------")
+ if(500000000 < int(test.rem_disks_speed[disk]) and
+ 'xhci' == test.get_disks_xhci()[disk]):
print("\t\tDevice Detected: SuperSpeed USB")
print("\t\tDriver Detected: xhci_hcd")
else:
# Give it a hint for the detection failure.
# LP: #1362902
- print("No SuperSpeed USB using xhci_hcd \
- was detected correctly.")
- print("Hint: please use dmesg to check \
- the system status again.")
+ print(("\t\tNo SuperSpeed USB using xhci_hcd "
+ "was detected correctly."))
+ print(("\t\tHint: please use dmesg to check "
+ "the system status again."))
return 1
# Pass is not assured
if (not args.pass_speed or