[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Another pcmcia-cs (with DMI support etc.)



Frans Pop wrote:
> Could you post or mail a copy of the coding you used to set the resource
> settings (the rules you are using).
> I'm interested to see how general or specific you've made them.

Sure. Some of them might be a little too general, but I hope not. I
wanted to make it easy to convert the list from the PCMCIA-HOWTO.

#!/bin/sh
#
# detect-config.opts - Detect config.opts settings using dmidecode
#

msg()
{
    echo "$@" >&2
}

dmi_get()
{
    cat $dmidata | sed -n "/$1\$/,\$p" | sed '/^Handle/,$d' | tr -d '\t' \
	| tail +2 | grep "^$2" | cut -d: -f2 | sed 's/^ //'
}

res()
{
    model="$1"
    opt="$2"

    expression=$(echo "$model " | sed 's/ /.*/g')
    if expr "$compid" : "$expression" >/dev/null 2>&1; then
	msg "Special resource options for $model:"
	msg "$opt"
	resources="$opt"
    fi
}

if ! [ -x /usr/sbin/dmidecode ]; then
    msg "Not detecting special resource options (dmidecode not available)"
    exit 1
fi

if [ -x /bin/mktemp ]; then
    dmidata=$(mktemp)
else
    dmidata=/etc/pcmcia/dmidata
fi

if ! dmidecode >$dmidata; then
    msg "Not detecting special resource options (dmidecode failed)"
    rm -f $dmidata
    exit 1
fi

resources=''

manufacturer="$(dmi_get 'System Information' 'Manufacturer')"
product="$(dmi_get 'System Information' 'Product Name')"
compid="${manufacturer} ${product}"

msg "Found computer model: $compid"

res "AMS SoundPro" "exclude irq 10"
res "AMS TravelPro 5300" \
    "exclude memory 0xc0000-0xfffff include memory 0xc8000-0xcffff"
res "Chicony NB5" \
    "exclude memory 0xc0000-0xfffff include memory 0xda000-0xdffff"
res "Compaq Presario 900Z" "exclude port 0x3b0-0x3bb"
res "Compaq Presario 1020" \
    "exclude port 0x2f8-0x2ff irq 3 irq 5"
res "Compaq Presario 2120EA" "exclude irq 10"
res "Dell Inspiron 7000" "exclude irq 3 irq 5"
res "Dell Inspiron 8000" "exclude port 0x800-0x8ff"
res "Fujitsu C" "exclude port 0x200-0x27f"
res "HP Omnibook 4000C" "exclude port 0x300-0x30f"
res "Hewlett Packard Omnibook 4000C" "exclude port 0x300-0x30f"
res "HP Omnibook 4100" "exclude port 0x220-0x22f"
res "Hewlett Packard Omnibook 4100" "exclude port 0x220-0x22f"
res "IBM ThinkPad 380" "exclude port 0x230-0x233 irq 5"
res "IBM ThinkPad 385" "exclude port 0x230-0x233 irq 5"
res "IBM ThinkPad 600" \
    "exclude port 0x230-0x233 irq 5 port 0x2f8-0x2ff"
res "IBM ThinkPad 770" "exclude port 0x2f8-0x2ff"
res "IBM ThinkPad 600E" \
    "exclude port 0x230-0x233 irq 5 port 0x2f8-0x2ff"
res "IBM ThinkPad 770Z" \
    "exclude memory 0xa0000000-0xa0ffffff"
res "Micron Millenia Transport" "exclude irq 5 irq 9"
res "NEC Versa M" "exclude irq 9 port 0x2e0-2ff"
res "NEC Versa P/75" "exclude irq 5 irq 9"
res "NEC Versa S" "exclude irq 9 irq 12"
res "NEC Versa 6000" "exclude port 0x2f8-0x33f irq 9 irq 10"
res "NEC Versa SX" "exclude port 0x300-0x31f"
res "ProStar 9200" "exclude irq 5 port 0x330-0x35f"
res "Altima Virage" "exclude irq 5 port 0x330-0x35f"
res "Acquiline Hurricane DX4-100" "exclude irq 5 port 0x330-0x35f"
res "Siemens Nixdorf SIMATIC PG 720C" "include port 0x300-0x3bf"
res "TI TravelMate 5000" "include memory 0xd4000-0xdffff"
res "Toshiba Satellite 4030CDS" "exclude irq 9"
res "Toshiba T4900 CT" "exclude irq 5 port 0x2e0-0x2e8 port 0x330-0x338"
res "Toshiba Tecra 8000" "exclude irq 3 irq 5 irq 9"
res "Twinhead 5100" "exclude irq 9 irq 12"
res "Sharp PC-8700" "exclude irq 9 irq 12"
res "Sharp PC-8900" "exclude irq 9 irq 12"
res "MPC 800" "exclude irq 5 port 0x300-0x30f"

if [ -z "$resources" ]; then
    msg "No special resource options detected."
fi

echo "$resources"

rm -f $dmidata

-- 
Pelle



Reply to: