diff --git a/lpc111x-isp/lpc111x.c b/lpc111x-isp/lpc111x.c index 3f28ba5..ff92bdc 100644 --- a/lpc111x-isp/lpc111x.c +++ b/lpc111x-isp/lpc111x.c @@ -225,7 +225,7 @@ static const struct device { static void identify(void) { const char *res; - unsigned id; + unsigned id, serial[4]; res = dialog_rc(100, "J"); if (sscanf(res, "%u", &id) != 1) { @@ -233,12 +233,21 @@ static void identify(void) exit(1); } + res = dialog_rc(100, "N"); + if (sscanf(res, "%u %u %u %u", + serial, serial+1, serial+2, serial+3) != 4) { + fprintf(stderr, "N: cannot parse serial number\"%s\"\n", res); + exit(1); + } + for (device = devices; device->name; device++) if (device->id == id) { if (!quiet) - fprintf(stderr, "%s (0x%04x %04x) %d kB\n", + fprintf(stderr, "%s (0x%04x %04x) %d kB " + "serial %08x.%08x.%08x.%08x\n", device->name, id >> 16, id & 0xffff, - device->flash_kb); + device->flash_kb, + serial[0], serial[1], serial[2], serial[3]); return; }