Ensure we have at least Tcl 8.4 and provide a useful error message.
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
purge the device buffers for the device identified by the channel
purge the device buffers for the device identified by the channel
+ftd2xx version
+
+ return the FTDI library version (eg: 3.1.16)
INSTALLATION
The FTDI D2XX driver package should be downloaded from the website
INSTALLATION
The FTDI D2XX driver package should be downloaded from the website
-(http://www.ftdichip.com/Drivers/D2XX.htm) and the Makefile.vc
-modified such that FTDI_INCLUDE points to the directory containing the
-ftdi2xx.h header and FTDI_LIB points to the directory containing the
-library files.
+(http://www.ftdichip.com/Drivers/D2XX.htm). Set the FTDI_DIR variable
+when calling Makefile.vc to point to the driver directory that
+contains the ftd2xx.h header.
- nmake -f Makefile.vc TCLDIR=c:\Tcl
- nmake -f Makefile.vc TCLDIR=c:\Tcl install
+ nmake -f Makefile.vc TCLDIR=c:\Tcl FTDI_DIR=..\D2XX
+ nmake -f Makefile.vc TCLDIR=c:\Tcl FTDI_DIR=..\D2XX install
If the ftd2xx.dll is not installed already, it should be manually
If the ftd2xx.dll is not installed already, it should be manually
-copied to the installation folder (eg: c:\tcl\lib\tclftd2xx).
+copied to the installation folder (eg: c:\tcl\lib\tclftd2xx). It
+is usually installed into the system32 folder when the device driver
+is installed.
You may have to install drivers for your device (ftdibus.sys or
ftd2xx.sys). This should be provided by the device manufacturer as the
You may have to install drivers for your device (ftdibus.sys or
ftd2xx.sys). This should be provided by the device manufacturer as the
#include <errno.h>
#include "ftd2xx.h"
#include <errno.h>
#include "ftd2xx.h"
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 84
+#error This package requires at least Tcl 8.4
+#endif
+
typedef FT_STATUS (WINAPI FT_CloseProc)(FT_HANDLE);
typedef FT_STATUS (WINAPI FT_CreateDeviceInfoListProc)(LPDWORD);
typedef FT_STATUS (WINAPI FT_GetDeviceInfoListProc)
typedef FT_STATUS (WINAPI FT_CloseProc)(FT_HANDLE);
typedef FT_STATUS (WINAPI FT_CreateDeviceInfoListProc)(LPDWORD);
typedef FT_STATUS (WINAPI FT_GetDeviceInfoListProc)
VersionCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
FT_STATUS fts;
VersionCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
FT_STATUS fts;
+ char s[TCL_INTEGER_SPACE * 3 + 4];
DWORD dwVersion = 0;
if (objc != 2) {
DWORD dwVersion = 0;
if (objc != 2) {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)dwVersion));
+ sprintf(s, "%d.%d.%d",
+ (dwVersion >> 16) & 0xff,
+ (dwVersion >> 8) & 0xff,
+ (dwVersion & 0xff));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
LPCSTR szDllName = "FTD2XX.dll";
#endif
LPCSTR szDllName = "FTD2XX.dll";
#endif
-#ifdef USE_TCL_STUBS
- if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.4", 0) == NULL) {
+ if (Tcl_PkgRequire(interp, "Tcl", "8.4", 0) == NULL) {
+ return TCL_ERROR;
+ }
hDll = LoadLibraryA(szDllName);
if (hDll == NULL) {
hDll = LoadLibraryA(szDllName);
if (hDll == NULL) {