Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Unified Diff: devil/devil/utils/usb_hubs.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « devil/devil/utils/update_mapping.py ('k') | devil/docs/device_blacklist.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/utils/usb_hubs.py
diff --git a/devil/devil/utils/usb_hubs.py b/devil/devil/utils/usb_hubs.py
index a37cb3b47b56ea004f80e4e296634b4cab86fad6..5a65c5aa3693db53ff4013bea0b7ab663635d462 100644
--- a/devil/devil/utils/usb_hubs.py
+++ b/devil/devil/utils/usb_hubs.py
@@ -7,6 +7,11 @@ PLUGABLE_7PORT_LAYOUT = {1:7,
3:5,
4:{1:4, 2:3, 3:2, 4:1}}
+PLUGABLE_7PORT_USB3_LAYOUT = {1:{1:1, 2:2, 3:3, 4:4},
+ 2:5,
+ 3:6,
+ 4:7}
+
class HubType(object):
def __init__(self, id_func, port_mapping):
"""Defines a type of hub.
@@ -89,10 +94,47 @@ def _is_plugable_7port_hub(node):
return False
return '1a40:0101' in node.PortToDevice(4).desc
+# Plugable 7-Port USB-3 Hubs show up twice in the USB devices list; they have
+# two different "branches", one which has USB2 devices and one which has
+# USB3 devices. The "part2" is the "USB-2" branch of the hub, the
+# "part3" is the "USB-3" branch of the hub.
+
+def _is_plugable_7port_usb3_part2_hub(node):
+ """Check if a node is the "USB2 branch" of
+ a Plugable 7-Port USB-3 Hub (Model USB3-HUB7BC)
+ The topology of this device is a 4-port hub,
+ with another 4-port hub connected on port 1.
+ """
+ if '2109:2811' not in node.desc:
+ return False
+ if not node.HasPort(1):
+ return False
+ return '2109:2811' in node.PortToDevice(1).desc
+
+def _is_plugable_7port_usb3_part3_hub(node):
+ """Check if a node is the "USB3 branch" of
+ a Plugable 7-Port USB-3 Hub (Model USB3-HUB7BC)
+ The topology of this device is a 4-port hub,
+ with another 4-port hub connected on port 1.
+ """
+ if '2109:8110' not in node.desc:
+ return False
+ if not node.HasPort(1):
+ return False
+ return '2109:8110' in node.PortToDevice(1).desc
+
PLUGABLE_7PORT = HubType(_is_plugable_7port_hub, PLUGABLE_7PORT_LAYOUT)
+PLUGABLE_7PORT_USB3_PART2 = HubType(_is_plugable_7port_usb3_part2_hub,
+ PLUGABLE_7PORT_USB3_LAYOUT)
+PLUGABLE_7PORT_USB3_PART3 = HubType(_is_plugable_7port_usb3_part3_hub,
+ PLUGABLE_7PORT_USB3_LAYOUT)
def GetHubType(type_name):
if type_name == 'plugable_7port':
return PLUGABLE_7PORT
+ if type_name == 'plugable_7port_usb3_part2':
+ return PLUGABLE_7PORT_USB3_PART2
+ if type_name == 'plugable_7port_usb3_part3':
+ return PLUGABLE_7PORT_USB3_PART3
else:
raise ValueError('Invalid hub type')
« no previous file with comments | « devil/devil/utils/update_mapping.py ('k') | devil/docs/device_blacklist.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698