libftdi-git Archives

Subject: A library to talk to FTDI chips branch, master, updated. v1.0-6-gafb9082

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 14 Feb 2013 16:04:13 +0100 (CET)
The branch, master has been updated
       via  afb9082460cf8602b1843e1a698ec498e3d38d7b (commit)
      from  953a958ce0d7c74864c0fafe3a8644c400734ebf (commit)


- Log -----------------------------------------------------------------
commit afb9082460cf8602b1843e1a698ec498e3d38d7b
Author: Jarkko Sonninen <kasper@xxxxxx>
Date:   Thu Feb 14 16:02:32 2013 +0100

    Fix eeprom flags for eeprom build
    
    Original mail on libftdi mailinglist:
    -------------------------------------
    
       Hello,
    
    the eeprom_decode function sets struct ftdi_eeprom flags like this:
       eeprom->self_powered = buf[0x08] & 0x40;
    but the eeprom_build uses the flags this way:
       if (eeprom->self_powered == 1)
    as the result the bits won't be set. I suggest the patch below.
    
       - Jarkko Sonninen

-----------------------------------------------------------------------

Summary of changes:
 src/ftdi.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/ftdi.c b/src/ftdi.c
index 92190a0..5570bd4 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -2573,9 +2573,9 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
     // Bit 5: 1 if this device uses remote wakeup
     // Bit 4-0: reserved - 0
     j = 0x80;
-    if (eeprom->self_powered == 1)
+    if (eeprom->self_powered)
         j |= 0x40;
-    if (eeprom->remote_wakeup == 1)
+    if (eeprom->remote_wakeup)
         j |= 0x20;
     output[0x08] = j;
 
@@ -2595,9 +2595,9 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
         // Bit 0: 1 - In EndPoint is Isochronous
         //
         j = 0;
-        if (eeprom->in_is_isochronous == 1)
+        if (eeprom->in_is_isochronous)
             j = j | 1;
-        if (eeprom->out_is_isochronous == 1)
+        if (eeprom->out_is_isochronous)
             j = j | 2;
         output[0x0A] = j;
     }
@@ -2721,15 +2721,15 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
             else
                 output[0x01] &= ~HIGH_CURRENT_DRIVE;
 
-            if (eeprom->in_is_isochronous == 1)
+            if (eeprom->in_is_isochronous)
                 output[0x0A] |= 0x1;
             else
                 output[0x0A] &= ~0x1;
-            if (eeprom->out_is_isochronous == 1)
+            if (eeprom->out_is_isochronous)
                 output[0x0A] |= 0x2;
             else
                 output[0x0A] &= ~0x2;
-            if (eeprom->suspend_pull_downs == 1)
+            if (eeprom->suspend_pull_downs)
                 output[0x0A] |= 0x4;
             else
                 output[0x0A] &= ~0x4;
@@ -2747,7 +2747,7 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
                 output[0x00] |= HIGH_CURRENT_DRIVE_R;
             output[0x01] = 0x40; /* Hard coded Endpoint Size*/
 
-            if (eeprom->suspend_pull_downs == 1)
+            if (eeprom->suspend_pull_downs)
                 output[0x0A] |= 0x4;
             else
                 output[0x0A] &= ~0x4;
@@ -2797,7 +2797,7 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
             else
                 output[0x01] &= ~SUSPEND_DBUS7_BIT;
 
-            if (eeprom->suspend_pull_downs == 1)
+            if (eeprom->suspend_pull_downs)
                 output[0x0A] |= 0x4;
             else
                 output[0x0A] &= ~0x4;
@@ -2859,7 +2859,7 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
             else
                 output[0x01] &= ~(DRIVER_VCP << 4);
 
-            if (eeprom->suspend_pull_downs == 1)
+            if (eeprom->suspend_pull_downs)
                 output[0x0a] |= 0x4;
             else
                 output[0x0a] &= ~0x4;


hooks/post-receive
-- 
A library to talk to FTDI chips

--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread
  • A library to talk to FTDI chips branch, master, updated. v1.0-6-gafb9082, libftdi-git <=