1#!/usr/bin/env python2 2 3from __future__ import absolute_import 4from __future__ import division 5from __future__ import print_function 6 7import argparse 8 9argparser = argparse.ArgumentParser( 10 description="Get the highest reported board temperature (all sensors) in " 11 "Celsius.") 12 13group = argparser.add_mutually_exclusive_group() 14group.add_argument("-m", "--maximum", 15 action="store_const", 16 const='Maximum', 17 dest="temperature_type", 18 help="Get the highest reported board temperature " 19 "from all sensors in Celsius.") 20args = argparser.add_argument("-v", "--verbose", 21 action="store_true", 22 help="Show temperature type and value.") 23argparser.set_defaults(temperature_type='all') 24args = argparser.parse_args() 25 26import common 27from autotest_lib.client.bin import utils 28 29TEMPERATURE_TYPE = { 30 'Maximum': utils.get_current_temperature_max, 31} 32 33def print_temperature(temperature_type): 34 if args.verbose: 35 print(temperature_type, end=' ') 36 print(TEMPERATURE_TYPE.get(temperature_type)()) 37 38if args.temperature_type == 'all': 39 for temperature_type in TEMPERATURE_TYPE.keys(): 40 print_temperature(temperature_type) 41else: 42 print_temperature(args.temperature_type) 43