blob: a26677bcdc4ab7d7b5d1b379dab231ada0381cd9 [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}
Doug Anderson7a608302012-02-24 15:01:07 -080013 ttyS{0..5}
14 ttySAC{0..5}
15)
16IUSE=${ALL_SERIALPORTS[@]/#/${SERIAL_USE_PREFIX}}
17
18# Echo the current serial port name
19get_serial_name() {
20 local item
21
22 for item in "${ALL_SERIALPORTS[@]}"; do
23 if use ${SERIAL_USE_PREFIX}${item}; then
24 echo ${item}
25 return
26 fi
27 done
28
29 die "Unable to determine current serial port."
30}