Example class BUS

From FAIWiki
Jump to: navigation, search

this is an example of a detection routine for USB, CARDBUS and PCMCIA busses. it used to use an internal table to search for cardbus controllers, now it uses discover.

the old internal table code is left in as an example to the user.

#!/bin/sh

# try to detect pcmcia. dont know if this presently works or not.
pcmcia=`discover --disable-bus all --enable-bus pcmcia`
[ -n "$pcmcia" ] && echo "pcmcia=$pcmcia" >> $LOGDIR/jhwdetect.log
[ -n "$pcmcia" ] && newclasses=`echo $newclasses BUSPCMCIA`

# try to detect USB. this has worked on most machines, but some have quirky ports, we'll get to those later..
usb=`discover --disable-bus all --enable-bus usb | uniq`
[ -n "$usb" ] && echo "usb=$usb" >> $LOGDIR/jhwdetect.log
[ -n "$usb" ] && newclasses=`echo $newclasses BUSUSB`


#now, try to detect cardbus devices. they're hanging off of PCI. the easy identification method is to identify by description.
# this code is just here as an example now, look below.
##dell inspiron 8000
#I8000cardbus=`discover --disable-bus all --enable-bus pci | grep "PCI4451 PC card" | uniq`
#[ -n "$I8000cardbus" ] && echo "cardbus=$I8000cardbus" >> $LOGDIR/jhwdetect.log
##dell inspiron 7000
#I7000cardbus=`discover --disable-bus all --enable-bus pci | grep PCI1220 | uniq`
#[ -n "$I7000cardbus" ] && echo "cardbus=$I7000cardbus" >> $LOGDIR/jhwdetect.log
##gateway solo 3550
#Solo3550cardbus=`discover --disable-bus all --enable-bus pci | grep PCI1225 | uniq`
#[ -n "$Solo3550cardbus" ] && echo "cardbus=$Solo3550cardbus" >> $LOGDIR/jhwdetect.log
##ibm thinkpad 240
#TP240cardbus=`discover --disable-bus all --enable-bus pci | grep PCI1221 | uniq`
#[ -n "$TP240cardbus" ] && echo "cardbus=$TP240cardbus" >> $LOGDIR/jhwdetect.log
#
#if [ -n "$I8000cardbus" -o -n "$I7000cardbus" -o -n "$Solo3550cardbus" -o -n "$TP240cardbus" ]
#    then
#    newclasses=`echo $newclasses BUSPCMCIA BUSCARDBUS`
#fi

#But, then i learned a better method, using discover "more properly".

YentaCB=`discover -t bridge --data-path=linux/module/name | grep yenta_socket | uniq`
[ -n "$YentaCB" ] && echo "YentaCB=$yentaCB" >> $LOGDIR/jhwdetect.log
[ -n "$YentaCB" ] && newclasses=`echo $newclasses BUSPCMCIA BUSCARDBUS`