aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/tools/db-init.c
diff options
context:
space:
mode:
Diffstat (limited to 'mpm/tools/db-init.c')
-rw-r--r--mpm/tools/db-init.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/mpm/tools/db-init.c b/mpm/tools/db-init.c
index fdf8dcd87..20f71915e 100644
--- a/mpm/tools/db-init.c
+++ b/mpm/tools/db-init.c
@@ -8,14 +8,24 @@
#include <stdlib.h>
#include <stdio.h>
+int get_dt_compat(int rev)
+{
+ if (rev > 3)
+ return 3;
+
+ return rev;
+}
+
void usage(char *argv[])
{
printf("-- Usage -- \n");
- printf("%s slot pid rev serial#\n\n", argv[0]);
+ printf("%s slot pid rev serial [dt-compat]#\n\n", argv[0]);
printf("Example:\n");
printf("$ %s 0 0x0150 0 310A850\n",
argv[0]);
-
+ printf("or specifying a dt-compat explicitly:\n");
+ printf("$ %s 0 0x0150 0 310A850 3\n",
+ argv[0]);
}
@@ -23,15 +33,20 @@ int main(int argc, char *argv[])
{
struct usrp_sulfur_db_eeprom *ep;
int which_slot = 0;
+ u8 dt_compat = 0;
- if (argc != 5) {
+ if (argc < 5) {
usage(argv);
return EXIT_FAILURE;
}
+ if (argc >= 6)
+ dt_compat = atoi(argv[5]);
+
which_slot = atoi(argv[1]);
- ep = usrp_sulfur_db_eeprom_new(strtol(argv[2], NULL, 16), atoi(argv[3]), argv[4]);
+ ep = usrp_sulfur_db_eeprom_new(strtol(argv[2], NULL, 16), atoi(argv[3]), argv[4],
+ dt_compat ? dt_compat : get_dt_compat(atoi(argv[3])));
usrp_sulfur_db_eeprom_print(ep);
if (!which_slot)