View Single Post
Old 09-23-2007, 12:10 AM   #6 (permalink)
Bobby Budnick
 
Join Date: Aug 2007
Posts: 80
Thanks: 3
Thanked 25 Times in 9 Posts
Bobby Budnick is on a distinguished road
Default Second addendum: advanced device configuration and PAN administration

Edit: The admin has disabled [code] tags. Try to imagine them there...

The PAN has been working well for me since I started with it. A few weeks back I noticed that some programs that need internet access will only access it through the "Internet" connection in the connection manager. Some programs are hardcoded this way, and there is no way to change them, registry or otherwise. Most notably, IM+ and Agile messenger behave this way. This normally would not be a problem on the pocket PC because the connection manager will allow you to assign network adapters to connections. In WM5 standard, it seems that you can not assign the BTCEPAN1 device to the "Internet" connection in the connection manager. Fortunately, you can change an adapter's DestID in the registry to the DestID for the "Internet". In this case, we can change BTCEPAN1 from "Work" to "Internet". The bad news is this must be done every time the PAN connection is connected/disconnected, and every time it auto-reconnects. Fortunately, I have written a script to automate this.

The script utilizes Mortscript to scan the connection manager registry key for BTCEPAN1 in a neverending loop and write the DestID for "Internet" whenever the DestID is changed to "Work" by disconnecting/reconnecting or from the auto-reconnect feature. Mortscript is a scripting framework supporting Windows Mobile. It is free and is invaluable to me now that I've used it. It can be installed in cab form from the website at http://www.sto-helit.de/index.php?mo...n=view&menu=29 . The scripts it can execute are just text files with the extension .mscr . The scripts are very light-weight. They use almost no memory and very little CPU. This is good, because the script is designed to run all the time. The script also does not bother the EVDO connection at all.

//START SCRIPT
//pan_hack_loop.mscr

while ( 1 )

x = RegRead( "HKLM", "Comm\ConnMgr\Providers\{F792e23c-dc19-4668-9be4-f8688b4c18d6}\BTCEPAN1", "DestId" )

if ( x eq "{A1182988-0D73-439E-87AD-2A5B369F808B}" )

RegWriteString( "HKLM", "Comm\ConnMgr\Providers\{F792e23c-dc19-4668-9be4-f8688b4c18d6}\BTCEPAN1", "DestId", "{436EF144-B4FB-4863-A041-8F905A62C572}" )

SleepMessage (15, "Hacking...", "Test",1)

EndIf

Sleep 2000

EndWhile

//END SCRIPT

Copy/paste this into a text file on the Q with extension .mscr . To run the script, just choose it with the file manager. Now you can use ANY application that needs internet/network access over the PAN. Once it is running, be sure not to close down Mortscript.exe in the task manager. To start the script at boot-time, add a shortcut to the script in \windows\startup\ .

I also have some scripts, which are personalized a little, which will switch between bluetooth and EVDO for a connection. They work by disabling/disconnecting one connection and enabling the other. Let me know if someone is interested and I will post them.

To easily administer the PAN from the GNU/Linux access point, I have written a GUI administration tool with Zenity. I call it PAN_ADMIN. Zenity is a GTK+ dialog frontend to the BASH scripting language.

#!/bin/bash
#PAN_ADMIN

#Start this script with root priviledges

while true
do

Choice=$(zenity --list --height=325 --text "PAN Admin" --radiolist --column "Pick" --column "Options" TRUE "Start_PAND" FALSE "Stop_PAND" FALSE "Reset_hci0" FALSE "hci0_status" FALSE "bnep0_status" FALSE "Connected_clients" FALSE "Exit")

if [ “$Choice” == “Start_PAND” ]
then
zenity --warning --text "The next screen will show any pand instances."
ps aux | grep pand > processfile
cat processfile | zenity --text-info --width 530
zenity --question --text "Start PAND, are you sure?"
if [ "$?" = 0 ]
then
#Here is where you put the line to start pand
#Your config may be different depending on your device!
./startpan
fi

elif [ “$Choice” == “Stop_PAND” ]
then killall pand

elif [ “$Choice” == “Reset_hci0” ]
then hciconfig reset hci0

elif [ “$Choice” == “hci0_status” ]
then hciconfig | zenity --text-info --width 530

elif [ “$Choice” == “bnep0_status” ]
then ifconfig bnep0 | zenity --text-info --width 530

elif [ “$Choice” == “Connected_clients” ]
then pand -l | zenity --text-info --width 530

elif [ “$Choice” == “Exit” ]
then exit

fi

done

#END OF SCRIPT

Copy/paste this into a text file on the GNU/Linux access point with any extension. Then 'chmod +x nameofscript'. Then run with 'kdesu nameofscript' with KDE or 'gksudo nameofscript' with GNOME.

Last edited by Bobby Budnick; 10-21-2007 at 09:11 PM.
Bobby Budnick is offline   Reply With Quote