Thursday, December 11, 2008

Using dialup with 11.1 if NetworkManager does not handle your device

In openSUSE 11.1, NetworkManager is supposed to handle all dialup stuff. But, as far as I know, it can not handle e.g. plain old phone modems or dialup via bluetooth (rfcomm).
Unfortunately, if you now try to use the old methods of kinternet, wvdial or Umtsmon, you will find out that dialup will work with these, but you won't get a working resolv.conv and thus no name resolution. The reason is that the netconfig tools, which do rewrite resolv.conf apparently refuse to do that if NETWORKMANAGER=yes is configured in /etc/sysconfig/network/config.
One solution would be to switch to the old ifup method (NETWORKMANAGER=no), but then wireless LAN will basically be unusable.
Another, dirty and hackish solution is this:

Create a /etc/ppp/ip-up.local, containing
echo "nameserver $DNS1
nameserver $DNS2" >> /etc/resolv.conf

and a /etc/ppp/ip-down.local, containing
mv /etc/resolv.conf.netconfig /etc/resolv.conf

Make both of them executable. Dial up.

How does it work? The ip-up script gets the DNS servers in its environment. Just before it exits, it calls the ip-up.local script which then appends them to resolv.conf. During ip-down, the netconfig tools notice that the resolv.conf was changed externally and they refuse to touch it. They instead create resolv.conf.netconfig. ip-down.local now just replaces resolv.conv with resolv.conf.netconfig and everybody should be fine again.

To make this hack a bit more robust, you should probably check if the $DNS[12] variables are non-empty before adding them and you should check if resolv.conf.netconfig is newer than resolv.conf before restoring, but I leave that up to the reader.

Oh - and don't forget to file a bug against NetworkManager if it cannot handle your device!

Monday, December 08, 2008

Important Privacy Notice

If you care for your privacy, make sure to always delete /var/lib/zypp/AnonymousUniqueId before using any of the package management tools (YaST2, zypper).

Setting the repeat rate on an input device (Kernel 2.4 and 2.6)

If you ever come into the situation of having to set the repeat delay/period on an input device (/dev/input/eventX), with the additional challenge of needing it to work on both 2.4 and 2.6 kernels, maybe this code snippet might help you (fd is the filedescriptor of the device, opened writable):
        #include <linux/input.h>
struct input_event ie;
ie.type = EV_REP;
ie.code = REP_DELAY;
ie.value = 1000; /* 1 second initial delay */
if (write(fd, &ie, sizeof(ie)) == -1)
ie.code = REP_PERIOD;
ie.value = 250; /* 4 events per second */
if (write(fd, &ie, sizeof(ie)) == -1)

Looks pretty trivial, doesn't it? But it took me quite some time to realize that I needed to write a "magic" event into the device to set the properties ;)

Wednesday, December 03, 2008

WINE followup: Open Source Software Rocks!

Just a short followup to my last post about WINE and the problems it had with "Avatar - Legends of the Arena": most likely, with the next WINE version it will just work out of the box, due to this commit to the WINE git repository.

Yay! That's quick bug fixing (or actually: implementing a feature). Thanks!