The Following User Says Thank You to thoughtfix For This Useful Post: | ||
![]() |
2007-06-13
, 20:11
|
Posts: 52 |
Thanked: 2 times |
Joined on May 2007
@ Northeast USA
|
#2
|
![]() |
2007-06-13
, 21:25
|
Posts: 32 |
Thanked: 0 times |
Joined on Jun 2007
|
#3
|
![]() |
2007-06-13
, 23:09
|
Posts: 428 |
Thanked: 54 times |
Joined on Mar 2006
@ Washington DC
|
#4
|
![]() |
2007-06-14
, 07:19
|
Posts: 2,152 |
Thanked: 1,490 times |
Joined on Jan 2006
@ Czech Republic
|
#5
|
#!/bin/sh # use gainroot to become root and relaunch itself if [ `id -u` != 0 ] ; then #if not already root, call itself as root exec sudo gainroot <<EOF exec $0 $* EOF exit $? fi # real script follows BTADDR='00:16:41:B7:B9:07' BTNAME="FRANTA" IP=192.168.2.2 GW=192.168.2.1 NS=10.6.101.1 IFACE=bnep0 PAN_ROLE=GN # remote PAN role, one of PANU, NAP, GN #thanks to inz on #maemo IRC channel for this infoprint(){ dbus-send >/dev/null 2>&1 --system --print-reply --dest=com.nokia.statusbar /com/nokia/statusbar com.nokia.statusbar.system_note_infoprint "string:$*" & } dummy_wlan_down(){ if ifconfig wlan0 | grep -q "UP BROADCAST RUNNING" ; then # OK wlan is up, do we have IP set up? if not (=our dummy ad-hoc) bring wlan0 down ifconfig wlan0 | grep -q "inet addr" || ifconfig wlan0 down fi } bnep_start(){ dummy_wlan_down #insmod just to be sure insmod /mnt/initfs/lib/modules/current/bnep.ko #start PAN Bluetooth connection pand --connect $BTADDR -d $PAN_ROLE # wait for the interface created by pand s=60 echo -n "Waiting $s secs for $IFACE" while [ $s -gt 0 ] ; do ifconfig $IFACE >/dev/null 2>&1 && break s=$((s-1)) [ -t 1 ] && echo -n "." sleep 1 done echo if ifconfig $IFACE >/dev/null 2>&1 ; then # bring it up echo "OK, bringing $IFACE up" ifconfig $IFACE $IP up route add default gw $GW echo "nameserver $NS" >/tmp/resolv.conf.lo [ -t 1 ] || infoprint "Connected to $BTNAME" else echo "Error: $IFACE not available." [ -t 1 ] || infoprint "Connection failed" fi } bnep_stop(){ echo "OK, bringing $IFACE down" echo -n '' >/tmp/resolv.conf.lo pand -K sleep 1 rmmod bnep [ -t 1 ] || infoprint "Disconnected" } COMMAND=$1 if [ "$COMMAND" = "" ] ; then if ifconfig $IFACE >/dev/null 2>&1 ; then COMMAND=stop else COMMAND=start fi fi case $COMMAND in start) bnep_start ;; stop) bnep_stop ;; esac
#!/bin/sh if [ `id -u` != 0 ] ; then #if not already root, call itself as root exec sudo gainroot <<EOF exec $0 $* EOF exit $? fi #real script follows cd `dirname $0` SHORTCUT=franta-bnep.desktop SHORTCUT_NAME="PAN connection to FRANTA" SHORTCUT_SCRIPT=`pwd`/franta-bnep cat >$SHORTCUT <<EOF [Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application Name=$SHORTCUT_NAME X-Osso-Type=application/x-executable Exec=$SHORTCUT_SCRIPT EOF mv $SHORTCUT /usr/share/applications/hildon/
The Following User Says Thank You to fanoush For This Useful Post: | ||
![]() |
2007-06-14
, 13:49
|
Posts: 428 |
Thanked: 54 times |
Joined on Mar 2006
@ Washington DC
|
#6
|
![]() |
2007-06-14
, 19:35
|
|
Posts: 832 |
Thanked: 75 times |
Joined on Dec 2005
@ Phoenix, AZ
|
#7
|
![]() |
2007-06-15
, 17:17
|
|
Posts: 832 |
Thanked: 75 times |
Joined on Dec 2005
@ Phoenix, AZ
|
#8
|
![]() |
2007-06-15
, 18:29
|
|
Posts: 832 |
Thanked: 75 times |
Joined on Dec 2005
@ Phoenix, AZ
|
#9
|
The Following User Says Thank You to thoughtfix For This Useful Post: | ||
![]() |
2007-06-15
, 19:49
|
Posts: 428 |
Thanked: 54 times |
Joined on Mar 2006
@ Washington DC
|
#10
|
I will write a shell script for the N800 PAN that will
I have heard several methods to do this from a dummy network connection to a terminal launched script. If people already have this working, could you please share:
That'd help me a lot.
--Daniel G
TabletBlog.com - Thoughtfix's Nokia Internet Tablet Blog