error in kernel version check in pcmciautils installation
bhuvan.kumarmital at wipro.com
bhuvan.kumarmital at wipro.com
Mon Aug 7 01:16:49 EDT 2006
Hi,
There seems to a problem in the kernel version checking in the
shell
code used in the pcmciautils version 13.
The file (pcmciautils-013/doc/cardmgr-to-pcmciautils.txt) mentions the
following way of kernel version checking:
KVERREL=`uname -r`
KVER=${KVERREL%-*}
KVER_MAJOR=${KVER%.*}
KVER_MINOR=${KVER##*.}
if [ "$KVER_MAJOR" == "2.6" ]; then
# kernel 2.6.13-rc1 and higher have pcmcia via
/sbin/hotplug
if [ $KVER_MINOR -ge 13 ]; then
# uncomment the following line if the driver for
your
# controller is not auto-loaded. or if you want
to be
# able to say /etc/init.d/pcmcia stop
/etc/init.d/pcmcia-new $1
exit 0
fi
fi
The problem is that this checking would fail on kernel versions
2.6.15.4( the one i use )or versions which have a subminor version as
well. This checking is very specific to kernel versions 2.6.x-rc1. The
current checking fails in my case, even though i'm using 2.6.15.4 (where
the minor number > 13).This is because KVER gets the string preceeding
the '-' (whether it exists or not in uname -r). In my case KVER would
assume the value 2.6.15.4 and subsequently KVER_MAJOR would become
2.6.15 which would never equate with 2.6 (in the if condtion) and always
lead to failure to run /etc/init.d/pcmcia-new $1.
The result is that the pcmcia-new script is not executed and the cardmgr
continues to get used.
This error checking has not been rectified in pcmciautils version 14 as
well.
I wonder how pccard daemon has been working for people using the above
code
on kernel 2.6.x.y
I would suggest the following replacement for the above checking:
KVER_MAJOR1=`uname -r | cut -d "." -f1`
KVER_MAJOR2=`uname -r | cut -d "." -f2`
KVER_MAJOR=$KVERMAJOR1.$KVER_MAJOR2
KVER_MINOR=`uname -r | cut -d "." -f3`
if [ "$KVER_MAJOR" == "2.6" ]; then
# kernel 2.6.13-rc1 and higher have pcmcia via
/sbin/hotplug
if [ $KVER_MINOR -ge 13 ]; then
# uncomment the following line if the driver for
your
# controller is not auto-loaded. or if you want
to be
# able to say /etc/init.d/pcmcia stop
#/etc/init.d/pcmcia-new $1
exit 0
fi
fi
I had posted this message some time back but i realised i had used the
wrong
mail-posting convention.As a result i didn't get any feedback. Therefore
i am
putting up this post again. Sorry for reposting.
Bhuvan Mital
Wipro Technologies
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
More information about the linux-pcmcia
mailing list