XenServer/FritzUSB

From fakedWiki
Jump to: navigation, search

So i got USB over IP working, now where do i get drivers for my Fritz!Card USB 2.1? It looks like AVM doesn't care about Linux drivers anymore, the most recent version was created for kernel 2.6.11, i think. Some people always found ways to make the work with current kernels, but it's getting more difficult with each new kernel version. So here's how i got the to work with 2.6.29, or to be precise: 2.6.29-xs5.5.0.14 - that's the kernel being used for Debian Lenny domUs in XenServer 5.5.0.

Preparing the Kernel

After trying out many archives and patches that different people compiled, i finally found a package which contains the driver and nearly all patches on Joo Martin's page: http://www.joonet.de/fcard/

So let's get started:

cd /usr/src
aptitude install build-essential bzip2 libncurses5-dev kernel-package linux-source-2.6.29-xs5.5.0.14 module-assistant debhelper
tar jxvf linux-source-2.6.29-xs5.5.0.14.tar.bz2
cp /boot/config-2.6.29-xs5.5.0.14 linux-source-2.6.29-xs5.5.0.14/.config
cd linux-source-2.6.29-xs5.5.0.14
make menuconfig

Now we have to enable ISDN support in the Kernel (at least if you're running a XenServer domU, this step is probably optional for regular Debian kernels)

[*] ISDN support ---> 
   <M> CAPI 2.0 subsystem --->
      [*] CAPI2.0 Middleware support (EXPERIMENTAL)
      <M>   CAPI2.0 /dev/capi support
      [*]     CAPI2.0 filesystem support

Exit the menu, confirm that you want to save this configuration.


Preparing the Module

The kernel is prepared, but we still need the module for the Fritz!Card USB:

cd /usr/src
wget http://www.joonet.de/fcard/fcusb2-modules_0.8.0.tgz
tar zxvf fcusb2-modules_0.8.0.tgz

To be able to compile the module i had to create two additional patches. Open a new file in your favorite text-editor:

vi modules/fcusb2-driver/debian/patches/00-patch_patch.patch

and paste the following lines:

--- v01/debian/patches/03-work-struct.patch     2009-08-04 22:44:10.000000000 +0200
+++ v02/debian/patches/03-work-struct.patch     2009-08-04 22:44:34.000000000 +0200
@@ -42,7 +42,7 @@
        close_data = data;

 -      INIT_WORK (&closing_work, closing_worker, capi_card);
-+      INIT_WORK (&closing_work, closing_worker);
++      INIT_WORK (&closing_work, (work_func_t)closing_worker);
        schedule_work (&closing_work);
        LOG("Worker scheduled.\n");
  } /* start_closing_worker */

then open another file

vi modules/fcusb2-driver/debian/patches/08-avm_sucks.patch

and paste the following lines:

*** v01/fritz/src/driver.c  2009-08-04 22:55:59.000000000 +0200
--- v02/fritz/src/driver.c  2009-08-04 22:57:34.000000000 +0200
***************
*** 1244,1250 ****

        if (thread_pid != -1) {
                atomic_set (&thread_run_flag, 0);
!               if (NULL == find_task_by_pid (thread_pid)) {
                        LOG("Thread[%d] has died before!\n", thread_pid);
                } else {
                        if (!atomic_read (&thread_capi_flag)) {
--- 1244,1250 ----

        if (thread_pid != -1) {
                atomic_set (&thread_run_flag, 0);
!               if (NULL == find_task_by_vpid (thread_pid)) {
                        LOG("Thread[%d] has died before!\n", thread_pid);
                } else {
                        if (!atomic_read (&thread_capi_flag)) {
--- v08/fritz/src/driver.h  2009-08-04 21:33:29.000000000 +0200
+++ v09/fritz/src/driver.h  2009-08-04 21:33:46.000000000 +0200
@@ -23,7 +23,6 @@
 #ifndef __have_driver_h__
 #define __have_driver_h__

-#include <asm/semaphore.h>
 #include <asm/atomic.h>
 #include <linux/skbuff.h>
 #include <linux/capi.h>

Let's go, start compiling:

/usr/src/linux-source-2.6.29-xs5.5.0.14
make-kpkg --initrd kernel_image modules_image

Go out, meet people, have fun ... compiling takes time.

Installation

When you come back, you can install the new kernel and the modules:

dpkg -i /usr/src/linux-image-2.6.29-xs5.5.0.14_2.6.29-xs5.5.0.14-10.00.Custom_i386.deb
dpkg -i /usr/src/fcusb2-modules-2.6.29-xs5.5.0.14_0.8.0+2.6.29-xs5.5.0.14-10.00.Custom_i386.deb

Ignore the warning that the same kernel is already installed, hit the "No" button, and confirm with the "OK" button that you're going to reboot as soon as possible. Do it, seriously.

Configuration

So you rebooted, and are still reading this ... that means you kernel obviously worked fine, else you'd have other things to worry about right now. Go ahead load the module:

modprobe fcusb2

Nothing happened? That's a good sign! Check dmesg, i get:

CAPI Subsystem Rev 1.1.2.8
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
fcusb2: AVM FRITZ!Card USB v2 driver, revision 0.6.4
fcusb2: (fcusb2 built on Jul 27 2009 at 00:17:05)
fcusb2: -- 32 bit CAPI driver --
fcusb2: Loading...
usbcore: registered new interface driver fcusb2
fcusb2: Loaded.

We're nearly done, we just have to take care of some of the stuff the regular AVM installer would usually have done.

Copy the Firmware from the driver package to the folder where the driver searches for it:

cd /usr/src/modules/fcusb2-driver/
tar xzvf fcusb2-suse93-3.11-07.tar.gz
mkdir /usr/share/isdn
cp fritz/fus3base.frm /usr/share/isdn/

Open the CAPI config file:

vi /etc/isdn/capi.conf

and add the following line for our device:

fcusb2          fus3base.frm    DSS1    -       -       -       -

Last step: initialize the CAPI:

capiinit

Congratulations, you're done! If you don't trust me, try this:

capiinfo