From deccab5a1b90df299b7b194bfef9da046f8f319b Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 12 Jan 2018 17:11:05 -0800 Subject: mpm: Add EEPROM utilities for N310 Actually-written-by: Moritz Fischer --- mpm/tools/eeprom-id.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 mpm/tools/eeprom-id.c (limited to 'mpm/tools/eeprom-id.c') diff --git a/mpm/tools/eeprom-id.c b/mpm/tools/eeprom-id.c new file mode 100644 index 000000000..f19a17ca1 --- /dev/null +++ b/mpm/tools/eeprom-id.c @@ -0,0 +1,32 @@ +// +// Copyright 2017 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0 +// + +#include +#include +#include "eeprom.h" + +static void usrp_sulfur_eeprom_print_id(struct usrp_sulfur_eeprom *ep) +{ + if (ep->pid == 0x4242) + printf("product=ni,n310-rev%x\n", ntohs(ep->rev)+1); + else + printf("product=unknown-(%04x)\n", ntohs(ep->pid)); + + printf("serial=%s\n", ep->serial); +} + +int main(int argc, char *argv[]) +{ + struct usrp_sulfur_eeprom *ep; + + ep = usrp_sulfur_eeprom_from_file(NVMEM_PATH_MB); + if (!ep) + return EXIT_FAILURE; + + usrp_sulfur_eeprom_print_id(ep); + + free(ep); +} -- cgit v1.2.3