1 # Copyright 2015 The Chromium OS Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 import logging 6 7 8 def map_afe_board_to_servo_board(afe_board): 9 """Map a board we get from the AFE to a servo appropriate value. 10 11 Many boards are identical to other boards for servo's purposes. 12 This function makes that mapping. 13 14 @param afe_board string board name received from AFE. 15 @return board we expect servo to have. 16 17 """ 18 KNOWN_SUFFIXES = ['_freon', '_moblab', '-cheets'] 19 BOARD_MAP = {'gizmo': 'panther'} 20 mapped_board = afe_board 21 if afe_board in BOARD_MAP: 22 mapped_board = BOARD_MAP[afe_board] 23 else: 24 for suffix in KNOWN_SUFFIXES: 25 if afe_board.endswith(suffix): 26 mapped_board = afe_board[0:-len(suffix)] 27 break 28 if mapped_board != afe_board: 29 logging.info('Mapping AFE board=%s to %s', afe_board, mapped_board) 30 return mapped_board 31