libftdi-git Archives

Subject: A library to talk to FTDI chips branch, master, updated. v1.5-62-g5e67403

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 12 Jun 2025 22:21:51 +0200 (CEST)
The branch, master has been updated
       via  5e67403c4fb5536a2effe2e91181dd73a2cff91b (commit)
       via  2e714eec137f86ca1950457d8226d8cb9b71c495 (commit)
       via  d96dbea887373f26755e9873b4ab020f922b7c3b (commit)
       via  d31e3d5697eacbe87cd310b5bce615f3d8426cc0 (commit)
       via  c2b7c25e1272222c1719daea5761093fbc9c3010 (commit)
       via  c4962c38a1ab470fbdc835c231567bd582eb5a5a (commit)
      from  2a992306c0acf938b29fa0cd5fbc160e24424209 (commit)


- Log -----------------------------------------------------------------
commit 5e67403c4fb5536a2effe2e91181dd73a2cff91b
Author: Shawn Hoffman <business@xxxxxxxxxxxx>
Date:   Wed Apr 10 07:15:49 2024 -0700

    cmake: fix building static lib on windows/msvc
    
    include(GNUInstallDirs) is required to populate CMAKE_INSTALL_LIBDIR
    
    [TJ: Patch partially applied: Dropped the lib rename part from ftdi1.a to 
ftdi1-static]

commit 2e714eec137f86ca1950457d8226d8cb9b71c495
Author: Shawn Hoffman <business@xxxxxxxxxxxx>
Date:   Wed Apr 10 07:15:48 2024 -0700

    msvc: quiet uninteresting warnings

commit d96dbea887373f26755e9873b4ab020f922b7c3b
Author: Shawn Hoffman <godisgovernment@xxxxxxxxx>
Date:   Wed Apr 10 07:15:47 2024 -0700

    fix unit var warning if ftdi_read_eeprom_location returned error, data 
would not be initialized

commit d31e3d5697eacbe87cd310b5bce615f3d8426cc0
Author: Shawn Hoffman <godisgovernment@xxxxxxxxx>
Date:   Wed Apr 10 07:15:43 2024 -0700

    cmake: fix elseif statement

commit c2b7c25e1272222c1719daea5761093fbc9c3010
Author: Shawn Hoffman <godisgovernment@xxxxxxxxx>
Date:   Wed Apr 10 07:15:41 2024 -0700

    msvc: fix shadowed variable warning

commit c4962c38a1ab470fbdc835c231567bd582eb5a5a
Author: Shawn Hoffman <godisgovernment@xxxxxxxxx>
Date:   Wed Apr 10 07:15:40 2024 -0700

    msvc: fix warnings by using all enum values in case statements

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

