Doug Anderson | 7a60830 | 2012-02-24 15:01:07 -0800 | [diff] [blame] | 1 | # 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 | |
| 10 | SERIAL_USE_PREFIX="serial_use_" |
| 11 | ALL_SERIALPORTS=( |
Liam McLoughlin | 8ae15e7 | 2012-07-11 15:12:15 -0700 | [diff] [blame] | 12 | ttyAMA{0..5} |
Liam McLoughlin | 19107c4 | 2012-07-02 16:39:33 -0700 | [diff] [blame] | 13 | ttyO{0..5} |
Doug Anderson | 7a60830 | 2012-02-24 15:01:07 -0800 | [diff] [blame] | 14 | ttyS{0..5} |
| 15 | ttySAC{0..5} |
| 16 | ) |
| 17 | IUSE=${ALL_SERIALPORTS[@]/#/${SERIAL_USE_PREFIX}} |
| 18 | |
| 19 | # Echo the current serial port name |
| 20 | get_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 | } |