summaryrefslogtreecommitdiff
path: root/bin
diff options
authorZygmunt Krynicki <zygmunt.krynicki@canonical.com>2014-05-02 11:25:50 +0200
committerZygmunt Krynicki <zygmunt.krynicki@canonical.com>2014-05-02 11:25:50 +0200
commit3b581beb36f3bc80c486874a3d1b226422f84015 (patch)
tree785364706d30fdabb3aaa88085907b4387a65f78 /bin
parent34455d14c969c9c70e586d076542a7b1f4479106 (diff)
providers:checkbox: improve usb3 handling
Add the --driver argument. Specialize the code for xhci_hcd and usb3. I don't want the modification of the script affects the behavior in other types of disks
Diffstat (limited to 'bin')
-rwxr-xr-xbin/removable_storage_test28
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/removable_storage_test b/bin/removable_storage_test
index 81c11f8..3592dc1 100755
--- a/bin/removable_storage_test
+++ b/bin/removable_storage_test
@@ -25,6 +25,7 @@ from checkbox_support.heuristics.udisks2 import is_memory_card
from checkbox_support.parsers.udevadm import CARD_READER_RE, GENERIC_RE, FLASH_RE
from checkbox_support.udev import get_interconnect_speed
from checkbox_support.udev import get_udev_block_devices
+from checkbox_support.udev import get_udev_xhci_devices
class ActionTimer():
@@ -99,6 +100,7 @@ class DiskTest():
self.rem_disks_memory_cards = {}
self.rem_disks_memory_cards_nm = {}
self.rem_disks_speed = {}
+ self.rem_disks_xhci = {} # LP: #1313581, TODO: extend to be rem_disks_driver
self.data = ''
self.device = device
self.memorycard = memorycard
@@ -247,6 +249,20 @@ 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:
+ if (pci_slot_name == udev_device.get_property('DEVPATH').split('/')[3]):
+ self.rem_disks_xhci[udev_device.get_property('DEVNAME')] = 'xhci'
+ except:
+ logging.error("Failed to get driver information.")
def _probe_disks_udisks1(self, bus):
"""
@@ -393,6 +409,10 @@ def main():
help=("Memory cards devices on bus other than sdio "
"require this parameter to identify "
"them as such"))
+ parser.add_argument('--driver',
+ choices=['xhci_hcd'],
+ help=("Detect the driver of the host controller."
+ "Only xhci_hcd for usb3 is supported so far."))
args = parser.parse_args()
@@ -573,6 +593,14 @@ def main():
return 1
else:
+ # LP: 1313581
+ if (args.driver == 'xhci_hcd'):
+ if(5000000000 == test.rem_disks_speed[disk] and
+ 'xhci' == test.rem_disks_xhci[disk]):
+ print("\t\tDevice Detected: SuperSpeed USB")
+ print("\t\tDriver Detected: xhci_hcd")
+ else:
+ return 1
#Pass is not assured!
if (not args.pass_speed or
avg_write_speed >= args.pass_speed):