It's not possible? Says who?

AVM Fritz!Card USB and Linux – an odyssey

with 3 comments

I want to send and receive faxes and I have a AVM Fritz!Card USB (v1). For sending I could just hook it up to my Windows XP machine, but my XP machine isn’t running all the time. My only computer running 24/7 runs Linux (Ubuntu Server Edition 9.04).

So, how hard can it be?

Let’s see: AVM has a driver from Jul 07, 2005 for SuSE. I don’t use SuSE, but I think there have been some releases since 2005. Then I found a RPM from Oct 08, 2007 containing a few patches to the AVM version.

So I download the RPM, apply the patches, install kernel-headers for my current kernel and try to compile the glue code for this kernel module. And it fails. Surprise, surprise.

Apparently there have been some API changes, let’s try to address them. First I had to replace DECLARE_MUTEX_LOCK with DECLARE_COMPLETION. Then it complained about this line:

if (NULL == find_task_by_pid (thread_pid)) {

After some searching on Google I replaced it with:

if (NULL == find_task_by_pid_ns (thread_pid, 0)) {

It also complained about not finding the header file asm/semaphore.h, which I found in linux/semaphore.h.

Then there was a problem with several USB functions not working. Apparently somebody was (understandably) fed up with non-free modules using their GPL code, so some checks concerning MODULE_LICENSE were introduced. Of course there are some tricks around this, but almost nobody is comfortable to distribute a patch containing such silly shenanigans.

So now I have a kernel module I can’t redistribute, but it loads. And it still doesn’t work. capiinfo returns a lot of fields containing just 00000000. This can be tracked down to the use of strncpy instead of lib_strncpy in src/driver.c. After changing this I can finally send and receive faxes with capisuite.

Conclusion: Getting older hardware with out of date and non-free drivers to work under Linux is possible but very annoying and time consuming.

Written by johnLate

September 25th, 2009 at 3:12 pm

Posted in Uncategorized

Automatically mounting a USB HDD with udev

with one comment


I have an external USB hard disk. It’s permanently connected to a box running Ubuntu Server Edition 9.04. The only partition on the USB disk should be mounted automatically at system startup. However, if I just add the partition to /etc/fstab it doesn’t work. At the time the system tries to mount all partitions the USB HDD isn’t available yet. So I needed to delay the mounting of the partition until it becomes available.


I tell udev to mount the partition as it becomes available.

First I configure the partition in /etc/fstab:

UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx    /media/external-usb-disk    ext3    noauto,noatime,errors=remount-ro    0    0

(replace “xxxxxxxx-xxxx-[…]” with your own, real UUID). I used mounting by UUID instead of device name to avoid problems when the name changes (e.g. due to another USB storage being connected). The noauto option prevents the system from automatically mounting the partition on system startup.

Then I create a new file in /etc/udev/rules.d/ called 80-external-usb-disk.rules:

ACTION=="add", ENV{DEVTYPE}=="partition", ENV{ID_FS_UUID}=="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", RUN+="/bin/mount -U $env{ID_FS_UUID}"

Finally, to tell udevd to reload the rule configuration:

sudo udevadm control --reload-rules

Now every time a new partition with the specified UUID is added, it is mounted.

Some Notes

I should have read /etc/udev/rules.d/README earlier. It says “Files should be named xx-descriptive-name.rules, […]”. At first my file didn’t have the “.rules” suffix – it took me some time to figure out why it was ignored. I don’t know whether 80 is a good priority for my rules file – but it works for me.

I could have told udev to assign special device names, like /dev/usbhdd and /dev/usbhdd1. But what for? I can identify the partition by the UUID, the mount point has a fixed name and usually you have symlinks under /dev/disk/by-uuid/ whose name won’t change.

Commandline to get some information about a device:

udevadm info --query=all --name=/dev/sdx1

Commandline to watch udev events live:

sudo udevadm monitor --environment

Written by johnLate

September 19th, 2009 at 5:04 pm

Posted in Uncategorized

Quick & Dirty patching of KNOPPIX boot options

with one comment

Sometimes I use Knoppix as rescue system. Usually there is an English and a German ISO image on the download page. As search results for English error messages are generally much better, I use the English version. However, I prefer the German keyboard layout and I only need the text console, therefore I had to enter “knoppix 2 keyboard=de” each and every time I booted Knoppix.

It’s tedious, so I changed the default boot options directly in the ISO image:

Read the rest of this entry »

Written by johnLate

April 18th, 2009 at 10:22 pm

Posted in Uncategorized

Binding Apache 2.2 to a dynamic IP (Debian)

without comments


I have a private network with a Debian box called “Sentinel” as NAT router to the Internet. The external IP address of Sentinel is dynamic, i.e. changes with each reconnect. The private network is Sentinel’s private IP address is on interface eth0. The Internet is accessed through interface ppp0.

I want Sentinel to serve 2 different HTTPS sites (each with its own SSL certificate), both listening on the standard port (443). One should be accessible from the local network, the other one from the Internet.


How do I configure Apache?

Listen    # private service
Listen ??.??.??.??:443 # public service

I can’t set an IP address, because it’s unknown and can change. Also I can’t leave it blank to let Apache listen on all interfaces because that would include and create a conflict.

I looked through the Apache 2.2 docs but didn’t find a solution for this.


So, if Apache only wants to bind to all interfaces or an interface with a fixed IP address, why shouldn’t I give it a fixed IP address and do DNAT for connections coming from the Internet?

Read the rest of this entry »

Written by johnLate

April 13th, 2009 at 8:00 pm

Posted in Uncategorized

Using Ctrl+Tab in GNU Screen over PuTTY

with 6 comments

Being used to hit Ctrl+Tab for switching between tabs in e.g. Firefox, Opera, Miranda, I also wanted to use it in GNU Screen.

After a short search, I found a blog post “How to use Ctrl-Tab in GNU Screen” with a solution for xterm.

However, I use PuTTY which doesn’t transmit anything when you press Ctrl+Tab. But it’s open source, so I grabbed a copy of the 0.60 sources and patched putty\WINDOWS\WINDOW.C (using the key codes from Mikael Ståldal’s blog post):

Read the rest of this entry »

Written by johnLate

April 10th, 2009 at 5:48 pm

Posted in Uncategorized