Sometimes I boot with the 2.2 kernel, sometimes 2.4.  The trouble is, they 
each use different device files for joysticks.  I used to load the 
joystick modules in /etc/modules.conf but never got it working right for 
2.4.

I added the following to /etc/rc.d/rc.local and that did the trick.  It's 
probably not the most elegant way to do it - comments welcome.

############################################################
### Setup joystick according to which kernel is booted
KERNEL22=`uname -r | grep 2.2.`
KERNEL24=`uname -r | grep 2.4.`

### I previously did (after booting 2.2):
###   mv mv /dev/js? /dev/js?-22

# we're booting kernel 2.2 ...
if [ "$KERNEL22" != "" ] ; then
        # if /dev/js0-22 exists, last boot was 2.4, else 2.2
        [ -c /dev/js0-22 ] && mv -f /dev/js0-22 /dev/js0
        [ -c /dev/js1-22 ] && mv -f /dev/js1-22 /dev/js1
        [ -c /dev/js2-22 ] && mv -f /dev/js2-22 /dev/js2
        [ -c /dev/js3-22 ] && mv -f /dev/js3-22 /dev/js3
        modprobe joy-analog
fi

# we're booting kernel 2.4 ...
if [ "$KERNEL24" != "" ] ; then
        # if /dev/js0-22 doesn't exist, last boot was 2.2, else 2.4
        [ -c /dev/js0-22 ] || mv /dev/js0 /dev/js0-22
        [ -c /dev/js1-22 ] || mv /dev/js1 /dev/js1-22
        [ -c /dev/js2-22 ] || mv /dev/js2 /dev/js2-22
        [ -c /dev/js3-22 ] || mv /dev/js3 /dev/js3-22
        ln -s /dev/input/js0 /dev/js0
        ln -s /dev/input/js1 /dev/js1
        ln -s /dev/input/js2 /dev/js2
        ln -s /dev/input/js3 /dev/js3
        modprobe joydev
        modprobe ns558
        modprobe analog
fi
############################################################

-- 
              ----------------------------------------------------
                 Linux Mandrake release 7.2 (Odyssey) for i586
                                    KDE 2.1
              Linux 2.2.17-27mdkWin4Lin, Uptime 7 hours 38 minutes
              ----------------------------------------------------

Reply via email to