Make usb4-pd safer

This commit is contained in:
Jeremy Soller
2020-12-01 12:14:53 -07:00
parent 7cadbfc4cf
commit 6d5ecfec8f

View File

@@ -1,12 +1,25 @@
#!/usr/bin/env bash
shopt -s nullglob
set -ex
MODEL="$(cat /sys/class/dmi/id/product_version)"
if [[ "${MODEL}" != "galp5" ]]
then
echo "${MODEL} is not galp5" >&2
exit 1
fi
I2C_PCI_SYSFS="/sys/bus/pci/devices/0000:00:15.1"
I2C_SYSFS="$(echo "${I2C_PCI_SYSFS}/i2c_designware."*"/i2c-"*)"
I2C_DEV="/dev/$(basename "${I2C_SYSFS}")"
if [[ ! -c "${I2C_DEV}" ]]
then
echo "failed to find I2C device" >&2
exit 1
fi
shopt -s nullglob
set -ex
cargo build \
--release \
--manifest-path ../tools/coreboot-collector/Cargo.toml \
@@ -23,7 +36,7 @@ sudo ./eeprog-0.7.6-tear12/eeprog \
-r 0:32768 \
-o eeprom.rom
echo sudo ./eeprog-0.7.6-tear12/eeprog \
sudo ./eeprog-0.7.6-tear12/eeprog \
"${I2C_DEV}" \
0x50 \
-16 \