MicroHam USBII Linux driver hacking for kernel 2.6.xxx ====================================================== Sun Sep 16 20:27:24 CEST 2007 Jaakko Koivuniemi OH7BF Problem: the default ftdi_sio driver did not recognize the microHam USBII interface. In addition the driver was setting DTR and RTS high, which keys the radio after the driver is loaded. Warning: Modifying the driver code probably breaks it for other USB serial converters using the same chip. Kernel drivers have also a lot of freedom to damage your system and hardware, so do the modifications at your own risk. Hacking is not the right way to solve the problem, but this worked for me: 1) Kernel headers need to be present to compile the modules. Get the files ftdi_sio.c ftdi_sio.h usb-serial.c usb-serial.h from kernel source directory. 2) The files 'ftdi_sio.h' and 'ftdi_sio.c' need to be modified. In 'ftdi_sio.h' change the line #define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */ to #define FTDI_8U232AM_PID 0xEEEF /* Similar device to SIO above */ In 'ftdi_sio.c' the following lines /* /\* Turn on RTS and DTR since we are not flow controlling by default *\/ */ < /* if (set_dtr(port, HIGH) < 0) { */ < /* err("%s Error from DTR HIGH urb", __FUNCTION__); */ < /* } */ < /* if (set_rts(port, HIGH) < 0){ */ < /* err("%s Error from RTS HIGH urb", __FUNCTION__); */ < /* } */ are changed to < /* Change the code below to keep RTS and DTR low < -- Jaakko, Thu Feb 23 00:29:04 CET 2006 */ < if (set_dtr(port, LOW) < 0) { < err("%s Error from DTR LOW urb", __FUNCTION__); < } < if (set_rts(port, LOW) < 0){ < err("%s Error from RTS LOW urb", __FUNCTION__); < } 3) Create make file to build the 'ftdi_sio.ko' module: obj-m += ftdi_sio.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean 4) Copy the files to same directory, for example ftdi_sio_ham/ftdi_sio.c ftdi_sio_ham/ftdi_sio.h ftdi_sio_ham/usb-serial.c ftdi_sio_ham/usb-serial.h ftdi_sio_ham/Makefile 5) Run 'make' 6) Take copy of the original ftdi_sio.ko kernel module cd /lib/modules/2.6.xxx/kernel/drivers/usb/serial/ cp ftdi_sio.ko ftdi_sio.ko.orig 7) Copy the kernel module to /lib/modules, for example cd ftdi_sio_ham cp ftdi_sio.ko /lib/modules/2.6.xxx/kernel/drivers/usb/serial/ 8) Load the modules /sbin/insmod /lib/modules/2.6.xxx/kernel/drivers/usb/serial/usbserial.ko /sbin/insmod /lib/modules/2.6.xxx/kernel/drivers/usb/serial/ftdi_sio.ko 9) Check that the new ftdi_sio module recognizes the USBII by powering the interface first from radio side and then connecting the USB cable to PC while monitoring the kernel log tail -f /var/log/messages 10) In kernels 2.6.xxx there is no need to create /dev/ttyUSBx anymore, it is created automatically when the module is loaded. Now you should find ls -l /dev/ttyUSB0 crw-rw---- 1 root uucp 188, 0 May 29 23:00 /dev/ttyUSB0 Add your login name to the uucp group. usermod -a -G uucp mylogin 11) Renaming the ftd_sio.ko module is probably a good idea. This should allow to use the original driver in parallel.