printf("\n");
}
-/* TODO separate better decoding data from printing it */
+/* TODO: it would be better to separate decoding data from printing it */
static int decode_eeprom(unsigned char *buffer,
unsigned int len,
unsigned int user_mask)
/* user_id and num_records take 3 bytes */
i += 3;
+ /*
+ * when there are no records, there is a dummy byte
+ * which has to be consumed
+ */
+ if (num_records == 0)
+ i += 1;
+
for (j = 0; j < num_records; j++) {
ret = extract_datetime(buffer + i, &d);
if (ret < 0)
ret = libusb_init(NULL);
if (ret < 0) {
- fprintf(stderr, "libusb_init failed: %s\n", libusb_error_name(ret));
+ fprintf(stderr, "libusb_init failed: %s\n",
+ libusb_error_name(ret));
goto out;
}