Gowerlabs / LibFTD2XX.jl

Julia wrapper for FTDI D2XX drivers.
Other
6 stars 1 forks source link

Fix `validate_libFTD2XX_version` #44

Open ReubenHill opened 5 years ago

ReubenHill commented 5 years ago

validate_libFTD2XX_version uses the function FT_GetLibraryVersion to test version number but then test against using the driver version instead of the library version.

function validate_libFTD2XX_version(name, handle)
    f = Libdl.dlsym_e(handle, "FT_GetLibraryVersion")
    f == C_NULL && return false
    v = Ref{Cuint}()
    s = ccall(f, Culong, (Ref{Cuint},), v)
    s == C_NULL && return false
    if Sys.iswindows()
        return v[] >= 0x00021228 # <- THIS is incorrect.
    else
        return true         # OS X library returns version 0x0000000
    end
end

Windows testing suggests that the library version is v"3.2.14" (see #41) so the below should work instead

function validate_libFTD2XX_version(name, handle)
... # as above
    if Sys.iswindows()
        return v[] >= 0x00030214
    else
        return true         # OS X library returns version 0x0000000
    end
end