summaryrefslogtreecommitdiff
path: root/extra
Commit message (Collapse)AuthorAgeFilesLines
* gsctool: fix version string generation and processingVadim Bendebury2019-02-192-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Function reporting the version of the gsctool expects the VERSION variable generated by ./util/getversion.sh utility to start with a single underscore without a prefix. But the utility could be adding various prefixes to the VERSION string depending on the environment variable settings. Those settings are irrelevant for gsctool, it should ignore the prefix up to the first underscore character found in the VERSION string. Also, modify the Makefile to make sure the build date reported by getversion.sh is accurate. BRANCH=none BUG=chromium:932361 TEST=built gsctool and checked version reporting: make BOARD=cr50 CR50_DEV=1 gsctool ./gsctool -v Version: v2.0.821+e890d0974 tpm2:v0.0.320-e987095 \ cryptoc:v0.0.10-b256f39, built on 2019-02-15 10:25:08 \ by vbendeb@eskimo.mtv.corp.google.com Change-Id: I5fb6c4aa1dea6e857fffc7ec5e5a599d61175044 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1474736 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* console.py: Handle non-TTY input (e.g. piped input), and other improvements.Matthew Blecker2019-02-081-69/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes: - Do not assume stdin input is a TTY. Only attempt to manipulate terminal settings when connected to an actual terminal. - Exit upon EOF. This is mostly relevant for non-TTY input, e.g. piped input, though this is not conditioned on TTY-ness. - For non-TTY inputs, sleep before exiting after EOF, in order to allow for for reading a response from the USB console device (e.g. from the Servo). The sleep time is configurable by -S / --notty-exit-sleep command line option, default 0.2 seconds. - Replace os.sleep(0.1) busy loop with waiting on a threading.Event. - Print a newline character upon exit so that a user's shell prompt will not be printed mid-line. BRANCH=none BUG=b:123727520 TEST=I tested handling of non-TTY input by piping Servo v4 console commands such as: $ echo version | ./console.py -d 18d1:501b $ echo reboot | ./console.py -d 18d1:501b With this change, console.py now exits on its own after sending the piped command. Previously when given piped input it would lose the first character of the input due to the attempt to change TTY settings, then it would wait indefinitely for ctrl+c or other signal, and finally it would traceback upon ctrl+c. I tested handling of TTY input in the usual manner, without redirecting stdin. That still works smootly, exits without error upon ctrl+c, and no longer causes the next shell prompt to start mid-line. Change-Id: I894a40a4409b0c422b82158f452f81943277285d Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1459139 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* powerlog: Don't hijack logger when import as modulePuthikorn Voravootivat2019-01-291-5/+7
| | | | | | | | | | | BRANCH=master BUG=b:112865585,b:123259683 TEST=No log spam when import as module from autotest Change-Id: I7ced102bbb893bc1baa88c625b8c7279a1e32677 Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1437515 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
* servo_updater: include sweetberry into servo_updater logicRuben Rodriguez Buchillon2019-01-032-7/+6
| | | | | | | | | | | | | | | | | | | This change allows for sweetberry to be a valid configuration for servo_updater BRANCH=None BUG=b:120449224 TEST=manual testing sudo servod_updater --board sweetberry ... ... update complete image updated Change-Id: If6a9113beb89ae8b58c70e959a77c9bb9f00607d Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1369506 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* usb_updater2: increase send timeout to 2sRuben Rodriguez Buchillon2018-12-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | To 'successfully' flash sweetberry the 1s timeout is not sufficient. Increase to 2s. BRANCH=None BUG=b:120449224 TEST=manual test sudo servo_updater --board sweetberry ... offset: writable at 0x40000 sending 0xb580 bytes to 0x40000 ------- update complete image updated ... Change-Id: I38bf8c852caf97069fcf67f4b77f9c0a30008235 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1369507 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* gsctool: Add commands to set sn bits.Louis Collard2018-12-061-1/+146
| | | | | | | | | | | | | | | | | | Adds two commands to set sn bits, and increment sn rma count. These commands will be used in factory and RMA flows. 'gsctool -S 0x123:0x456:0x789' can be used to set sn bits 'gsctool -R <0-7>' can be used to increment rma count BUG=chromium:905408 BRANCH=none TEST=local manual tests on soraka Change-Id: Iefb2076d5f53105ab36e84973d68f571b9626501 Signed-off-by: Louis Collard <louiscollard@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1347831 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* gsctool: verbose flag should print debug messagesJoel Kitching2018-12-031-8/+11
| | | | | | | | | | | | | | | | | Currently the verbose flag is stored in `verbose_mode` but never used. Print conditionally on this flag within a new `debug` function. BUG=None TEST=try running various commands with --verbose check for verbose output BRANCH=master Change-Id: Iadaf1a91ea1b02b0638e6364077c2c148f26e03c Reviewed-on: https://chromium-review.googlesource.com/1351926 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* gsctool: correct a typoJoel Kitching2018-12-031-1/+1
| | | | | | | | | | | | BUG=None TEST=check for correct output with --help flag BRANCH=master Change-Id: Idf0448791e3d043313bc1291810d71d3f4846a6a Reviewed-on: https://chromium-review.googlesource.com/1351925 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* gsctool: fix in setting '--tpm_mode'.Namyoon Woo2018-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | b:119626285 reported the problem with '--tpm_mode'. $ gsctool -a --tpm_mode Unrecognized option: -m $ gsctool -a --tpm_mode enable TPM Mode: enabled (0) $ gsctool -a --tpm_mode disable TPM Mode: enabled (0) "tpm_mode" long opt should have 'has_arg' set to 'optional_argumenet', not 'required_argument'. Before this CL, --tpm_mode worked in a wrong way as reported in BRANCH=none BUG=b:119626285 TEST=manually and with autotest (crrev.com/c/1340640) as well. $ gsctool -a --tpm_mode TPM Mode: enabled (0) $ gsctool -a --tpm_mode enable TPM Mode: enabled (1) $ gsctool -a --tpm_mode disable TPM Mode: disabled (2) Change-Id: Ie11852925a21a3a3b8d9dda6092eac5040f1cd5c Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1340642 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* gsctool: explicitly set buffering type to line bufferedWei-Cheng Xiao2018-11-161-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | This CL allows gsctool outputs to be instantly piped and shown in crosh when crosh executes cr50-verify-ro.sh, which calls gsctool, indirectly via debugd. Program stdout buffering type by default changes from line buffered to block buffered if the output is redirected to a file or pipe. Since we are going to call gsctool from inside debugd (CL:1337190) and want to pipe the output instantly to the dbus request sender, the buffering type of gsctool needs to be explicitly set. BRANCH=none BUG=b:113893821 TEST=in crosh run verify_ro, which indirectly runs gsctool via debugd, and verify that output is instantly piped and shown in crosh. (see CL:1337190 for detailed output) Signed-off-by: Wei-Cheng Xiao <garryxiao@chromium.org> Change-Id: I515854a29e5e2ede0acc8c2d9e2c4df367a5062e Reviewed-on: https://chromium-review.googlesource.com/1337250 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Louis Collard <louiscollard@chromium.org>
* gsctool: fix RO_B version number output for debug Cr50 imagesWei-Cheng Xiao2018-11-131-2/+2
| | | | | | | | | | | | | | | | | | For cr50 debug images, the RO_B version number format should be -1.-1.-1. I previously changed the output format to unsigned int, which caused the outputted version to be UINT_MAX. BRANCH=none BUG=b:119223356 TEST=manually run gsctool on a soraka device $ gsctool -b cr50.dbg.prod RO_A:0.0.10 RW_A:0.3.10[00000000:00000000:00000000] RO_B:-1.-1.-1 RW_B:0.3.10[00000000:00000000:00000000] Signed-off-by: Wei-Cheng Xiao <garryxiao@chromium.org> Change-Id: I5f842d4d5e50f35effbd2e5269dfd6946746acc2 Reviewed-on: https://chromium-review.googlesource.com/1328661 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* gsctool: minor code pruning.Namyoon Woo2018-11-051-6/+5
| | | | | | | | | | | | | | Removed a redundant if-statement BRANCH=none BUG=none TEST=gsctool -i Board ID space: 41434245:bebcbdba:00007f7f Change-Id: Ie6a1237fb5d1dc6085c1680dc1b37a9b127511f0 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1315629 Reviewed-by: Bob Moragues <moragues@chromium.org>
* gsctool: add RO_B and RW_B back to the output of gsctool -bWei-Cheng Xiao2018-11-021-38/+27
| | | | | | | | | | | | | | | | | Previous change CL:1278414 removed RO_B and RW_B from gsctool -b output and broke cr50 tests. This CL adds them back. BRANCH=none BUG=b:118701324 TEST=manually run gsctool on a soraka device $ gsctool -b cr50.bin.prod RO_A:0.0.10 RW_A:0.3.10[00000000:00000000:00000000] RO_B:0.0.10 RW_B:0.3.10[00000000:00000000:00000000] Change-Id: I0d76052ef9b6e34c4c8f4be40ac48ed3559ef3ec Signed-off-by: Wei-Cheng Xiao <garryxiao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1308242 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* gsctool: Add options to print out RLZ codesBob Moragues2018-10-301-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This RLZ code is used by cr50-verify-ro.sh. The RLZ code selects the verify_ro db to use. BUG=b:90495590 BRANCH=none TEST=gsctool -i -M; gsctool -i -M -t Unit Test Rewults: localhost ~ # gsctool -i -M open_device 18d1:5014 found interface 3 endpoint 4, chunk_len 64 READY ------- BID_TYPE=4e425153 BID_TYPE_INV=b1bdaeac BID_FLAGS=00007f7f BID_RLZ=NBQS <-- CORRECT DUT RLZ localhost ~ # gsctool -i -M -t BID_TYPE=58574a45 BID_TYPE_INV=a7a8b5ba BID_FLAGS=00007f7f BID_RLZ=XWJE <-- CORRECT Test Device RLZ localhost ~ # Change-Id: I12fbca6885e3a1453544a1d379ad12ef3f6fd290 Signed-off-by: Bob Moragues <moragues@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1297034 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* gsctool: add machine output support (-M) to chip board ID (-i, -O)Wei-Cheng Xiao2018-10-254-16/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now gsctool can print out GSC board ID in a machine-friendly way. This allows other programs (e.g., debugd) to parse the output. This is the final CL that adds machine output support to gsctool during verify_ro migration. BRANCH=none BUG=None TEST=manually run gsctool -M -i and gsctool -O verify_ro.db -M on a soraka device connected with a naultilus and check the board ID part in the outputs. Sample output (the board ID part is identical in the outputs of both commands): BID_TYPE=5a534b4d BID_TYPE_INV=a5acb4b2 BID_FLAGS=00007f80 Signed-off-by: Wei-Cheng Xiao <garryxiao@chromium.org> Change-Id: Ia275806672c08841c5b5fcc7758d8e0c777b3fc9 Reviewed-on: https://chromium-review.googlesource.com/1286312 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Wei-Cheng Xiao <garryxiao@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* gsctool: add machine output support (-M) to FW image info (-b)Wei-Cheng Xiao2018-10-251-91/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now can print out FW versions and board ID in the image in a machine-friendly way. This allows other programs (e.g., debugd) to parse the output. Add equality check to the firmware versions and board IDs in slot A and B. Now gsctool prints out an error message to stdout if the contents do not match; otherwise, it prints out only one copy of the contents instead of two. Sample runs: $ gsctool -b cr50.bin.prod RO_A:0.0.10 RW_A:0.3.10[ABCD:00000000:00000000] $ gsctool -b cr50.bin.prod -M IMAGE_RO_FW_VER=0.0.10 IMAGE_RW_FW_VER=0.3.10 IMAGE_BID_STRING=ABCD IMAGE_BID_MASK=00000000 IMAGE_BID_FLAGS=00000000 BRANCH=none BUG=None TEST=manually run gsctool -M -b cr50.bin.prod and gsctool -b cr50.bin.prod on a soraka device connected with a naultilus. Outputs are as the examples above. Signed-off-by: Wei-Cheng Xiao <garryxiao@chromium.org> Change-Id: I1c4c5110fe236debb93b3db118abb4c922b98bdf Reviewed-on: https://chromium-review.googlesource.com/1278414 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Wei-Cheng Xiao <garryxiao@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* gsctool: add a cmd line option -M to gsctool to allow machine-friendly outputs.Wei-Cheng Xiao2018-10-241-8/+73
| | | | | | | | | | | | | | | | | | | | Add the option's support to remote firmware version output (-f). This allows other programs (e.g., debugd) to parse gsctool outputs without worrying about any future updates on current human-readable outputs. BRANCH=none BUG=None TEST=manually run gsctool -f -M on a soraka device connected with a nautilus. Sample output: RO_FW_VER=0.0.10 RW_FW_VER=0.3.10 Signed-off-by: Wei-Cheng Xiao <garryxiao@chromium.org> Change-Id: Ic6514a191b379d05acf2656e5e395d82086d93cd Reviewed-on: https://chromium-review.googlesource.com/1278073 Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* ec: Add macro to check if constant index is too largeGwendal Grignou2018-10-231-0/+2
| | | | | | | | | | | | | | | | | BUILD_ASSERT can only be used for declarative code, add a macro to check if a condition resolved at build time is true or not. Take advantage of compiler detection of division by zero error message. [-Werror=div-by-zero] BUG=none BRANCH=eve,nocturne TEST=compile, check error is detected when condition is not true. Change-Id: I4ab1ad4ae516c00c9e30e778dd81f18893ef1673 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1283969 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* cr50: CCD Info indicates whether all CCD capabilities are default.Namyoon Woo2018-10-111-1/+4
| | | | | | | | | | | | | | | | | CR50 provides whether CCD capabilities are default or not. Factory process can utilize this value instead of CCD cap bitmap information. Users can use either 'gsctool -I' or CR50 console command 'ccd'. BRANCH=cr50_tools BUG=b:117200472 TEST=manually set and clear the password using gsctool -a -F and check the result of gsctool -I. Change-Id: Ic6be2ce880476c3a73150fe0e29007dd6a7e328f Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1272190 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cr50: minor code revision with macros regarding CCD capabilities.Namyoon Woo2018-10-111-4/+6
| | | | | | | | | | | | | | | | | | | | Defined "Number of bits in CCD cap expression", "Bitmask for a CCD cap expression", and "Number of CCD cap expressions in a Byte," and replaced constant uses with macros in CR50 and gsctool codes. No binary size changes in either CR50 or gsctool. BRANCH=cr50_ccd BUG=none TEST=manually tested with gsctool -I and CR50 console command 'ccd'. Signed-off-by: Namyoon Woo <namyoon@chromium.org> Change-Id: If91305090444395b6a938f920f4e47e2acbba886 Reviewed-on: https://chromium-review.googlesource.com/1274007 Commit-Ready: Namyoon Woo <namyoon@chromium.org> Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* touchpad_st: make panel initialization synchronousWei-Han Chen2018-10-091-1/+1
| | | | | | | | | | | | | | | | the entire process would take up to 2 seconds. CQ-DEPEND=CL:1264236 BRANCH=nocturne BUG=b:117203130 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I0cdcdb8caf3b1d9cf6a5787b93bf8cdb13832a74 Reviewed-on: https://chromium-review.googlesource.com/1264237 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* cr50_rma_open: check ccd open capabilitiesMary Ruthven2018-09-261-4/+16
| | | | | | | | | | | | | | | | | | OpenNoDevMode and OpenFromUSB will be set to Always during rma unlock. This will make open accessible from usb without dev mode. Update the testlab enable part of the script to check these before telling the user to enter dev mode. BUG=none BRANCH=none TEST=none Change-Id: I69fb7cdb9e33aa21ae1537e935046529c987edbc Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1208228 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* servo_updater: account for versions starting with v2Vadim Bendebury2018-09-221-3/+6
| | | | | | | | | | | | | | With resent base tag update the hardcoded version number pattern in servo_updater.py needs to be adjusted. BRANCH=none BUG=b:112475211 TEST=TBD Change-Id: If3b18f563ff48eb98db95864d8f2298ead04495d Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1237714 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* gsctool: refactor USB interfaceVadim Bendebury2018-09-173-171/+19
| | | | | | | | | | | | | | | | | | | | | | | | Communications with Cr50 exposed USB endpoints could be needed by other utilities, in particular, ./util/iteflash when it is extended to operate over Cr50. This patch moves USB interface functions into a separate file in the ./util directory and makes USB endpoint coordinates run time variables, so that the user of the interface can connect to various endpoints. Some refactoring is required to allow using the generic USB transfer function. BRANCH=none BUG=b:75976718 TEST=verified that gsctool still operates properly - updated a Cr50, read Cr50 version number, etc. Change-Id: I3d77a93932f5395fff0f5823f0dd79e1d1d670c8 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1198345 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* servo_updater: more informative error on failNick Sanders2018-09-081-1/+2
| | | | | | | | | | | | | | 'Can't detect updater version' is replaced with an error specifying the failed regex string. BRANCH=None BUG=None TEST=None Change-Id: Ia3a52ee27e31d0b4aab0d8f04d5cf5f346498c37 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1213556 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* usb_update: add extra command "UPDATE_EXTRA_CMD_CONSOLE_READ_*"Wei-Han Chen2018-09-031-16/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to corressponding host commands, we can read uart console buffer by following ways: A. Read from the beginning of buffer to the end of buffer: # 1. set snapshot before reading UPDATE_EXTRA_CMD_CONSOLE_READ_INIT while (true) { # 2. read 64 bytes back UPDATE_EXTRA_CMD_CONSOLE_READ_NEXT CONSOLE_READ_NEXT # 3. if (2) returns an empty string, break, otherwise, continue. } B. Mimic `dmesg -w` (keep reading new messages) while (true) { # 1. set snapshot before reading UPDATE_EXTRA_CMD_CONSOLE_READ_INIT while (true) { # 2. read 64 bytes back UPDATE_EXTRA_CMD_CONSOLE_READ_NEXT CONSOLE_READ_RECENT # 3. if (2) returns an empty string, break, otherwise, continue. } } Add argument `-l` to usb_updater2, which will perform (B). Note that the update interface will be occupied while `usb_updater2 -l` is still running, so you can't use other updater command at the same time. BRANCH=none BUG=b:112877237 TEST=test on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I8d2010f84602ca6b84034a0cabe42ae7441614e0 Reviewed-on: https://chromium-review.googlesource.com/1177293 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* gsctool: Reject empty authorization codeCheng-Han Yang2018-08-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing empty auth code causes cr50 to generate challenge instead of verifying the auth code. Change to return an error when the auth code is empty. BUG=b:112881027 TEST=make gsctool; manually test on DUT BRANCH=none [Before fix] localhost $ gsctool -a -r Challenge: <80 characters challenge string> (Wait for 10 seconds) localhost $ gsctool -a -r "" Processing response...RMA unlock succeeded. [After fix] localhost $ gsctool -a -r Challenge: <80 characters challenge string> (Wait for 10 seconds) localhost $ gsctool -a -r "" Empty response. Change-Id: Ifc2760176ff620dd45c5d62ced117c808ce1f111 Signed-off-by: Cheng-Han Yang <chenghan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1192822 Commit-Ready: Cheng-Han Yang <chenghan@chromium.org> Tested-by: Cheng-Han Yang <chenghan@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Move fuzzing tests into a fuzz subfolder.Allen Webb2018-08-222-2/+2
| | | | | | | | | | | | | BRANCH=none CQ-DEPEND=CL:*664115 BUG=chromium:876582 TEST=make -j buildall && make -j buildfuzztests Change-Id: Iade5e5138f495e6b3b99ec16f1a467861ade5537 Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1180179 Reviewed-by: Mattias Nissler <mnissler@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* stack_analyzer_unittest: Unit test of analyze disassembly for Andes instructionstabilize-10985.Btim2018-08-201-2/+100
| | | | | | | | | | | | | | | | | | | | | | | | | Write a rough disassembly with Andes instruction in stack_analyzer_unittest.py which rough disassembly is analyzed by stack_analyzer.py to get some results. If these results are the same with expect results, the unit test will pass. In the rough disassembly, the file format is added in the second line, because the stack analyzer will be looking for the word of 'arm' or 'nds' in the line, and then get the corresponding Analyzer class. BUG=b:111746842 BRANCH=none TEST=./extra/stack_analyzer/run_tests.sh Change-Id: I3acbfb199f762a4e89ea95f6254628871a5beb5d Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1174331 Commit-Ready: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Tested-by: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* stack_analyzer: EC stack analyzer for Andes instruction architecturetim2018-08-201-38/+194
| | | | | | | | | | | | | | | | | | | | | Add the related stack instructions analysis for Andes architecture to calculate stack frame sizes of functions and find the maximum calling path with maximum stack usage in stack analyzer tool. The second line in each disassembly will present this core architecture, so we can be looking for the word of 'arm' or 'nds' in the line and then get the corresponding Analyzer class. BUG=b:111746842 BRANCH=none TEST=make BOARD=${BOARD} SECTION=RO or RW analyzestack Change-Id: I8414920ddee97ce913519ef878f770e6e3118ef7 Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1174332 Commit-Ready: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Tested-by: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* usb_updater2: pretty print touchpad_infoWei-Han Chen2018-08-151-2/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | e.g. on whiskers, the command will behave like: > usb_updater2 -d 18d1:5030 --tp_info < ... < status: 0x00 < vendor: 0x0483 < fw_address: 0x80000000 < fw_size: 0x00020000 < allowed_fw_hash: < 20 0f eb 01 98 34 cf 86 8b 4e 94 1f 51 41 e7 64 < e1 0c 4f ac 88 bd 97 1c 79 ae c5 74 e3 0b 14 6d < id: 0x3936 < fw_version: 0x0011 < fw_fw_checksum: 0xb49f BRANCH=none BUG=b:70482333 TEST=manually on device Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: Iffe6720eec33cc57498cdab15ac2e132fdd76808 Reviewed-on: https://chromium-review.googlesource.com/1175506 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* sweetberry: format README, clarify detailsMengqi Guo2018-08-111-92/+138
| | | | | | | | | | | | | | Changing powerlog.README.md(orginally board.README) format to md. Adding details, making clarifications. BRANCH=None BUG=b:111318462 TEST=None Change-Id: Ic617d3da9518708560501be2786031dbd432ffe4 Signed-off-by: Mengqi Guo <mqg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1171503 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* Sweetberry: rename board.README to powerlog.README.mdMengqi Guo2018-08-101-0/+0
| | | | | | | | | | | | | | This CL only changes the file name. Next CL changes the file content. Separating into 2 CLs for easier diff. BRANCH=None BUG=b:111318462 TEST=None Change-Id: I8f8044e97b718270eb477dc29ba7e9e2c419db8c Signed-off-by: Mengqi Guo <mqg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1171599 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* cr50_rma_open: update for new open requirementsMary Ruthven2018-08-021-13/+71
| | | | | | | | | | | | | | | | | | | | Cr50 can only be opened from the AP and the device has to be in dev mode before open can be run. Update cr50_rma_open to require dev mode and run ccd open from the AP. 0.3.9 will have ccd in the prod image. Update the script, so it can enable testlab mode on prod images. BUG=none BRANCH=none TEST=run rma open process with 0.4.9 Change-Id: If14851a274233b471f8de86c9ed2a2b4808d131b Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1157182 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* stats_manager: more informative nan summary outputRuben Rodriguez Buchillon2018-08-012-1/+39
| | | | | | | | | | | | | | | | | Now for the formatted output string, if any value a domain is NaN, the domains gets tagged with a * and a help text gets added at the end of the summary to highlight this issue. CQ-DEPEND=CL:1140025 BRANCH=None BUG=chromium:806146, chromium:760267 TEST=unit tests added & pass Change-Id: I30791053bb1645065fa2bfd8305cc840a4a88031 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140032 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: accept_nan supportRuben Rodriguez Buchillon2018-08-012-16/+45
| | | | | | | | | | | | | | | | | | This CL introduces a flag to StatsManager that allows for 'NaN' values to be recorded inside StatsManager. The motivation here is that if a sample fails to record it might be more desirable to record a 'NaN' than to just skip the sample, to keep timelines correct, and to not hide errors in the test-run. Also adds necessary tests for that behavior. BRANCH=None BUG=chromium:806146, chromium:760267 TEST=unit tests still pass Change-Id: If17b7f52ba4a05e9e007c73bfa5d667fe36b74b3 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140031 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: add title banner pretty-printingRuben Rodriguez Buchillon2018-08-012-6/+33
| | | | | | | | | | | | | | If a title is supplied it now gets printed centralized on top of the summary when calling SummaryToString. BRANCH=None BUG=chromium:760267 TEST=unit tests are passing Change-Id: I7c59896ebac82d2ee7b632fd18350b9b4fff2c24 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140030 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: Avoid losing dataRuben Rodriguez Buchillon2018-08-012-5/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | In the case of multiple StatsManager, we might get data clobbered. That's particularly bad on long-running tests. This CL introduces two methods to make sure output files are unique in a directory. (1) on init, the user can supply a StatsManagerID (smid) that will be prepended to all output files. E.g. if the smid is 'ec' the summary will be stored at ec_summary.txt (2) should that fail because multiple StatsManagers are using the same smid supplied (or none were supplied) a simple file rotation is done where an integer suffix keeps getting incremented until the filename is unique. E.g. if summary.txt already exists, then summary1.txt will be created. This is not threadsafe at all so the user still have to use some caution to avoid clobbering their own data. BRANCH=None BUG=chromium:760267 TEST=unit tests still all pass Change-Id: I6cc083259362ee20e0242b94ac7cbb1228a06a7a Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140029 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: StatsManager returns file save locationsRuben Rodriguez Buchillon2018-08-012-19/+48
| | | | | | | | | | | | | | | | | Some test code currently duplicates knowledge by telling StatsManager where to save a file and then having to figure out where it stored the files again. This CL has StatsManager return the save locations to simplfy code. This potentially allows for informative logging on where information was stored. BRANCH=None BUG=chromium:760267 TEST=unit tests still pass Change-Id: I54b5873a4a3ddade9a73da0792c1947445759ad4 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140028 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: replace prefixes with flags in StatsManagerRuben Rodriguez Buchillon2018-07-313-51/+79
| | | | | | | | | | | | | | | | | | | | | | | | | StatsManager right now uses a '__' prefix to indicate that sample_msecs should be the first key in the summary. Additionally, there is a NOSHOW_PREFIX to potentially hide rails in the summary. This CL replaces that approach with constructor arguments to feed into the StatsManager what rails to hide, and the order to print a summary. This results in cleaner code, and less information leakage across classes as hiding & sorting becomes an implementation detail. It also adds two new unit tests to StatsManagerTest to verify this behavior works as intended. As a nit this CL also replaces AddValue with AddSample as Sample is more descriptive for the use-cases. BRANCH=None BUG=chromium:760267 TEST=manual testing, same output as before, and unittests still pass Change-Id: I52ca0d85c4600691fce8d4c74fd2a81fc4aa440f Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140027 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: remove expliting printing from stats_managerRuben Rodriguez Buchillon2018-07-313-62/+64
| | | | | | | | | | | | | | | | | | StatsManager is a library shared across some modules. It shouldn't print anything itself, but rather use logging & return a formatted summary that can be printed. Also take this opportunity to replace majority of explicit print calls in powerlog with logger module. BRANCH=None BUG=chromium:760267 TEST=manual testing, output as expected still for powerlog Change-Id: I0ed2ccaa45bbd1261119a1446110beadb075c1a2 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140026 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: prepare StatsManager to be a utility used in hdctoolsRuben Rodriguez Buchillon2018-07-274-34/+207
| | | | | | | | | | | | | | | | | | This is the first CL in a series of CLs to start using StatsManager in servo/hdctools (package depends on ec-devutils, as in this package). This CL: - beefs up StatsManager to handle unavailable units more gracefully - adds a few more tests to stats_manager_unittest.py - adds some minor unit testing for powerlog's file retrieval logic BRANCH=None BUG=chromium:760267 TEST=manual testing, unit tests still pass, powerlog still works Change-Id: Ifcdfcc482008484fbc21326c6f087ebf466c3e74 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140025 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* Revert "ec-devutils: update pyusb to 1.0.2"Nick Sanders2018-07-265-24/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 7d26ae49bffcf269df82df7d0fee00e8c3341166. pyusb 1.0.2 fails under load and locks up the usb endpoint. BUG=b:111658037, chromium:865482 TEST=while RES=$(dut-control ec_uart_en spi1_buf_en ); do echo ${RES}; done CQ-DEPEND=CL:1149509 Original change's description: > ec-devutils: update pyusb to 1.0.2 > > Pyusb interface has changed yet again. Patch calls to get_string > and usb.core.find. Modify ordering of detetch kernel driver > and avoid rereferencing endpoints. > > BRANCH=None > BUG=b:110907544 > TEST=emerge ec-devutils, run powerlog, usb_console, servo_updater > > CQ-DEPEND=CL:1119632 > > Signed-off-by: Nick Sanders <nsanders@chromium.org> > > Change-Id: I33df474ce3bb57d2e11c9f384ac013b51d210843 > Reviewed-on: https://chromium-review.googlesource.com/1125354 > Commit-Ready: Nick Sanders <nsanders@chromium.org> > Tested-by: Nick Sanders <nsanders@chromium.org> > Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Bug: b:110907544 Change-Id: I04f015b4924e7fee76ab0f1734267e8e2d14faaa Reviewed-on: https://chromium-review.googlesource.com/1150963 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* ec-devutils: update pyusb to 1.0.2Nick Sanders2018-07-065-13/+24
| | | | | | | | | | | | | | | | | | | | Pyusb interface has changed yet again. Patch calls to get_string and usb.core.find. Modify ordering of detetch kernel driver and avoid rereferencing endpoints. BRANCH=None BUG=b:110907544 TEST=emerge ec-devutils, run powerlog, usb_console, servo_updater CQ-DEPEND=CL:1119632 Signed-off-by: Nick Sanders <nsanders@chromium.org> Change-Id: I33df474ce3bb57d2e11c9f384ac013b51d210843 Reviewed-on: https://chromium-review.googlesource.com/1125354 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* kevin/gru: remove board almost completelyJett Rink2018-06-211-5/+5
| | | | | | | | | | | | | | | | Kevin/Gru are running out of space and we already have another ARM board on ToT for development. Remove maintenance burden of keeping them around. BRANCH=none BUG=chromium:851512 TEST=build_packages --board=kevin works with dependent CLs. CQ-DEPEND=CL:1102565,CL:*640973,CL:*640974 Change-Id: Ie7c65c7799acc9f4d266e40b29b37240fec345c6 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1100011 Reviewed-by: Ilja H. Friedel <ihf@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* gsctool: support for enabling/disabling TPM.Namyoon Woo2018-06-211-1/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces '-m' or '--tpm_mode' flag, which either enables or disables TPM. (chroot) gsctool -m enable open_device 18d1:5014 found interface 3 endpoint 4, chunk_len 64 READY ------- (chroot) gsctool --tpm_mode disable open_device 18d1:5014 found interface 3 endpoint 4, chunk_len 64 READY ------- BUG=b:77543596 BRANCH=gsctool TEST=manually Signed-off-by: Namyoon Woo <namyoon@google.com> Change-Id: I2feb8c51d4343a49f2f5d43291c304e3ad140057 Reviewed-on: https://chromium-review.googlesource.com/1106295 Commit-Ready: Namyoon Woo <namyoon@chromium.org> Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* Script to convert board file to servod config .py file.Ravi Chandra Sadineni2018-06-191-0/+85
| | | | | | | | | | | | | Script to convert .board file (input to powerlog.py) into .py file which can be used to generate .xml configuration file for servod. BUG=none BRANCH=none TEST= convert a .board file to .py file and verify it works. Change-Id: Ia67d1552c048895efee10d7a92830cfa25a51984 Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1105479 Reviewed-by: Puthikorn Voravootivat <puthik@google.com>
* gsctool: --password does not take an argBrian Norris2018-06-151-1/+1
| | | | | | | | | | | | | It takes the password on a stdin prompt. BRANCH=none BUG=none TEST=build; `gsctool --help` Change-Id: Ic16cb288507028bde4983d07bb6ab8b541f4a55b Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1103014 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* cr50_rma_open: add support for new challenge formatMary Ruthven2018-06-141-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | We started printing the challenge as generated challenge: ABHNDKD4Q7P6KHTKPN9E7...full challenge instead of ABHND KD4Q7 P6KHT KPN9E 7FSQX P249S PCP64 LVA8S W4XCH 7PZX6 FVWN5 QTUSK U3KBJ HH7RQ SEE5T JX78X add support for extracting the challenge from both formats. BUG=none BRANCH=none TEST=try to open tot image, 0.4.7 image, and 0.3.4 image Change-Id: I99a81f1f78284b21777242d27edaa474a0f12367 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1088130 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* gsctool: fix '-F disable' error handlingMary Ruthven2018-06-111-2/+7
| | | | | | | | | | | | | | | | | | The FACTORY_DISABLE vendor command could return VENDOR_RC_INTERNAL_ERROR in which case the EC error code is included in the response payload. Print both errors if rv is nonzero and the response size is 1. BUG=none BRANCH=none TEST=run 'gsctool -a -F disable' and make sure the vc and ec errors are printed correctly. Change-Id: Idc75d6d809865f1f3b685ca775ffbef9f6a1d860 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1096103 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>