Summary of changes:
 CMakeLists.txt     |    7 ++++++-
 src/CMakeLists.txt |   27 +++++++++++++++++++++++++++
 src/ftdi.c         |   11 +++++++++--
 src/ftdi_stream.c  |    8 ++++----
 4 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce9ccb4..3ee49c6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,6 +30,8 @@ if(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
   file(GENERATE OUTPUT .gitignore CONTENT "*")
 endif()
 
+include(GNUInstallDirs)
+
 add_definitions(-Wall)
 
 include(CMakeOptions.txt)
@@ -81,7 +83,7 @@ endif ()
 if(NOT APPLE)
   if(CMAKE_SIZEOF_VOID_P EQUAL 4)
     SET(PACK_ARCH "")
-  else(CMAKE_SIZEOF_VOID_P EQUAL 8)
+  elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
     SET(PACK_ARCH .x86_64)
   endif(CMAKE_SIZEOF_VOID_P EQUAL 4)
 else(NOT APPLE)
@@ -170,6 +172,9 @@ if(${UNIX})
 endif(${UNIX})
 if(${WIN32})
   set(libdir      ${CMAKE_INSTALL_PREFIX}/bin)
+  if(STATICLIBS)
+    list(APPEND libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
+  endif()
 endif(${WIN32})
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libftdi1.pc.in 
${CMAKE_CURRENT_BINARY_DIR}/libftdi1.pc @ONLY)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5798ab0..ae51242 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -17,6 +17,33 @@ message(STATUS "Detected git snapshot version: 
${SNAPSHOT_VERSION}")
 
 configure_file(ftdi_version_i.h.in 
"${CMAKE_CURRENT_BINARY_DIR}/ftdi_version_i.h" @ONLY)
 
+if(MSVC)
+  # Disable some overly-verbose warnings activated by -Wall
+
+  # '<name>': function not inlined
+  add_compile_options(/wd4710)
+
+  # function '<name>' selected for automatic inline expansion
+  add_compile_options(/wd4711)
+
+  # Compiler will insert Spectre mitigation for memory load if /Qspectre 
switch specified
+  add_compile_options(/wd5045)
+
+  # '<type>': '4' bytes padding added after data member '<name>'
+  add_compile_options(/wd4820)
+
+  # conversion from '<type1>' to '<type2>', possible loss of data
+  add_compile_options(/wd4242 /wd4244 /wd4267)
+
+  # Disable warning on unsafe string functions
+  add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
+
+  if(MSVC_VERSION GREATER_EQUAL 1913)
+    # Disable warnings from system headers
+    add_compile_options(/external:anglebrackets /external:W0)
+  endif()
+endif()
+
 # Targets
 set(c_sources     ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.c 
${CMAKE_CURRENT_SOURCE_DIR}/ftdi_stream.c CACHE INTERNAL "List of c sources" )
 set(c_headers     ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.h CACHE INTERNAL "List of c 
headers" )
diff --git a/src/ftdi.c b/src/ftdi.c
index 534e3dd..de07d6e 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -2918,8 +2918,12 @@ static unsigned char type2bit(unsigned char type, enum 
ftdi_chip_type chip)
             }
         }
         case TYPE_230X: /* FT230X is only UART */
+        case TYPE_AM:
+        case TYPE_BM:
+        case TYPE_4232H:
         default: return 0;
     }
+    /* fallback */
     return 0;
 }
 
@@ -3517,7 +3521,7 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
             i = 0x40;
         }
         if ((ftdi->type == TYPE_230X) && (i >=  0x40) && (i < 0x50)) {
-            uint16_t data;
+            uint16_t data = 0;
             if (ftdi_read_eeprom_location(ftdi, i, &data)) {
                 fprintf(stderr, "Reading Factory Configuration Data failed\n");
                 i = 0x50;
@@ -4625,7 +4629,7 @@ int ftdi_write_eeprom_location(struct ftdi_context *ftdi, 
int eeprom_addr,
     switch (ftdi->type)
     {
         case TYPE_BM:
-        case  TYPE_2232C:
+        case TYPE_2232C:
             chip_type_location = 0x14;
             break;
         case TYPE_2232H:
@@ -4635,6 +4639,9 @@ int ftdi_write_eeprom_location(struct ftdi_context *ftdi, 
int eeprom_addr,
         case TYPE_232H:
             chip_type_location = 0x1e;
             break;
+        case TYPE_AM:
+        case TYPE_R:
+        case TYPE_230X:
         default:
             ftdi_error_return(-4, "Device can't access unprotected area");
     }
diff --git a/src/ftdi_stream.c b/src/ftdi_stream.c
index 4229d94..d146afd 100644
--- a/src/ftdi_stream.c
+++ b/src/ftdi_stream.c
@@ -245,13 +245,13 @@ ftdi_readstream(struct ftdi_context *ftdi,
             (ftdi->usb_read_timeout % 1000) * 1000 };
         struct timeval now;
 
-        int err = libusb_handle_events_timeout(ftdi->usb_ctx, &timeout);
-        if (err ==  LIBUSB_ERROR_INTERRUPTED)
+        int xfer_err = libusb_handle_events_timeout(ftdi->usb_ctx, &timeout);
+        if (xfer_err ==  LIBUSB_ERROR_INTERRUPTED)
             /* restart interrupted events */
-            err = libusb_handle_events_timeout(ftdi->usb_ctx, &timeout);
+            xfer_err = libusb_handle_events_timeout(ftdi->usb_ctx, &timeout);
         if (!state.result)
         {
-            state.result = err;
+            state.result = xfer_err;
         }
         if (state.activity == 0)
             state.result = 1;


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.5-62-g5e67403, libftdi-git <=