libftdi: (tomj) applied status byte filtering patch
[libftdi] / src / ftdi.c
index 908d420..b3a2236 100644 (file)
@@ -56,18 +56,18 @@ int ftdi_init(struct ftdi_context *ftdi)
     /* All fine. Now allocate the readbuffer */
     return ftdi_read_data_set_chunksize(ftdi, 4096);
 }
-/* ftdi_select_interface
+/* ftdi_set_interface
    Call after ftdi_init
    Open selected channels on a chip, otherwise use first channel
-   0: all fine
-   1: unknown interface
+    0: all fine
+   -1: unknown interface
 */
-int ftdi_select_interface(struct ftdi_context *ftdi, enum ftdi_interface interface)
+int ftdi_set_interface(struct ftdi_context *ftdi, enum ftdi_interface interface)
 {
     switch (interface) {
     case INTERFACE_ANY:
     case INTERFACE_A:
-        /* ftdi_usb_open_desc cares to set the right index, depending on the found chip*/
+        /* ftdi_usb_open_desc cares to set the right index, depending on the found chip */
         break;
     case INTERFACE_B:
         ftdi->interface = 1;
@@ -473,7 +473,7 @@ int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size)
             ftdi->readbuffer_offset += 2;
             ret -= 2;
 
-            if (ret > 64) {
+            if (ret > 62) {
                 for (i = 1; i < num_of_chunks; i++)
                     memmove (ftdi->readbuffer+ftdi->readbuffer_offset+62*i,
                              ftdi->readbuffer+ftdi->readbuffer_offset+64*i,