| # 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. |
| |
| description "Touch firmware and config updater for Chromebooks" |
| author "chromium-os-dev@chromium.org" |
| |
| # This job has no main script so that it only runs once at boot. |
| # This will block the start of the first UI in order to do the fw/config |
| # update. |
| start on starting ui |
| |
| pre-start script |
| for dev in "/sys/bus/i2c/devices"/*; do |
| local driver_name="$(readlink -f ${dev}/driver | xargs basename)" |
| local device_name="$(cat ${dev}/name)" |
| |
| if [ "${driver_name}" = "i2c_hid" ]; then |
| local hidpath="$(echo ${dev}/*:*:*.*)" |
| local hidname="hid-$(echo ${hidpath##*/} | awk -F'[:.]' '{ print $2 "_" $3 }')" |
| |
| # make sure the HID driver successfully bound to the device |
| if [ ! -d "${hidpath}" ]; then |
| continue |
| fi |
| |
| /opt/google/touch/scripts/chromeos-synaptics-touch-firmware-update.sh -d "${hidname}" -r || |
| logger -t "$UPSTART_JOB" "${dev_name} firmware update failed." |
| continue |
| fi |
| |
| # Skip over any bogus devices |
| if [ ! -e "${dev}/update_fw" ]; then |
| continue |
| fi |
| |
| case "${driver_name}" in |
| raydium_ts) |
| /opt/google/touch/scripts/chromeos-raydium-touch-firmware-update.sh \ |
| -d "${device_name}" -r || |
| logger -t "$UPSTART_JOB" "${device_name} firmware update failed." |
| ;; |
| cyapa) |
| /opt/google/touch/scripts/chromeos-cyapa-touch-firmware-update.sh \ |
| -d "${device_name}" -r || |
| logger -t "$UPSTART_JOB" "${device_name} firmware update failed." |
| ;; |
| elan_i2c) |
| /opt/google/touch/scripts/chromeos-elan-touch-firmware-update.sh \ |
| -d "${device_name}" -n elan_i2c -r || |
| logger -t "$UPSTART_JOB" "${device_name} firmware update failed." |
| ;; |
| elants_i2c) |
| /opt/google/touch/scripts/chromeos-elan-touch-firmware-update.sh \ |
| -d "${device_name}" -n elants_i2c -r || |
| logger -t "$UPSTART_JOB" "${device_name} firmware update failed." |
| ;; |
| mip4_ts) |
| /opt/google/touch/scripts/chromeos-melfas-touch-firmware-update.sh \ |
| -d "${device_name}" -r || |
| logger -t "$UPSTART_JOB" "${device_name} firmware update failed." |
| ;; |
| wdt87xx_i2c) |
| /opt/google/touch/scripts/chromeos-weida-touch-firmware-update.sh \ |
| -d "${device_name}" -r || |
| logger -t "$UPSTART_JOB" "${device_name} firmware update failed." |
| /opt/google/touch/scripts/chromeos-weida-touch-config-update.sh \ |
| -d "${device_name}" || |
| logger -t "$UPSTART_JOB" "${device_name} config update failed." |
| ;; |
| atmel_mxt_ts) |
| # Both Atmel screens and pads use the same driver. Use the device name |
| # to differentiate the two |
| local fw_name="" |
| |
| case "${device_name}" in |
| *tp*|ATML0000*) |
| fw_name="maxtouch-tp.fw" |
| ;; |
| *ts*|ATML0001*) |
| fw_name="maxtouch-ts.fw" |
| ;; |
| *) |
| die "No valid touch device name ${device_name}" |
| ;; |
| esac |
| |
| # Atmel mXT touchpad firmware and config must be updated in tandem. |
| /opt/google/touch/scripts/chromeos-atmel-touch-firmware-update.sh \ |
| -d "${device_name}" -r -n "${fw_name}" || |
| logger -t "$UPSTART_JOB" "${device_name} firmware update failed." |
| /opt/google/touch/scripts/chromeos-atmel-touch-config-update.sh \ |
| -d "${device_name}" || |
| logger -t "$UPSTART_JOB" "${device_name} config update failed." |
| ;; |
| esac |
| done |
| end script |