/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include #include #include #include #include #include #include #include #include "battery.h" #include "comm-host.h" #include "compile_time_macros.h" #include "ec_flash.h" #include "ectool.h" #include "lightbar.h" #include "lock/gec_lock.h" #include "misc_util.h" #include "panic.h" #define GEC_LOCK_TIMEOUT_SECS 30 /* 30 secs */ const char help_str[] = "Commands:\n" " extpwrcurrentlimit\n" " Set the maximum external power current\n" " autofanctrl \n" " Turn on automatic fan speed control.\n" " backlight \n" " Enable/disable LCD backlight\n" " battery\n" " Prints battery info\n" " batterycutoff\n" " Cut off battery output power\n" " chargecurrentlimit\n" " Set the maximum battery charging current\n" " chargedump\n" " Dump the context of charge state machine\n" " chargecontrol\n" " Force the battery to stop charging or discharge\n" " chipinfo\n" " Prints chip info\n" " cmdversions \n" " Prints supported version mask for a command number\n" " console\n" " Prints the last output to the EC debug console\n" " echash [CMDS]\n" " Various EC hash commands\n" " eventclear \n" " Clears EC host events flags where mask has bits set\n" " eventclearb \n" " Clears EC host events flags copy B where mask has bits set\n" " eventget\n" " Prints raw EC host event flags\n" " eventgetb\n" " Prints raw EC host event flags copy B\n" " eventgetscimask\n" " Prints SCI mask for EC host events\n" " eventgetsmimask\n" " Prints SMI mask for EC host events\n" " eventgetwakemask\n" " Prints wake mask for EC host events\n" " eventsetscimask \n" " Sets the SCI mask for EC host events\n" " eventsetsmimask \n" " Sets the SMI mask for EC host events\n" " eventsetwakemask \n" " Sets the wake mask for EC host events\n" " fanduty \n" " Forces the fan PWM to a constant duty cycle\n" " flasherase \n" " Erases EC flash\n" " flashinfo\n" " Prints information on the EC flash\n" " flashprotect [now] [enable | disable]\n" " Prints or sets EC flash protection state\n" " flashread \n" " Reads from EC flash to a file\n" " flashwrite \n" " Writes to EC flash from a file\n" " gpioget \n" " Get the value of GPIO signal\n" " gpioset \n" " Set the value of GPIO signal\n" " hello\n" " Checks for basic communication with EC\n" " kbpress\n" " Simulate key press\n" " i2cread\n" " Read I2C bus\n" " i2cwrite\n" " Write I2C bus\n" " i2cxfer [write bytes...]\n" " Perform I2C transfer on EC's I2C bus\n" " keyscan \n" " Test low-level key scanning\n" " led | =...>\n" " Set the color of an LED or query brightness range\n" " lightbar [CMDS]\n" " Various lightbar control commands\n" " panicinfo\n" " Prints saved panic info\n" " port80flood\n" " Rapidly write bytes to port 80\n" " powerinfo\n" " Prints power-related information\n" " protoinfo\n" " Prints EC host protocol information\n" " pstoreinfo\n" " Prints information on the EC host persistent storage\n" " pstoreread \n" " Reads from EC host persistent storage to a file\n" " pstorewrite \n" " Writes to EC host persistent storage from a file\n" " pwmgetfanrpm\n" " Prints current fan RPM\n" " pwmgetkblight\n" " Prints current keyboard backlight percent\n" " pwmsetfanrpm \n" " Set target fan RPM\n" " pwmsetkblight \n" " Set keyboard backlight in percent\n" " readtest \n" " Reads a pattern from the EC via LPC\n" " reboot_ec [at-shutdown]\n" " Reboot EC to RO or RW\n" " rtcget\n" " Print real-time clock\n" " rtcset