diff options
author | Moritz Fischer <moritz.fischer@ettus.com> | 2018-07-12 15:57:17 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-07-12 16:46:10 -0700 |
commit | d31f463415e3bf6d021eb1fbbd3786214d63d68d (patch) | |
tree | ec03621d9d345a019843abd624c4154e7e47d779 /mpm/tools/eeprom-init.c | |
parent | b17790f8dee7be348ca951355fad3c8384e8594e (diff) | |
download | uhd-d31f463415e3bf6d021eb1fbbd3786214d63d68d.tar.gz uhd-d31f463415e3bf6d021eb1fbbd3786214d63d68d.tar.bz2 uhd-d31f463415e3bf6d021eb1fbbd3786214d63d68d.zip |
mpm: tools: eeprom-init: Fix issue with dt/mcu-compat number
Fix issue with dt-compat and mcu-compat numbers not working for
the case where 0 is a legitimate dt/mcu compat number.
This can happen if a Rev2 board (1 in hardware) shares a DT or
MCU firmware with the Rev1 board (0 in hardware).
Fixes 91a5518443f ("mpm: tools: Introduce dt-compat ...")
Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Diffstat (limited to 'mpm/tools/eeprom-init.c')
-rw-r--r-- | mpm/tools/eeprom-init.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mpm/tools/eeprom-init.c b/mpm/tools/eeprom-init.c index 87dc26a6b..0a410ae9e 100644 --- a/mpm/tools/eeprom-init.c +++ b/mpm/tools/eeprom-init.c @@ -41,8 +41,8 @@ void usage(char *argv[]) int main(int argc, char *argv[]) { struct usrp_sulfur_eeprom *ep, *ep2; - u16 dt_compat = 0; - u16 mcu_compat = 0; + u16 mcu_compat; + u16 dt_compat; if (argc < 6 || argc > 9) { usage(argv); @@ -57,11 +57,15 @@ int main(int argc, char *argv[]) if (argc >= 8) { dt_compat = strtol(argv[7], NULL, 0); printf("dt_compat=%u\n", dt_compat); + } else { + dt_compat = derive_dt_compat(atoi(argv[2])); } if (argc == 9) { mcu_compat = strtol(argv[8], NULL, 0); printf("mcu_compat=%u\n", mcu_compat); + } else { + mcu_compat = derive_mcu_compat(atoi(argv[2])); } if (pid < 0 || pid > 0xFFFF) { @@ -74,8 +78,8 @@ int main(int argc, char *argv[]) * anything software visible anymore */ ep = usrp_sulfur_eeprom_new(NULL, (u16) pid, atoi(argv[2]), argv[1], - argv[3], argv[4], argv[5], dt_compat ? dt_compat : derive_dt_compat(atoi(argv[2])), - mcu_compat ? mcu_compat : derive_mcu_compat(atoi(argv[2]))); + argv[3], argv[4], argv[5], dt_compat, + mcu_compat); usrp_sulfur_eeprom_print(ep); usrp_sulfur_eeprom_to_i2c(ep, "/dev/i2c-2"); |