[autotest] audio_facade: set input/output in set_chrome_active_node_type
Expose two arguments in set_chrome_active_node_type because bluetooth
input/output node types are both 'BLUETOOTH'.
BUG=chromium:552256
TEST=not used yet.
Change-Id: I7892409fd14059cbcf0e4c082a053b23e3e9b765
Reviewed-on: https://chromium-review.googlesource.com/312819
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Kalin Stoyanov <kalin@chromium.org>
diff --git a/client/cros/audio/cras_utils.py b/client/cros/audio/cras_utils.py
index d3c49a8..8de8a37 100644
--- a/client/cros/audio/cras_utils.py
+++ b/client/cros/audio/cras_utils.py
@@ -500,16 +500,21 @@
get_cras_control_interface().RemoveActiveInputNode(node_id)
-def get_node_id_from_node_type(node_type):
+def get_node_id_from_node_type(node_type, is_input):
"""Gets node id from node type.
@param types: A node type defined in CRAS_NODE_TYPES.
+ @param is_input: True if the node is input. False otherwise.
+
+ @returns: A string for node id.
+
+ @raises: CrasUtilsError: if unique node id can not be found.
"""
nodes = get_cras_nodes()
find_ids = []
for node in nodes:
- if node['Type'] == node_type:
+ if node['Type'] == node_type and node['IsInput'] == is_input:
find_ids.append(node['Id'])
if len(find_ids) != 1:
raise CrasUtilsError(