#!/bin/sh

bt_insmod() {
	insmod $* > /dev/null 2>&1
	if [ $? -ne 0 ]; then
		echo "!!! Maybe you need root permission (insmod '$1' failed)."
		exit 1
	fi
}

get_addr=__bt_get_addr
module_dir=/lib/modules/`uname -r`/kernel/drivers/btrax

# for disym
export LANG=C

addr1=`$get_addr irq_desc`
addr2=`$get_addr no_irq_type`
if [ -z "$addr2" ]; then
	addr2=`$get_addr no_irq_chip`
fi
switch_to_param=`__bt_disym switch_to __switch_to`

if [ ! -f $module_dir/bt_mod.ko ]; then
	echo "!!! Btrax kernel module(bt_mod.ko) not installed."
	exit 1
fi
bt_insmod $module_dir/bt_mod.ko irq_desc_p=0x${addr1} no_irq_type_p=0x${addr2} \
	${switch_to_param} $*
