projects
/
visomat-utils.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
visomat-data-downloader: fix a missing parenthesis in an output string
[visomat-utils.git]
/
src
/
visomat-data-downloader.c
diff --git
a/src/visomat-data-downloader.c
b/src/visomat-data-downloader.c
index
818473f
..
1059368
100644
(file)
--- a/
src/visomat-data-downloader.c
+++ b/
src/visomat-data-downloader.c
@@
-119,7
+119,7
@@
static void print_record_csv_compat(struct datetime *d, struct pressure *p)
printf("\n");
}
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)
static int decode_eeprom(unsigned char *buffer,
unsigned int len,
unsigned int user_mask)
@@
-156,6
+156,13
@@
static int decode_eeprom(unsigned char *buffer,
/* user_id and num_records take 3 bytes */
i += 3;
/* 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)
for (j = 0; j < num_records; j++) {
ret = extract_datetime(buffer + i, &d);
if (ret < 0)
@@
-321,7
+328,8
@@
int main(void)
ret = libusb_init(NULL);
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;
}
goto out;
}
@@
-349,7
+357,7
@@
int main(void)
if (ret < 0) {
fprintf(stderr, "libusb_set_configuration failed: %s\n",
libusb_error_name(ret));
if (ret < 0) {
fprintf(stderr, "libusb_set_configuration failed: %s\n",
libusb_error_name(ret));
- fprintf(stderr, "Cannot set configuration %
hhu
\n",
+ fprintf(stderr, "Cannot set configuration %
d
\n",
VISOMAT_CONFIGURATION);
goto out_libusb_close;
}
VISOMAT_CONFIGURATION);
goto out_libusb_close;
}
@@
-361,7
+369,7
@@
int main(void)
if (ret < 0) {
fprintf(stderr, "libusb_claim_interface failed: %s\n",
libusb_error_name(ret));
if (ret < 0) {
fprintf(stderr, "libusb_claim_interface failed: %s\n",
libusb_error_name(ret));
- fprintf(stderr, "Cannot claim interface %
hhu
\n",
+ fprintf(stderr, "Cannot claim interface %
d
\n",
VISOMAT_INTERFACE);
goto out_libusb_close;
}
VISOMAT_INTERFACE);
goto out_libusb_close;
}
@@
-378,7
+386,7
@@
int main(void)
}
if (current_configuration != VISOMAT_CONFIGURATION) {
}
if (current_configuration != VISOMAT_CONFIGURATION) {
- fprintf(stderr, "libusb configuration changed (expected: %
hhu, current: %hhu
\n",
+ fprintf(stderr, "libusb configuration changed (expected: %
d, current: %d)
\n",
VISOMAT_CONFIGURATION, current_configuration);
ret = -EINVAL;
goto out_libusb_release_interface;
VISOMAT_CONFIGURATION, current_configuration);
ret = -EINVAL;
goto out_libusb_release_interface;