Compiling AVM FritzCard PCI Linux kernel driver

From OS4X
Jump to navigation Jump to search

Requirement

You need a configured and compiled kernel tree with activated CAPI2.0 support available at

/usr/src/linux

(you may create a symlink with that name to your existant source directory). The kernel sources must be compiled. The configuration of the kernel must look like this:

       <M> CAPI2.0 support
           [*]   Verbose reason code reporting (kernel size +=7K)
           [*]   CAPI2.0 Middleware support (EXPERIMENTAL)
           <M>   CAPI2.0 /dev/capi support 
           [*]     CAPI2.0 filesystem support
           <M>   CAPI2.0 capidrv interface support

Obtaining the FritzCard driver sourcecode

There are several sources available. You should search for one of these files:

Modify kernel module sources

This step is needed for all Linux kernel versions after 2.6.24!

Open the file

fritz/src/driver.c

and edit at line 197: comment out the original call of "strncpy" and change/insert it as "lib_strncpy":

   197         // strncpy (ctrl->manu, "AVM GmbH", CAPI_MANUFACTURER_LEN);
   198         lib_strncpy (ctrl->manu, "AVM GmbH", CAPI_MANUFACTURER_LEN);

Compile the kernel module

Change to the directory

fritz/

of the extracted package and call "make":

os4xbox:/usr/src/rpm/SOURCES/fritz# make
make -C src
make[1]: Entering directory `/usr/src/rpm/SOURCES/fritz/src'
make -C /lib/modules/2.6.30_os4xbox/build SUBDIRS=/usr/src/rpm/SOURCES/fritz/src modules
make[2]: Entering directory `/usr/src/linux-2.6.30'
  CC [M]  /usr/src/rpm/SOURCES/fritz/src/main.o
  CC [M]  /usr/src/rpm/SOURCES/fritz/src/driver.o
  CC [M]  /usr/src/rpm/SOURCES/fritz/src/tools.o
  CC [M]  /usr/src/rpm/SOURCES/fritz/src/tables.o
  CC [M]  /usr/src/rpm/SOURCES/fritz/src/queue.o
  CC [M]  /usr/src/rpm/SOURCES/fritz/src/lib.o
  LD [M]  /usr/src/rpm/SOURCES/fritz/src/fcpci.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /usr/src/rpm/SOURCES/fritz/src/fcpci.mod.o
  LD [M]  /usr/src/rpm/SOURCES/fritz/src/fcpci.ko
make[2]: Leaving directory `/usr/src/linux-2.6.30'
make[1]: Leaving directory `/usr/src/rpm/SOURCES/fritz/src'

After successfull compilation, install the kernel module (with the actual kernel running in the version your sources are):

os4xbox:/usr/src/rpm/SOURCES/fritz# make install
make -C src
make[1]: Entering directory `/usr/src/rpm/SOURCES/fritz/src'
make[1]: »all« ist bereits aktualisiert.
make[1]: Leaving directory `/usr/src/rpm/SOURCES/fritz/src'
for f in src/fcpci.ko; do cp -vf $f /lib/modules/2.6.30_os4xbox/extra/; done
"src/fcpci.ko" -> "/lib/modules/2.6.30_os4xbox/extra/fcpci.ko"

Then execute

depmod -a

Load kernel module

modprobe fcpci

will load the kernel module and the system kernel log will include an output like this:

Nov 16 22:37:55 localhost kernel: [ 1309.179039] fcpci: AVM FRITZ!Card PCI driver, revision 0.7.2
Nov 16 22:37:55 localhost kernel: [ 1309.179108] fcpci: (fcpci built on Nov 16 2009 at 22:35:01)
Nov 16 22:37:55 localhost kernel: [ 1309.179170] fcpci: -- 32 bit CAPI driver --
Nov 16 22:37:55 localhost kernel: [ 1309.179256] fcpci: AVM FRITZ!Card PCI found: port 0xbc00, irq 11
Nov 16 22:37:55 localhost kernel: [ 1309.179319] fcpci: Loading...
Nov 16 22:37:55 localhost kernel: [ 1309.179380] fcpci: Driver 'fcpci' attached to fcpci-stack. (152)
Nov 16 22:37:55 localhost kernel: [ 1309.389961] fcpci: Stack version 3.11-07
Nov 16 22:37:55 localhost kernel: [ 1309.390029] IRQ 11/fcpci: IRQF_DISABLED is not guaranteed on shared IRQs
Nov 16 22:37:55 localhost kernel: [ 1309.390136] kcapi: Controller [001]: fcpci-bc00-11 attached
Nov 16 22:37:55 localhost kernel: [ 1309.390198] kcapi: card [001] "fcpci-bc00-11" ready.
Nov 16 22:37:55 localhost kernel: [ 1309.390306] fcpci: Loaded.

After successful loading, the tool "capiinfo" should output something like that:

os4xbox:~# capiinfo
Number of Controllers : 1
Controller 1:
Manufacturer: AVM GmbH
CAPI Version: 2.0
Manufacturer Version: 3.11-07  (49.23)
Serial Number: 1000001
BChannels: 2
Global Options: 0x00000039
   internal controller supported
   DTMF supported
   Supplementary Services supported
   channel allocation supported (leased lines)
B1 protocols support: 0x4000011f
   64 kbit/s with HDLC framing
   64 kbit/s bit-transparent operation
   V.110 asynconous operation with start/stop byte framing
   V.110 synconous operation with HDLC framing
   T.30 modem for fax group 3
   Modem asyncronous operation with start/stop byte framing
B2 protocols support: 0x00000b1b
   ISO 7776 (X.75 SLP)
   Transparent
   LAPD with Q.921 for D channel X.25 (SAPI 16)
   T.30 for fax group 3
   ISO 7776 (X.75 SLP) with V.42bis compression
   V.120 asyncronous mode
   V.120 bit-transparent mode
B3 protocols support: 0x800000bf
   Transparent
   T.90NL, T.70NL, T.90
   ISO 8208 (X.25 DTE-DTE)
   X.25 DCE
   T.30 for fax group 3
   T.30 for fax group 3 with extensions
   Modem

  0100
  0200
  39000000
  1f010040
  1b0b0000
  bf000080
  00000000 00000000 00000000 00000000 00000000 00000000
  01000001 00020000 00000000 00000000 00000000

Supplementary services support: 0x000003ff
   Hold / Retrieve
   Terminal Portability
   ECT
   3PTY
   Call Forwarding
   Call Deflection
   MCID
   CCBS

Verify OS4X usability of the ISDN controller

Start the tool "os4x_check_lcapi" in your OS4X binary installation directory:

os4xbox:~# /opt/os4x/bin/os4x_check_lcapi 
OS4X local CAPI check tool v1.0

Available controllers:                1

Checking controller 1:
Available channels per controller:    2
B1 protocol:                          0x11F
B2 protocol:                          0xB1B
B3 protocol:                          0xBF
B3 protocol X.25 available (OFTP ready)

The message "OFTP ready" shows that this controller supports all needed protocols for OFTP.

You must then configure this CAPI controller via the web interface, menu "CAPI".