blob: a19318d02212570141e7b3e04964839bc9065b2e [file] [log] [blame]
Doug Anderson7a608302012-02-24 15:01:07 -08001# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2# Distributed under the terms of the GNU General Public License v2
3
4#
5# Original Author: The Chromium OS Authors <chromium-os-dev@chromium.org>
6# Purpose: Eclass for use by ebuilds that need to know the debug serial port.
7#
8[[ ${EAPI} != "4" ]] && die "Only EAPI=4 is supported"
9
10SERIAL_USE_PREFIX="serial_use_"
11ALL_SERIALPORTS=(
Liam McLoughlin8ae15e72012-07-11 15:12:15 -070012 ttyAMA{0..5}
Liam McLoughlin19107c42012-07-02 16:39:33 -070013 ttyO{0..5}
Doug Anderson7a608302012-02-24 15:01:07 -080014 ttyS{0..5}
15 ttySAC{0..5}
16)
17IUSE=${ALL_SERIALPORTS[@]/#/${SERIAL_USE_PREFIX}}
18
19# Echo the current serial port name
20get_serial_name() {
21 local item
22
23 for item in "${ALL_SERIALPORTS[@]}"; do
24 if use ${SERIAL_USE_PREFIX}${item}; then
25 echo ${item}
26 return
27 fi
28 done
29
30 die "Unable to determine current serial port."
31}