Sunday, October 7, 2012

USB D2XX driver for Wine (on Linux)


I have a very nice logic analyzer that didn't come with any software for Linux. However, it uses some FTDI chip through its standard driver library 'ftd2xx.dll', which happens to have a Linux version whose API is pretty much the same, called "libftd2xx.so".


So I took the effort to wrap-up a Wine DLL 'ftd2xx.dll.so' which offers the native Linux driver to any Windows application running under Wine. It was a tedious task, but quite straightforward thanks to 'winedump'.

If you want to use your favourite FTDI-based USB devices under Wine too, just install ftd2xx.dll.so on your Wine lib installation, usually /usr/lib/wine/. Source code and detailed instructions are available here. Just don't forget to install FTDI's D2XX drivers for Linux from their site.

My particular device (Ant18e) demonstered some funny behaviour under Linux, somehow it didn't report a correct USB serial number. The strange thing was that it worked flawlessly under windows... I had to reprogram its EEPROM to get a good serial number with MPROG, a standard utility provided by FTDI, and a 'EEPROM template' provided by my device's vendor.

I also built a 'libd2xx_table.so' (ftdi_table-0403.c) that you may want to install right beside your libftd2xx.so (typically at /usr/local/lib/) in order to get all your FTDI-based devices (VendorID=0403) recognised by the driver. Otherwise only a few ProductIDs will be working. More details on D2XX Linux driver package, under "lib_table".

Use this stuff at your own risk! I already risked my brand new logic analyzer in this development :-).

Update for 64-bit systems: I have not been able to compile this on a 64-bit architecture, however the 32 bit binaries work fine when placing ftd2xx.dll.so at /usr/lib32/wine, and libd2xx_table.so (together with 32-bit D2XX drivers) at /usr/lib32/.

5 comments:

  1. Hi there,

    Your detailed instructions are a broken link currently: are they the same ones that are in the README on your Google Drive folder link?

    ReplyDelete
  2. Yep, hopefully the tgz file has all.

    ReplyDelete
  3. Hello

    1. today there is a module ftdi_sio in kernel

    we must forbid linux to load ftdi_sio and perhaps also usb_serial module. no ?

    2. today there is a module ftdi_sio and libftdi1 - Library to program and control the FTDI USB controller

    will you create a new ftd2xx.dll.so using these soft ?

    thanks

    ReplyDelete
  4. i use rfxmngr.exe a tool to manage rfxcom tranceiver 433E

    http://www.rfxcom.com/epages/78165469.sf/en_GB/?ObjectPath=/Shops/78165469/Products/14103

    http://www.rfxcom.com/WebRoot/StoreNL2/Shops/78165469/MediaGallery/Downloads/RFXtrx_User_Guide.pdf

    http://www.rfxcom.com/WebRoot/StoreNL2/Shops/78165469/MediaGallery/Downloads/RFXmngrSetup.exe

    i followed the guide to install linux ftd2xx driver
    i copy in /user/lib/ (the 32 bit folder) the 2 files libftd2xx.a and libftd2xx.1.12.so
    i launch rfxmngr
    then
    i click on the icon to connect
    then
    i get an error

    ************** Exception Text **************
    System.DllNotFoundException: Unable to load DLL 'C:\Windows\System32\FTD2XX.DLL': Procédure introuvable. (Exception from HRESULT: 0x8007007F)
    at RFXmngr.D2XX_Unit_NET.FT_GetNumberOfDevices(Int32& lngNumberOfDevices, String& pvArg2, Int32 lngFlags)
    at RFXmngr.frmMain.7AAA0(Object ᙂ, EventArgs 1AAAA)
    at RFXmngr.frmMain.5AAA0(Object ᙂ, ToolBarButtonClickEventArgs 1AAAA)
    at System.Windows.Forms.ToolBar.OnButtonClick(ToolBarButtonClickEventArgs e)
    at System.Windows.Forms.ToolBar.WmReflectCommand(Message& m)
    at System.Windows.Forms.ToolBar.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    **********************************************************************************************

    ReplyDelete
  5. Does this method work for LibFT4222.dll also. Please let me know how to build for LibFT4222.dll.

    ReplyDelete