Fix hanging firmware updater when device is unresponsive.

Previously the updater unconditionally read from the device. In
case of an unresponsive device this lead to a hanging process.
Since the updater is triggered by udevd the event queue of udevd
gets blocked which leads to followup problems - see the attached bug.

Now we check for the availibility of data (using select) prior to
starting to read. In case select runs into the one second timeout
we print an error message and exit the updater.

BUG=b:117422687
TEST=Deployed to local fizz box with one of the problematic devices
attached. sis_fw_updater exits after a second and the syslog shows
the error message.

Change-Id: If7ce402c10edd172265c02a7684195f7e7d38d23
Reviewed-on: https://chromium-review.googlesource.com/1297490
Commit-Ready: Daniel Fenner <dfenner@google.com>
Tested-by: Daniel Fenner <dfenner@google.com>
Reviewed-by: Stefan Adolfsson <sadolfsson@chromium.org>
1 file changed
tree: f8f5c025aaafb62a8eb703e7a1b554e8c01fbe2b
  1. conf/
  2. src/
  3. .gitignore
  4. common.mk
  5. LICENSE
  6. Makefile
  7. README.md
README.md

SiS Firmware Updater

Description

The code was proviced by SiS and modified by Google. Modifications include:

  • Cleaning the code according to Google C++ coding style. Eliminating compiling errors.
  • Adding a feature that the updater can take the device name from input parameters. Blinded search is only required when input device name is invalid.
  • Adding a feature that the updater will compare FW version before actual update. If the FW versions on device and in Chrome OS are same, the updater will terminate.
  • Adding a input flag specifying whether the device is in recovery mode (FW update fails last time). The flag value is determined by VID from udev rule.

Requirements

On Linux, should run as root.

Build

At the root of the repository: make.

Under Chrome OS development enviroment: emerge-${BOARD} sis-updater.

How to use

Just run ./sis-updater.