blob: 24d34fdb8f6d3201b03e5c69cff1fa5d02f814ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
//
// Copyright 2017-2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include "eeprom.h"
#define N310_PID 0x4242
#define N300_PID 0x4240
#define E320_PID 0xe320
static void usrp_sulfur_eeprom_print_id(struct usrp_sulfur_eeprom *ep)
{
if (ntohs(ep->pid) == N310_PID)
printf("product=ni,n310-rev%x\n", ntohs(ep->rev)+1);
else if (ntohs(ep->pid) == N300_PID)
printf("product=ni,n300-rev%x\n", ntohs(ep->rev)+1);
else if (ntohs(ep->pid) == E320_PID)
printf("product=ni,e320-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);
}
|