libftdi: (tomj) added EEPROM building fix from Daniel Kirkham (Melbourne, Australia)
[libftdi] / ftdi / ftdi.c
index 01d8f1a..fb2adbf 100644 (file)
@@ -216,6 +216,11 @@ int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size) {
     int ret = 1;
     int offset = 0;
 
+    if (size != 0 && size % 64 != 0) {
+           ftdi->error_str = "Sorry, read buffer size must currently be a multiple (1x, 2x, 3x...) of 64";
+            return -2;
+    }
+
     while (offset < size && ret > 0) {
        ret = usb_bulk_read (ftdi->usb_dev, 0x81, readbuf, 64, ftdi->usb_timeout);
        // Skip FTDI status bytes
@@ -438,7 +443,7 @@ int ftdi_eeprom_build(struct ftdi_eeprom *eeprom, unsigned char *output) {
     output[0x13] = serial_size*2 + 2;
 
     // Dynamic content
-    output[0x14] = manufacturer_size;
+    output[0x14] = manufacturer_size*2 + 2;
     output[0x15] = 0x03;       // type: string
     
     i = 0x16, j = 0;
@@ -524,4 +529,3 @@ int ftdi_erase_eeprom(struct ftdi_context *ftdi) {
 
     return 0;
 }
-