From e1d3986c78a172b4120056f03d4e2140bba0315b Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Thu, 14 Jan 2016 15:06:42 +0100 Subject: [PATCH] visomat-data-downloader: increase the eeprom buffer size Apparently the device can store up to 60 records per user, for 2 users, and each record is 20 bytes. Considering that the data has some header info like: M160...M260... the buffer must be at least: (20 * 60 * 2) + 8 + 2 = 2410 bytes Finally, the extra 2 bytes are the STX and ETX bytes. Increase the buffer size to 4096 bytes to be safe. Thanks-to: Cornelis Broeders --- src/visomat-data-downloader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/visomat-data-downloader.c b/src/visomat-data-downloader.c index a5405a4..b471dc9 100644 --- a/src/visomat-data-downloader.c +++ b/src/visomat-data-downloader.c @@ -315,8 +315,8 @@ static int get_response(libusb_device_handle *dev, #define visomat_device libusb_device_handle static int visomat_dump_eeprom(visomat_device *dev, unsigned int user_mask) { - /* Assuming an EEPROM of 1 KiB */ - uint8_t buffer[1024] = { 0 }; + /* Assuming an EEPROM of 4 KiB */ + uint8_t buffer[4096] = { 0 }; int ret; ret = send_command(dev, VISOMAT_CMD_DUMP_EEPROM); -- 2.1.4