Report vid and pid for hid-based touch controllers
Currently, pid is sometimes reported by individual touch updater
scripts. Given that vid and pid is useful for debugging purposes, there
is a need for a more persistent place to log the vid and pid. This
change adds an entry to the touch-report file that includes the vid, pid
and the updater tool to be run.
This CL addresses the issue only for hid based devices. A follow on CL
will tackle devices with custom drivers.
BUG=b:383639165
TEST=CQ
TEST=Run \
`cros build-packages --board=${BOARD} chromeos-base/touch_updater \
&& cros deploy ${DUT} chromeos-base/touch_updater \
&& ssh ${DUT} reboot` \
then validated vid and pid in firmware report file on DUT.
Change-Id: I58de2decbaa2eda906ee3a373d7d0c75812f50b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/touch_updater/+/6579856
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Henry Barnor <hbarnor@chromium.org>
Reviewed-by: Ray Xu <rayxu@google.com>
Tested-by: Henry Barnor <hbarnor@chromium.org>
diff --git a/common/scripts/chromeos-touch-common.sh b/common/scripts/chromeos-touch-common.sh
index 503c9df..d46aa74 100755
--- a/common/scripts/chromeos-touch-common.sh
+++ b/common/scripts/chromeos-touch-common.sh
@@ -492,3 +492,33 @@
json_fields="${json_fields} \"version\": \"${tool_version}\""
add_report_entry "${sysfs_path}" "${json_fields}"
}
+
+# Adds a report entry indicating that the updater has run.
+# Parameters:
+# sysfs_path: a path to the device in sysfs (see add_report_entry).
+# updater: a name identifying the updater in use.
+# name: the device name as reported by the device driver in sysfs.
+# vendor_id: the 16-bit vendor id for the HID device in hexadecimal format.
+# product_id: the 16-bit product id for the HID device in hexadecimal format.
+report_updater_run() {
+ local sysfs_path="${1}"
+ local updater
+ local name
+ local vendor_id=""
+ local product_id=""
+
+ updater="$(make_json_safe "${2}")"
+ name="$(make_json_safe "${3}")"
+ if [ -n "${4}" ]; then
+ vendor_id="$(make_json_safe "${4}")"
+ fi
+ if [ -n "${5}" ]; then
+ product_id="$(make_json_safe "${5}")"
+ fi
+
+ local json_fields="\"updater\": \"${updater}\","
+ json_fields="${json_fields} \"name\": \"${name}\","
+ json_fields="${json_fields} \"vendor_id\": \"${vendor_id}\","
+ json_fields="${json_fields} \"product_id\": \"${product_id}\""
+ add_report_entry "${sysfs_path}" "${json_fields}"
+}
diff --git a/docs/touch_fw_report.md b/docs/touch_fw_report.md
index 7481029..5371adb 100644
--- a/docs/touch_fw_report.md
+++ b/docs/touch_fw_report.md
@@ -69,6 +69,10 @@
represented by its checksum
* `flashed_config`: if an update or downgrade was *attempted* (whether
successful or not), the new config, typically represented by its checksum
+* `name`: a name for the device as reported by the kernel driver
+* `vendor_id`: the 16-bit HID vendor id for the device in hexadecimal format
+* `product_id`: the 16-bit HID product id for the device in hexadecimal format
+
Version numbers are strings, but readers of the file can assume that versions
are lexically ordered (e.g. version "1.2.3" is later than "1.2.0", and version
@@ -90,6 +94,8 @@
attempted, giving the status and the version of the new firmware.
* `report_initial_config` and `report_config_result` are the equivalents for
config updaters.
+* `report_updater_run` should be called by every firmware updater on every
+ run. Will usually be called before updater specific script is invoked.
See the comments in [the source file](../common/scripts/chromeos-touch-common.sh)
for the details of each call.
diff --git a/scripts/chromeos-touch-update-legacy.sh b/scripts/chromeos-touch-update-legacy.sh
index 690306a..070c167 100755
--- a/scripts/chromeos-touch-update-legacy.sh
+++ b/scripts/chromeos-touch-update-legacy.sh
@@ -37,11 +37,16 @@
local vendor_id="$1"
local product_id="$2"
local device_name="$3"
+ local device_path="${4}"
+ local updater_name="${5}"
# This log message is load-bearing, in that the touch_UpdateErrors test
# checks for this exact message to confirm that the updater has run.
logger -t "${LOGGER_TAG}" \
"Running updater for ${device_name} (${vendor_id}:${product_id})"
+ # Add a report entry that will persist even if log is rotated.
+ report_updater_run "${device_path}" "${updater_name}" "${device_name}" \
+ "${vendor_id}" "${product_id}"
}
# Determines if a device is a touch device based on the driver name. It matches
@@ -111,7 +116,8 @@
case "${vendor_id}" in
"${WACOM_VENDOR_ID_1}"|"${WACOM_VENDOR_ID_2}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_device}" "Wacom"
/opt/google/touch/scripts/chromeos-wacom-touch-firmware-update-legacy.sh \
-d "${i2c_device}" -p "${i2c_path}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
@@ -145,13 +151,15 @@
echo Update elan device: "${elan_device}"
case "${elan_device}" in
"touchpad")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_device}" "Elan Touchpad EEPROM I2C HID"
/opt/google/touch/scripts/chromeos-etphidiap-touch-firmware-update-legacy.sh \
-d "${i2c_device}" -p "${i2c_path}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
;;
"touchscreen")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${dev}" "Elan HID"
/opt/google/touch/scripts/chromeos-elan-hid-touch-firmware-update-legacy.sh \
-d "${dev}" -p "${product_id}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
@@ -162,55 +170,64 @@
esac
;;
"${SYNAPTICS_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "Synaptics"
/opt/google/touch/scripts/chromeos-synaptics-touch-firmware-update-legacy.sh \
-d "${hidname}" -p "${i2c_path}" -e "${dev}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
;;
"${WEIDA_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "Weida HID"
/opt/google/touch/scripts/chromeos-weida-hid-touch-firmware-update-legacy.sh \
-d "${i2c_device}" -p "${i2c_path}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
;;
"${GOOGLE_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "Google"
/opt/google/touch/scripts/chromeos-google-touch-firmware-update-legacy.sh \
-p "${i2c_path}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
;;
"${PIXART_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "PixArt"
/opt/google/touch/scripts/chromeos-pixart-hid-touch-firmware-update-legacy.sh \
-h "${hidname}" -i "${i2c_path}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
;;
"${ST_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "ST"
/opt/google/touch/scripts/chromeos-st-touch-firmware-update-legacy.sh \
-d "${i2c_device}" -p "${i2c_path}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
;;
"${EMRIGHT_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "EMRight"
/opt/google/touch/scripts/chromeos-emright-touch-firmware-update-legacy.sh \
-d "${hidname}" -p "${i2c_path}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
;;
"${ZINITIX_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "Zinitix"
/opt/google/touch/scripts/chromeos-zinitix-tp-firmware-update-legacy.sh \
-d "${hidname}" -p "${i2c_path}" -i "${product_id}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
;;
"${HIMAX_VENDOR_ID_1}"|"${HIMAX_VENDOR_ID_2}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "Himax HID"
/opt/google/touch/scripts/chromeos-himax-touch-firmware-update-legacy.sh \
-d "${i2c_device}" -p "${i2c_path}" -i "${product_id}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
;;
"${NVT_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "nvt_ts"
/opt/google/touch/scripts/chromeos-nvt-touch-firmware-update-legacy.sh \
-d "${hidname}" -p "${i2c_path}" -i "${product_id}" \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
@@ -219,25 +236,29 @@
local product_id_decimal=$((0x${product_id}))
if [ "${product_id_decimal}" -ge $((0x0000)) ] \
&& [ "${product_id_decimal}" -le $((0x2FFF)) ] ; then
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "Ilitek(tddi)"
/opt/google/touch/scripts/chromeos-ili-tddi-touch-firmware-update-legacy.sh \
-i "${product_id}" -p "${i2c_path}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
else
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "Ilitek(its)"
/opt/google/touch/scripts/chromeos-ili-its-touch-firmware-update-legacy.sh \
-p "${i2c_path}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
fi
;;
- "${PARADETECH_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ "${PARADETECH_VENDOR_ID}")
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "Paradetech"
/opt/google/touch/scripts/chromeos-paradetech-touch-firmware-update-legacy.sh \
-d "${hidname}" -p "${i2c_path}" -i "${product_id}" -r \
|| logger -t "${LOGGER_TAG}" "${device_name} firmware update failed."
;;
- "${FOCALTECH_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ "${FOCALTECH_VENDOR_ID}")
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${i2c_path}" "FocalTech"
/opt/google/touch/scripts/chromeos-focal-hid-touch-firmware-update-legacy.sh \
-d "${i2c_path}" -p "${product_id}" -r \
|| logger -t "${LOGGER_TAG}" "${hidname} firmware update failed."
@@ -271,19 +292,22 @@
case "${vendor_id}" in
"${CIRQUE_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${hidpath}" "Cirque"
/opt/google/touch/scripts/chromeos-cirque-touch-firmware-update-legacy.sh \
-p "${hidpath}" -i "${product_id}" -r \
|| logger -t "${LOGGER_TAG}" "${hidname} firmware update failed."
;;
"${SIS_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${hid_link_path}" "SiS"
/opt/google/touch/scripts/chromeos-sis-touch-firmware-update-legacy.sh \
-p "${hid_link_path}" -r \
|| logger -t "${LOGGER_TAG}" "${hidname} firmware update failed."
;;
"${G2TOUCH_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${hid_link_path}" "G2Touch"
/opt/google/touch/scripts/chromeos-g2touch-touch-firmware-update-legacy.sh \
-p "${hid_link_path}" -r \
|| logger -t "${LOGGER_TAG}" "${hidname} firmware update failed."
@@ -293,7 +317,8 @@
"pid ${product_id} should be supported as an i2c-hid device."
;;
"${GOODIX_VENDOR_ID}")
- log_updater_run "${vendor_id}" "${product_id}" "${device_name}"
+ log_updater_run "${vendor_id}" "${product_id}" "${device_name}" \
+ "${hid_link_path}" "Goodix"
/opt/google/touch/scripts/chromeos-goodix-touch-firmware-update-legacy.sh \
-d "${hidname}" -p "${hid_link_path}" -r \
|| logger -t "${LOGGER_TAG}" "${hidname} firmware update failed."