Fix eeprog

This commit is contained in:
Jeremy Soller
2020-12-01 10:00:38 -07:00
parent 78ee2df236
commit 015c97a0a4
3 changed files with 12 additions and 3 deletions

3
you-ass-bee-see/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
eeprom.rom
eeprog-*/*.o
eeprog-*/eeprog

View File

@@ -72,7 +72,8 @@ static int i2c_write_3b(struct eeprom *e, __u8 buf[3])
int eeprom_open(char *dev_fqn, int addr, int type, int write_cycle_time, struct eeprom* e)
{
int funcs, fd, r;
unsigned long funcs;
int fd, r;
e->fd = e->addr = 0;
e->dev = 0;

9
you-ass-bee-see/usb4-pd.sh Normal file → Executable file
View File

@@ -1,6 +1,11 @@
#!/usr/bin/env bash
shopt -s nullglob
set -ex
gcc -o eeprom eeprom.c
./eeprom -f usb4-pd.rom -r
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}")"
make -C eeprog-0.7.6-tear12
sudo ./eeprog-0.7.6-tear12/eeprog "${I2C_DEV}" 0x50 -r 0 -o eeprom.rom