From eb8e529c4657c2e57e491ed8f38215708eed7fb5 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Fri, 24 Oct 2008 23:53:30 +0200 Subject: Reorganize into a usable debian dkms package Signed-off-by: Henrik Rydberg --- .../dkms_source_tree/scripts/bcm5974-diagnostics | 232 +++++++++++++++++++++ .../dkms_source_tree/scripts/bcm5974-post-install | 63 ++++++ .../dkms_source_tree/scripts/bcm5974-post-remove | 29 +++ .../dkms_source_tree/scripts/bcm5974-pre-install | 42 ++++ 4 files changed, 366 insertions(+) create mode 100755 usr/src/dkms_source_tree/scripts/bcm5974-diagnostics create mode 100755 usr/src/dkms_source_tree/scripts/bcm5974-post-install create mode 100755 usr/src/dkms_source_tree/scripts/bcm5974-post-remove create mode 100755 usr/src/dkms_source_tree/scripts/bcm5974-pre-install (limited to 'usr/src/dkms_source_tree/scripts') diff --git a/usr/src/dkms_source_tree/scripts/bcm5974-diagnostics b/usr/src/dkms_source_tree/scripts/bcm5974-diagnostics new file mode 100755 index 0000000..acd0bf4 --- /dev/null +++ b/usr/src/dkms_source_tree/scripts/bcm5974-diagnostics @@ -0,0 +1,232 @@ +#!/bin/bash +# +# bcm5943-diagnostics - troubleshooting the BCM5974 setup +# +# Copyright (C) 2008 Henrik Rydberg (rydberg@euromail.se) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +DRIVER=bcm5974 + +echo ----------------------------------------------------------------------- + +# What kernel version am I running? +KERNEL=`uname -r` +echo \* Kernel version: $KERNEL + +# What synaptics version is installed (debian)? +if [ -x /usr/bin/dpkg-query ]; then + SYNAPTICS=`/usr/bin/dpkg-query -W -f='${Version}\n' xserver-xorg-input-synaptics` + echo \* Synaptics version: $SYNAPTICS +else + echo \* Synaptics version: UNKNOWN - dpkg not found +fi + +# What USB devices of interest can we find? +if [ -x /usr/sbin/lsusb ]; then + LSUSB=`lsusb|grep 05ac:02` + echo \* USB device: $LSUSB +else + echo \* USB device: UNKNOWN - lsusb not found +fi + +# Do we have the module intalled? +MODLIB=/lib/modules/$KERNEL/kernel/drivers/input/mouse/$DRIVER.ko +MODLIB2=/lib/modules/$KERNEL/updates/dkms/$DRIVER.ko +if [ -f $MODLIB ]; then + echo \* $MODLIB: exists +elif [ -f $MODLIB2 ]; then + echo \* $MODLIB2: exists +else + echo \* $DRIVER does NOT exist + echo dkms: install package + echo manual: copy the file $DRIVER.ko to $MODLIB + exit 1 +fi + +# Do we have the module configured? +MODULES=/etc/modules +if [ -f $MODULES ]; then + if (grep -q $DRIVER $MODULES); then + echo \* $MODULES: has $DRIVER config, please remove + exit 1 + else + echo \* $MODULES: $DRIVER no longer explicitly listed, good + fi +fi + +# Do we have old quirks? +MODPROBE=/etc/modprobe.d/options +if [ -f $MODPROBE ]; then + MODPROBEOPTS=`grep quirks= $MODPROBE|grep -v ^#|grep 0x05ac:0x02` + if [ "$MODPROBEOPTS" != "" ]; then + echo \* $MODPROBE: has obsolete quirks - please remove + exit 1 + else + echo \* $MODPROBE: no obsolete quirks, good + fi +else + echo \* $MODPROBE: file not found +fi + +# Do we have the right quirks? +DRIVMOD=/etc/modprobe.d/$DRIVER +if [ -f $DRIVMOD ]; then + DRIVMODOPTS=`grep quirks= $DRIVMOD|grep -v ^#|grep 0x05ac:0x02` + if [ "$DRIVMODOPTS" != "" ]; then + echo \* $DRIVMOD: has quirks, good + else + echo \* $DRIVMOD: does NOT have quirks + echo Uncomment the right quirk line in $DRIVMOD + exit 1 + fi +else + echo \* $DRIVMOD: file not found + echo Copy the etc/modprobe.d/bcm5974 file to /etc/modprobe.d/ + exit 1 +fi + +# Did the depmod bite? +USBMAP=/lib/modules/$KERNEL/modules.usbmap +if [ -f $USBMAP ]; then + typeset -i nusb=`grep $DRIVER $USBMAP|grep 0x05ac|grep 0x02|wc -l` + if [ $nusb -gt 0 ]; then + echo \* $USBMAP: maps to $DRIVER, good + else + echo \* $USBMAP: does NOT map to $DRIVER + echo Run depmod -a as root + exit 1 + fi +fi + +# Was the $DRIVER module loaded? +DMESG=`lsmod|grep $DRIVER` +if [ "$DMESG" != "" ]; then + echo \* $DRIVER: module is loaded +else + echo \* $DRIVER: module is NOT loaded + echo Add this line to /etc/modules: + echo "$DRIVER" + exit 1 +fi + +# Was the $DRIVER module registered? +DEVPATH=/proc/bus/input/devices +if [ -f $DEVPATH ]; then + DEVICES=`grep $DRIVER /proc/bus/input/devices` + if [ "$DEVICES" != "" ]; then + echo \* $DEVPATH: module is registered + else + echo \* $DEVPATH: module is NOT registered + echo "Please double-check the quirks settings in $DRIVMOD" + exit 1 + fi +else + echo \* $DEVPATH: does not exist, ignore +fi + +# Do we have synaptics working properly? +typeset -i SYNLINES=`synclient -l|wc -l` +if [ $SYNLINES -gt 10 ]; then + echo \* synaptics: configuration readable +else + echo \* synaptics: configuration NOT readable + exit 1 +fi + +# Do we have a working synaptics configuration? +DIFF=/tmp/synclient-output.diff.$$ +TMP=/tmp/synclient-output.txt.$$ +synclient -l | grep -v Parameter | sort > $TMP +diff -u - $TMP > $DIFF < $ETCPATH + exit 0 +else + echo No suitable device found + exit 1 +fi diff --git a/usr/src/dkms_source_tree/scripts/bcm5974-post-remove b/usr/src/dkms_source_tree/scripts/bcm5974-post-remove new file mode 100755 index 0000000..21977de --- /dev/null +++ b/usr/src/dkms_source_tree/scripts/bcm5974-post-remove @@ -0,0 +1,29 @@ +#!/bin/bash +# +# bcm5943-post-remove - post-removing the BCM5974 +# +# Copyright (C) 2008 Henrik Rydberg (rydberg@euromail.se) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +DRIVER=bcm5974 +ETCPATH=/etc/modprobe.d/$DRIVER + +echo ----------------------------------------------------------------------- + +rm -f $ETCPATH + +exit 0 diff --git a/usr/src/dkms_source_tree/scripts/bcm5974-pre-install b/usr/src/dkms_source_tree/scripts/bcm5974-pre-install new file mode 100755 index 0000000..1e2b864 --- /dev/null +++ b/usr/src/dkms_source_tree/scripts/bcm5974-pre-install @@ -0,0 +1,42 @@ +#!/bin/bash +# +# bcm5943-pre-install - check system before installing the bcm5974 +# +# Copyright (C) 2008 Henrik Rydberg (rydberg@euromail.se) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +DRIVER=bcm5974 +LSUSB=/usr/sbin/lsusb + +PAT[0]="05ac:022" +PAT[1]="05ac:023" + +if [ -x $LSUSB ]; then + if [ "`$LSUSB|grep ${PAT[0]}`" != "" ]; then + exit 0 + elif [ "`$LSUSB|grep ${PAT[1]}`" != "" ]; then + exit 0 + else + echo bcm5974: no suitable device found + exit -1 + fi +else + echo bcm5974: cannot determine device type + exit -1 +fi + +exit 0 -- cgit v1.2.3