summaryrefslogtreecommitdiff
path: root/extra
Commit message (Collapse)AuthorAgeFilesLines
* usb_serial: fix console.py handling of --serialnoMatthew Blecker2022-09-161-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was trying to pass the optional "langid" arg to usb.util.get_string(), but was doing so as a positional argument, in the wrong position. This bug was papered over by a blanket "except:" clause that would fall back on not specifying langid. With older PyUSB versions an exception from the incorrect args would be triggered, thus the fallback was always used. PyUSB now returns garbage for the serial number from the incorrect args, so the serial number comparisons stopped working. The langid being specified was 256 / 0x100, which is in a reserved block, not specific to any real language. The get_string() invocation returns the correct serial number with or without that langid specified (using the args correctly), and servod never specifies langid in these lookups, so this removes use of langid entirely to match servod behavior and remove need for the try/except fallback. This also fixes another blanket "except:" to specify the exception it's actually intending to catch (IndexError). Finally, this adds printing of default option values in the command line help output, so that it's clear --device has a default value and will usually need to be specified too when using --serialno. (We should change or remove the default and make --device optional when using --serialno, but I'll leave that for another patch.) BRANCH=none BUG=b:243562728 TEST=With multiple servos plugged in, including multiple servo_v4p1, tested opening consoles via --serialno by itself, --device by itself, and the two options in conjunction. Signed-off-by: Matthew Blecker <matthewb@chromium.org> Change-Id: Idd731ce76c9ed9a2e067bca11ede42b782a94669 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3902449 Reviewed-by: Ziting Shen <zitingshen@google.com>
* i2c-pseudo: Add documentation in RST and MD formats.Matthew Blecker2022-09-163-5/+594
| | | | | | | | | | | | | | | | | | | | | | | | This supplements Documentation.txt, which is plain text as used by documentation in old Linux kernel versions, with Documentation.rst, which is reStructuredText as used in the latest versions of Linux. The plain text Documentation.txt remains and will be maintained as long as backport patches are maintained. Since Chromium OS source code browsing websites such as Gitiles and Code Search can render Markdown, but not reStructuredText, Documentation.md is included as well, generated using rst2md from nb2plots (https://github.com/matthew-brett/nb2plots) which uses Sphinx (https://www.sphinx-doc.org/). BRANCH=none BUG=b:129565355 TEST=viewed the markdown doc in Gitiles using Chrome Change-Id: I332ba9098a1379b2f56efbaab84ed5498ef43d34 Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3900487 Reviewed-by: Keith Haddow <haddowk@chromium.org> Commit-Queue: Keith Haddow <haddowk@chromium.org>
* Update license boilerplate text in source code filesMike Frysinger2022-09-1251-51/+51
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Reland "ec: Fix DEBUG "variable" in usb_updater Makefile"Brian Norris2022-09-062-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of commit 9bfe90b111b030419871c5035b4dc0063e2f8221 It had nothing to do with b/245028043 (wrong branch, doesn't affect gsctool) Original change's description: > ec: Fix DEBUG "variable" in usb_updater Makefile > > DEBUG is not the way to refer to a variable in a Makefile expression; > $(DEBUG) is. > > Also, make extra/rma_reset/Makefile consistent. > > Drop the EOF blank line to satisfy linter. > > BUG=none > TEST=build > BRANCH=none > > Change-Id: Ic71be497ca83041dfdedf63c10e7c74b38c05bc8 > Signed-off-by: Brian Norris <briannorris@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3872546 > Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> > Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> Bug: b:245028043 Change-Id: I2dfdf5f1ac3b20c4fafe323f5f63585f809e9dda Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3873805 Commit-Queue: Brian Norris <briannorris@chromium.org> Tested-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Revert "ec: Fix DEBUG "variable" in usb_updater Makefile"Yoshiki Iguchi2022-09-052-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9bfe90b111b030419871c5035b4dc0063e2f8221. Reason for revert: This breaks build of chromeos-cr50-dev: b/245028043 Bug: b/245028043 Original change's description: > ec: Fix DEBUG "variable" in usb_updater Makefile > > DEBUG is not the way to refer to a variable in a Makefile expression; > $(DEBUG) is. > > Also, make extra/rma_reset/Makefile consistent. > > Drop the EOF blank line to satisfy linter. > > BUG=none > TEST=build > BRANCH=none > > Change-Id: Ic71be497ca83041dfdedf63c10e7c74b38c05bc8 > Signed-off-by: Brian Norris <briannorris@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3872546 > Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> > Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> Bug: none Change-Id: I3695637fb72be8f6ead03b609b4ba0dba7e83452 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3872413 Reviewed-by: Jim Pollock <jmpollock@chromium.org> Tested-by: Jim Pollock <jmpollock@chromium.org>
* ec: Fix DEBUG "variable" in usb_updater MakefileBrian Norris2022-09-022-5/+4
| | | | | | | | | | | | | | | | | | | DEBUG is not the way to refer to a variable in a Makefile expression; $(DEBUG) is. Also, make extra/rma_reset/Makefile consistent. Drop the EOF blank line to satisfy linter. BUG=none TEST=build BRANCH=none Change-Id: Ic71be497ca83041dfdedf63c10e7c74b38c05bc8 Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3872546 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* ec: Switch black to 80 cols and reformat filesJeremy Bettis2022-07-2617-159/+517
| | | | | | | | | | | | | | | | | | | | Add pyproject.toml config file to set black to 80 columns. Remove column length overrides from other config files. Reformat python files to 80 cols. BRANCH=None BUG=b:238434058 TEST=presubmit/CQ Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I870a68f1bb751f4bad97024045f6e3075489e80f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3764071 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* ec: Fix some bad formatting and warningsJeremy Bettis2022-07-1320-119/+31
| | | | | | | | | | | | | | | | | | | | The black formatting revealed some odd formatting. Fixed all errors from cros lint. find . \( -path ./private -prune \) -o -name '*.py' -print | \ xargs cros lint -v |& grep ": E" BRANCH=None BUG=b:238434058 TEST=None Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Ia1d2e9cfb0cd2b7000d15b3b918d24881987673e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3749249 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* ec: Format all python files with black and isortJeremy Bettis2022-07-1220-6305/+6864
| | | | | | | | | | | | | | | | | | | find . \( -path ./private -prune \) -o -name '*.py' -print | xargs black find . \( -path ./private -prune \) -o -name '*.py' -print | xargs ~/chromiumos/chromite/scripts/isort --settings-file=.isort.cfg BRANCH=None BUG=b:238434058 TEST=None Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I63462d6f15d1eaf3db84eb20d1404ee976be8382 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3749242 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* trng: Rename rand to trng_randTom Hughes2022-07-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | The declaration for rand conflicts with the standard library declaration so rename it from "rand" to "trng_rand". This has the benefit of making it obvious when we're using the true random number generator. For consistency, this also renames init_trng/exit_trng to trng_init/trng_exit. This is a reland of commit a6b0b3554f59cc9b0c4aae9bff7dff075f2089a9. BRANCH=none BUG=b:234181908, b:237344361 TEST=./util/compare_build.sh -b all -j 120 => MATCH TEST=emerge-hatch ec-utils-test Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ic26890572cb9865275c866b65b0532c5ab029865 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3738978 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com>
* extra/ftdi_hostcmd/test_cmds.c: Format with clang-formatJack Rosenthal2022-07-061-159/+137
| | | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Tricium: disable Change-Id: Idbf9e30205e384c290cef42d8cd9bf45f7cda89d Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730178 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/usb_gpio/usb_gpio.c: Format with clang-formatJack Rosenthal2022-07-011-57/+37
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I00976ca4b072d2b63fc123b9aa28859caa6412b3 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730188 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/rma_reset/rma_reset.c: Format with clang-formatJack Rosenthal2022-07-011-75/+65
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ibb3b2bf57de9fa67b68c13d1111caa9ba2d7cb60 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730184 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/lightbar/input.c: Format with clang-formatJack Rosenthal2022-06-301-1/+1
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I545833c2b5c8c25b0f34da5277375729c9836a43 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730180 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/sps_errs/prog.c: Format with clang-formatJack Rosenthal2022-06-291-40/+22
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Iec0464940c67062c7ac8f2df08ef7e5b2e058e8b Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730185 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/lightbar/simulation.h: Format with clang-formatJack Rosenthal2022-06-291-17/+23
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I725be1b8c902f477705d1dc3663121c115716fdd Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730182 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/usb_updater/desc_parser.c: Format with clang-formatJack Rosenthal2022-06-291-7/+4
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I85737cb5b016e830d8b96b962b82ec4a276dc03e Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730190 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/i2c_pseudo/i2c-pseudo.c: Format with clang-formatJack Rosenthal2022-06-291-227/+263
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I350401a185e27bc976cfbf4d3c1d8e53cdc55927 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730179 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/usb_serial/raiden.c: Format with clang-formatJack Rosenthal2022-06-291-14/+11
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Icb5b66f4000902a76ebd4209af3008b2c83ca53f Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730189 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/lightbar/windows.c: Format with clang-formatJack Rosenthal2022-06-291-28/+21
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I0545f6f73077099ebe5d7a777561772ef3ccfddb Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730183 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/usb_updater/usb_updater2.c: Format with clang-formatJack Rosenthal2022-06-281-145/+125
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I08be6faa208b3cf6c62feaf9b4342c2e360943eb Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730191 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/lightbar/main.c: Format with clang-formatJack Rosenthal2022-06-281-48/+62
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I1c49fd1d51d8ea32d570ad51149116ad7e512d73 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730181 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/touchpad_updater/touchpad_updater.c: Format with clang-formatJack Rosenthal2022-06-281-87/+77
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ie427e3ee7843883b0b4c9337980ad1074da2a630 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730186 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* extra/usb_console/usb_console.c: Format with clang-formatJack Rosenthal2022-06-281-29/+26
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Idfbb6dea2a0516fd93b74a7b4bc038dfe84561ec Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730187 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* ec_commands: Drop VBNV read/write supportYu-Ping Wu2022-06-281-1/+0
| | | | | | | | | | | | | | | All devices using EC to store VBNV (Vboot nvdata) have reached their AUE. Remove all VBNV-related code. BUG=b:178689388 TEST=make build_cros_ec_commands BRANCH=none Cq-Depend: chromium:3725376 Change-Id: I85851b1404e3b6279ed4588e19db21738ad2f07c Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3724971 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* tigertool: cleanupNick Sanders2022-06-234-123/+117
| | | | | | | | | | | | | | | Fix serial number detect new python3.9 incompatibilities. cros lint to the extent possible BUG=b:216199797 TEST=./tigertest.py -c 10; servo_updater -b servo_v4 BRANCH=none Signed-off-by: Nick Sanders <nsanders@chromium.org> Change-Id: I2ec628389f63711a540223fc9004c9fff7155c1e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3615478 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* servo_updater: Add retries for flash2Yi Chou2022-06-031-2/+2
| | | | | | | | | | | | | A workaround for the remaining character in the USB buffer. BRANCH=None BUG=b:232156962 TEST=servo_updater -b servo_micro Signed-off-by: Yi Chou <yich@google.com> Change-Id: I0334172c0bc10d16201ff9c4d54d66c02ea283f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3688769 Reviewed-by: Brian Nemec <bnemec@google.com>
* task: change task_set_event return type to voidFabio Baltieri2022-06-022-3/+2
| | | | | | | | | | | | | | | No implementation does nothing other than return 0 on task_set_event(), change the return type to void so that the API is clear. BRANCH=none BUG=none TEST=cq dry run Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I88b20f53aa6dffa291ce78f4776888b21985f57f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3683769 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* ec console: Move from tostring to tobytes.Keith Haddow2022-05-311-1/+1
| | | | | | | | | | | | | | | | | | | | To string has been an alias for tobytes since python 3.2, in later version of python ( 3.9 and beyond ) this alias is removed. https://bugs.python.org/issue38916 This is a save change as all of chrome dev is on 3.6 or better. The error goes away but when using usb_console inside of a container I get device busy errors as the servod is running. BUG=b:234176994 TEST=built a servod with python 3.10 and tested usb_console. Change-Id: I1b00b0dd96413490936e20aa28067324c9d8e9a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3674943 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Auto-Submit: Keith Haddow <haddowk@chromium.org> Tested-by: Keith Haddow <haddowk@chromium.org> Commit-Queue: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* i2c-pseudo: build for kernels >5.15Peter Marheine2022-05-171-1/+1
| | | | | | | | | | | | | | | Linux 5.15 moved stdarg.h to linux/stdarg.h, and removed the old stdarg.h in commit c0891ac15f0428ffa81b2e818d416bdf3cb74ab6. Update the i2c-pseudo module to build on these newer kernels. BUG=none TEST=now builds on Linux 5.16.18 BRANCH=none Change-Id: I331cfc3c2bb7300b5f2c19d595214bfb1e9a8622 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3650292 Reviewed-by: Shou-Chieh Hsu <shouchieh@chromium.org>
* tigertool: fix rebootNick Sanders2022-04-225-30/+228
| | | | | | | | | | | | | | Fix command truncation issue and change reboot detection mechanism. Fix lint. BUG=b:216199797 TEST=./tigertest.py -c 10 BRANCH=none Signed-off-by: Nick Sanders <nsanders@chromium.org> Change-Id: I2a3f962c2bcc1d87a2c3e8ac7da89e99997f3b40 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3419581 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* usb_updater2: Read bInterfaceNumber correctly.Daisuke Nojiri2022-04-131-1/+1
| | | | | | | | | | | | | | | This patch makes find_interface use bInterfaceNumber explicitly instead of the i iterator, which could be different from the discovered interface number if there is no interface at index 0. BUG=b:229012657 BRANCH=None TEST=Run 'usb_updater2 -f' on Vell. Change-Id: I7e156eefad6729b5d568fb0e0308b93cdb78a2ea Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3584693 Reviewed-by: Parth Malkan <parthmalkan@google.com>
* Sweetberry: Update the powerlog command to use sudo.Michael Pishchagin2022-01-191-1/+1
| | | | | | | | | | | | | | | | | | Without sudo powerlog failed with "Access denied (insufficient permissions)". BRANCH=None BUG=None TEST=None Signed-off-by: Michael Pishchagin <mblsha@chromium.org> Change-Id: I1aeaf20f13179f49814a6b74074dcf9dd1103c45 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3400760 Tested-by: Michael Pishchagin <mblsha@google.com> Auto-Submit: Michael Pishchagin <mblsha@google.com> Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Commit-Queue: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Tested-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* servo_updater: Add clean reboot at the end of updating procedureLukasz Hajec2021-08-261-0/+3
| | | | | | | | | | | | | | | | | | | | In current state after firmware is updated we perform reboot and check if servo is in RO. Due to this check we need to reinitialize uart connection. This procedure takes resources from kernel driver and makes it impossible to use servo console from OS just after servo_updater. This patch adds additional reboot, it allows kernel driver to reconnect to servo console and use it. BRANCH=None BUG=b:196021317 TEST=run servo_updater.py, after the tool finishes job check if we can access servo EC via serial terminal using e.g. picocom /dev/ttyUSB0. Signed-off-by: Lukasz Hajec <lha@semihalf.com> Change-Id: Icebb1a2faa8803d13736ea241b894adaf146b433 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3111367 Reviewed-by: Matthew Blecker <matthewb@chromium.org> Commit-Queue: Matthew Blecker <matthewb@chromium.org>
* pylintrc: Copy Chromium OS platform2's configCraig Hesling2021-08-0218-0/+73
| | | | | | | | | | | | | | | | | | | | This requests that cros lint (and repo upload hook) use the new Chromium OS 4 space indent policy. Since legacy python scripts still use 2 space, I added pylint ignore statements to the individual files to disable indentation checking. Note: There are still valid pylint errors in some of these legacy scripts. BRANCH=none BUG=none TEST=cros lint util/*.py Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I439f5a87bc50f1f43a4996e574bbc0626922a88e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3064761 Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* extra/stack_analyzer: EC stack analyzer for Risc-v architecturetim2021-03-101-0/+100
| | | | | | | | | | | | | | | | Add the related stack instructions analysis for Risc-v architecture to calculate stack frame sizes of functions and find the maximum calling path with maximum stack usage in stack analyzer tool. BUG=b:181291750 BRANCH=none TEST=make BOARD=icarus analyzestack Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Change-Id: Ieb1ccc3c1631f990adf7dd556f3e876b1a142a71 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2731176 Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
* extra/util: replace deprecated sys_siglist with strsignalAdrian Ratiu2021-02-172-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Starting with Glibc 2.32: * The deprecated arrays sys_siglist, _sys_siglist, and sys_sigabbrev are no longer available to newly linked binaries, and their declarations have been removed from <string.h>. They are exported solely as compatibility symbols to support old binaries. All programs should use strsignal instead. https://sourceware.org/pipermail/libc-announce/2020/000029.html BUG=chromium:1171287 BRANCH=none TEST=Local builds on x86_64 / eve and arm / kevin. Sent SIGINT to iteflash and verified output. Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.corp-partner.google.com> Change-Id: I8b4deaf8743c806a9610863648b345be3b35e1b5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2698188 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org>
* servo_updater: print available versionRuben Rodriguez Buchillon2021-02-121-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces -p/--print to servo_updater. Rather than performing an update, it will print for the chosen board/channel what firmware is available. See TEST below for output. BRANCH=None BUG=b:179310743 TEST=servo_updater -b servo_micro -c alpha -p board: servo_micro channel: alpha firmware: servo_micro_v2.4.35-f1113c92b // showing py2 compatibility TEST=python2 /usr/lib64/python2.7/site-packages/servo_updater.py -b \ servo_micro --print -c alpha board: servo_micro channel: alpha firmware: servo_micro_v2.4.0-dc38d9bbb Change-Id: I9899e1cacc0496a46a41e94cc9355438a5abe491 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2674381 Reviewed-by: Brian Nemec <bnemec@chromium.org>
* servo_updater: firmware channel retrieval as a library serviceRuben Rodriguez Buchillon2021-02-121-1/+19
| | | | | | | | | | | | | | | | | | | | | This change introduces the ability of using servo_updater as a library to check whether a firmware string (e.g. the one currently read out from the servo device) belongs to a known channel. If so, the channel will be returned. If not, None is returned to indicate this is an unknown firmware string. This can then be used to warn the user to update, or inform them what channel they are currently running. BRANCH=None BUG=b:179310743 // This is performed with the CL that uses this: chromium:2661015 TEST=sudo servod -b soraka dut-control servo_micro_firmware_channel servo_micro_firmware_channel:stable Change-Id: I49e920c7c7977b7c05828f8464af973f538f7aeb Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2661021 Reviewed-by: Brian Nemec <bnemec@chromium.org>
* servo_updater: consolidate common code-pathRuben Rodriguez Buchillon2021-02-121-31/+41
| | | | | | | | | | | | | | | | | | | | | Commonly the users of servo_updater (as a script, or a file) care about the firmware version string in addition to knowing what the filename is, and the configuration is. These are used to print informational messages, or check whether an update is needed among other things. This change consolidates that logic by making sure that the version string is always extracted when possible. BRANCH=None BUG=b:179310743 TEST=sudo servod -b soraka // observe logs print the servo firmware version information TEST=sudo servo_updater --board servo_micro // observe no errors Change-Id: Id7cb8f53e5fc3e1f557d74445d49fcafbda851ad Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2661020 Reviewed-by: Brian Nemec <bnemec@chromium.org>
* servo_updater: introduce channelsRuben Rodriguez Buchillon2021-02-121-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces the ability to pull an update from a specific channel (i.e. a specific file). See the bug for details on this project, but basically the `servo-firmware` package now bundles multiple firmware in the system, all of which are tagged to belong to a 'channel'. The name of those files is then [board_name].[channel].bin. The updater then now supports the notion of requesting a specific channel to update, if the default (stable) is not desired. Like the previous CL it also leverages choices for argparse to ensure no unknown channels are requested. BRANCH=None BUG=b:179310743 TEST=servo_updater --help | grep channel -c {alpha,dev,prev,stable}, --channel {alpha,dev,prev,stable} TEST=sudo servo_updater --board servo_micro -c alpha Current servo_micro version is servo_micro_v2.4.35-f1113c92b Available servo_micro version is servo_micro_v2.4.35-f1113c92b No version update needed Cq-Depend: chromium:2674405 Change-Id: I88c301cc4ff0ac246cbfda6498c27a1fd23f722f Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2661019 Reviewed-by: Brian Nemec <bnemec@chromium.org>
* servo_updater: cleanup and choicesRuben Rodriguez Buchillon2021-02-041-7/+14
| | | | | | | | | | | | | | | This change has some minor cleanup and introduces the usage of 'choices' to the board argument, to stop errors on argument parsing already. BRANCH=None BUG=b:179310743 TEST=servo_updater --help | grep board -b {c2d2,servo_micro,servo_v4,servo_v4p1,sweetberry}, --board [...] Change-Id: I676a5250d4721a309eec4a50a585a5ed719095b6 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2661018 Reviewed-by: Brian Nemec <bnemec@chromium.org>
* docs: Run mdformat on all .md filesTom Hughes2021-01-284-129/+138
| | | | | | | | | | | BRANCH=none BUG=b:178648877 TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I0ac5581ba7bc512234d40dbf34222422afa9c725 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2650551 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* servo_updater.py: Make script more reliable and improve error reportingMichał Barnaś2021-01-211-10/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | Add verifying if jump to region was successful by executing sysinfo after every jump. Add retries if no response to command from servo was received. BUG=b:177673664 BRANCH=main TEST=Prepare a few firmware builds from different commits, to be able to verify if they were successfully flashed. Flash firmware using modified script from extra/usb_updater: sudo ./servo_updater.py -b servo_v4p1 -f <fw> Run servod to connect to servo console and execute command: version Check if both RO and RW sections have the same FW version. TEST=To check error handling, run servod in one terminal, and in another one try flashing firmware. There should be retries due to no response received. After 2-3 retries, close servod and flashing should automatically continue without errors. Signed-off-by: Michał Barnaś <mb@semihalf.com> Change-Id: Ic73e50592fdc5f0f8e2cd9cd2ab4f034ef17e4ec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633993 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Commit-Queue: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* stats_manager: formatting fix for md file outputRuben Rodriguez Buchillon2021-01-211-2/+3
| | | | | | | | | | | | | | | | | Minor formatting fix to make sure that .md files are \n terminated. Also a small change in the way we name the logger so that it derives the name directly from the class. BUG=b:174800621 BRANCH=None TEST=sudo servod -c kohaku_rev2_loc0.xml dut-power -t 3 // normal output Change-Id: I3e49068a7b0f3e8908fbcce6a13e083ce8e9216a Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2594689 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* touchpad_updater: implement 512 byte transferTing Shen2021-01-191-32/+76
| | | | | | | | | | | | | | | | | | | Migrate the touchpad probe/update logic from CL:2551939 to touchpad_updater. Also adjust the memory allocation on Zed to allow 512 byte packet. BUG=b:177250972 TEST=On coachz, update detachable fw and run `ec_touchpad_updater -p 504c -f 282.0_2.bin` BRANCH=master Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Icc7cec1f500dca04d6cdec5b66c10bcce05b67bd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2637304 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* usb_updater2: fix incorrect console outputTing Shen2021-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | argv[optind] is the index of next arg to be processed, what we want to print here is actually argv[optind - 1]. BUG=None TEST=Run `usb_updater2 -d 18d1:503c -p 208.0_2.0.bin` on Krane and check console output. Before this CL: read 65536(0x10000) bytes from (null) After: read 65536(0x10000) bytes from 208.0_2.0.bin BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I45f584672f9c264d350374b43a3dd074b4a4ff7f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2623990 Tested-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@chromium.org>
* task_set_event: remove the wait argumentDawid Niedzwiecki2020-12-142-4/+3
| | | | | | | | | | | | | | | | | | | | There is an option in the task_set_event function which force the calling task to wait for an event. However, the option is never used thus remove it. This also will help in the Zephyr migration process. BUG=b:172360521 BRANCH=none TEST=make buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ic152fd3d6862d487bcc0024c48d136556c0b81bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521599 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* servo_updater: make more robust on resetsRuben Rodriguez Buchillon2020-12-102-48/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | long-term, we need to pull this into hdctools, rather than reimplement everything twice. Short term, this is a fine solution. It essentially makes sure that 1. we only keep one pty/stm32uart/stm32usb object around for communication 2. we always reset it properly when it could need a reset e.g. when the stm32 is rebooting, or a new firmware was flashed 3. it expands the timeout for the chip to come back to 2s the tiny_servod will eventually also land in hdctools, though for now it just ensures that we can reset the pyusb communication without larger issues and a larger refactor. BUG=chromium:1152838 BRANCH=None // Timeout before change, runs after change TEST=sudo servo_updater --board servo_micro // Timeout before change, runs after change TEST=sudo servo_updater --board sweetberry // Timeout before change, runs after change TEST=sudo servo_updater --board servo_micro --force // to show the serialname support. This is a fake serial, and it gets stuck waiting TEST=sudo servo_updater -s MICRO-S-2009020022 --board servo_micro // to show the serialname support. This is a real serial and it proceeds TEST=sudo servo_updater -s MICRO-S-2009020022 --board servo_micro Change-Id: I747ca69881c13c1aadd8e90a35badecbf4e6a09e Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2580854 Reviewed-by: Otabek Kasimov <otabek@google.com> Reviewed-by: Garry Wang <xianuowang@chromium.org>
* stm32uart: add delay after readingRuben Rodriguez Buchillon2020-12-091-0/+3
| | | | | | | | | | | | | | | | | This implementation of the uart reading code lacks the fix inside hdctools that adds a delay here. Amend the code. BUG=chromium:1152838 BRANCH=None TEST=sudo servo_updater --board servo_micro TEST=sudo servo_updater --board sweetberry TEST=sudo servo_updater --board servo_micro --force Change-Id: I28f62f4553c726f1e63c7404508a5e59ce098990 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2580853 Reviewed-by: Garry Wang <xianuowang@chromium.org> Reviewed-by: Otabek Kasimov <otabek@google.com>