[ltp] IBM T42, Access IBM button

Mario Limonciello linux-thinkpad@linux-thinkpad.org
Sun, 08 May 2005 20:25:25 -0400


André Wyrwa wrote:

>Hi,
>
>  
>
>>	I have tbp working to map this to xlock, so when I get up from 
>>my laptop I can hit the blue button and xlock + xscreensaver my 
>>machine before I walk away from my desk. 
>>    
>>
>
>what?!? You don't have it set to load the ThinkWiki main page? How dare
>you?! ;-)
>
>André.
>
>  
>
Mine I found a feature I thought was more useful.  Mine will disable or
enable wireless.  I then re-assigned the keystroke ctrl-alt-delete to
the same function as listed by David.

If anyone is interested this is my thinkkey script:

supermario@portablemario ~ $ cat /etc/wireless.sh
if lsmod | grep ath_pci
then
        Xdialog --infobox "Wireless DISABLED" 5 20 3000
        sudo /sbin/rmmod ath_pci;
        if [ -e /var/run/xsupplicant ]
        then
                sudo /etc/init.d/xsupplicant stop
                if [ -e /var/run/xsupplicant ]
                then
                        sudo /etc/init.d/xsupplicant zap
                fi
        fi
        if [ -e /var/run/kismet_server.pid ]
        then
                sudo /etc/init.d/kismet stop
                if [ -e /var/run/kismet_server.pid ]
                then
                        sudo /etc/init.d/kismet zap
                        sudo rm /var/run/kismet_server.pid
                fi
        fi

else
        ######################
        ##Always insert module
        sudo /sbin/modprobe ath_pci
        ######################

        tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
        trap "rm -f $tempfile" 0 1 2 5 15
        Xdialog --no-cancel --clear --title "Wireless Enabled" --menu
"Atheros a/b/g Wireless Enabled.  What do you want to do?" 20 51 4
"CLOSE" "Choose the closest unsecured AP" "IBM" "Authenticate With IBM"
"KISMET" "Scan using Kismet" "GKISMET" "Scan using Gkismet" 2> $tempfile

        retval=$?
        choice=`cat $tempfile`

        ######################
        #####Choose What to do
        ######################
        case $choice in
           IBM)
                   sudo /usr/bin/iwconfig ath0 essid IBM key 1234567890;
                   sudo /sbin/ifconfig ath0 up;
                   sudo /etc/init.d/xsupplicant start;
                   xterm -e "wavemon";;
           KISMET)
                   sudo killall runscript.sh;
                   sudo /etc/init.d/kismet start;
                   sleep 1;
                   Terminal -e "kismet_client";;
           GKISMET)
                   sudo killall runscript.sh;
                   sudo /etc/init.d/kismet start;
                   gkismet localhost;;
           CLOSE)
                   xterm -e "wavemon";;
        esac
fi


I use wavemon to indicate when I get an IP from the closest AP option. 
Also the closest AP option includes if I have any keys stored in my
runtime script (gentoo so /etc/conf.d/wireless for me), it will
associate with those APs.  I might expand it to use xdialog to list near
by AP's and then you choose one, and use iwconfig to force that AP, but
I don't travel nearly enough that its worth it for me to do that.

A couple of sidefacts about that script:
You obviously need, wavemon,wireless-tools, kismet, gkismet, Terminal
(or name your appropriate terminal -thats for xfce), xsupplicant if your
company requires it, & Xdialog.
I use madwifi-drivers, you may have to use something different however
depending on what company suppllies your wireless card.