blob: 48e6be3687fa5bfc51fcfce0fea4feaf53f57b1f [file] [log] [blame]
Mike Frysingerd03e6b52019-08-03 12:49:01 -04001#!/usr/bin/env python2
Po-Hsien Wang6dadbab2017-05-08 15:56:10 -07002
3import argparse
4
5argparser = argparse.ArgumentParser(
6 description="Get the highest reported board temperature (all sensors) in "
7 "Celsius.")
8
9group = argparser.add_mutually_exclusive_group()
10group.add_argument("-m", "--maximum",
11 action="store_const",
12 const='Maximum',
13 dest="temperature_type",
14 help="Get the highest reported board temperature "
15 "from all sensors in Celsius.")
Po-Hsien Wang6dadbab2017-05-08 15:56:10 -070016args = argparser.add_argument("-v", "--verbose",
17 action="store_true",
18 help="Show temperature type and value.")
19argparser.set_defaults(temperature_type='all')
20args = argparser.parse_args()
21
22import common
23from autotest_lib.client.bin import utils
24
25TEMPERATURE_TYPE = {
Po-Hsien Wang6dadbab2017-05-08 15:56:10 -070026 'Maximum': utils.get_current_temperature_max,
27}
28
29def print_temperature(temperature_type):
30 if args.verbose:
31 print temperature_type,
32 print TEMPERATURE_TYPE.get(temperature_type)()
33
34if args.temperature_type == 'all':
35 for temperature_type in TEMPERATURE_TYPE.keys():
36 print_temperature(temperature_type)
37else:
38 print_temperature(args.temperature_type)