Patching the FT245 Driver under Linux

This steps have to be done in order to modify the Linux kernel module ftdi_sio.ko so, that it accepts devices with the vendor/device IDs of the Atmel STK541 and/or the Dresden Elektronik Sensor Terminal Board and assigns them a serial device like /dev/ttyUSBxx.

Modify the Driver Source Code
In the directory /usr/src/linux/drivers/usb/serial/ there are the files ftdi_sio.h and ftdi_sio.c, which needs to be modified.

There are two patches available but most probably they will not work at a specific system, since in ftdi_sio.c, the line numbers change rapidly by adding new devices from other vendors. So the patches most probably needs to be applied manually.

At first, the macros for the vendor and product ID of the boards have to be added in the file ftdi_sio.h:329.

    #define ATMEL_VID              0x03eb  /* Atmel Vendor ID */
    #define STK541_PID             0x2109  /* Zigbee Controller */
    #define DE_VID                 0x1cf1  /* Dresden Electronic Vendor ID */
    #define STB_PID                0x0001  /* Sensor Terminal Board */

Next in the file ftdi_sio.c the new Vendor/Device ID tuples needs to be added:

     static struct usb_device_id id_table_combined [] = {
            { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) },
            ...
            ...
            ...
            { USB_DEVICE(ATMEL_VID, STK541_PID) },
            { USB_DEVICE(DE_VID, STB_PID) },
            { },                                    /* Optional parameter entry */
            { }                                     /* Terminating entry */
     };
Build the Modified Kernel Modul
    root@pandora>cd /usr/src/linux
    root@pandora>make drivers/usb/serial/ftdi_sio.ko
    CC [M]  drivers/usb/serial/ftdi_sio.o
    MODPOST
    CC      drivers/usb/serial/ftdi_sio.mod.o
    LD [M]  drivers/usb/serial/ftdi_sio.ko
 
Note:
If an error message like "You have not yet configured your kernel! (missing kernel .config file)" occurs, under SuSE Linux you can quickly recover from this issue by doing "zcat /proc/config.gz > .config" in the directory /usr/src/linux.
Install the new Kernel Modul
    root@pandora>rmmod ftdi_sio
    root@pandora>cd /lib/modules/`uname -r`/kernel/drivers/usb/serial
    root@pandora>cp ftdi_sio.ko ftdi_sio.ko.orig
    root@pandora>cp /usr/src/linux/drivers/usb/serial/ftdi_sio.ko .
    root@pandora>depmod -a
 
Load and Test the new Kernel Modul
    root@pandora>modprobe ftdi_sio
    root@pandora>lsmod | grep ftdi
    ftdi_sio               27400  0
    usbserial              28776  1 ftdi_sio
    usbcore               112640  5 ftdi_sio,usbserial,uhci_hcd,rt73
    root@pandora>dmesg | grep FTDI
    ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected
    usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
    drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver
 

This documentation for µracoli was generated on Tue Apr 9 2013 by  doxygen 1.7.1