Reply
Thread Tools
Posts: 90 | Thanked: 19 times | Joined on Oct 2007
#1
Hello

does PAN connection works on os2008 like on os2007 ?

thanks.
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#2
Yes but the setup is completely different due to missing pand. See http://www.gossamer-threads.com/lists/maemo/users/31118
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.
 
Posts: 90 | Thanked: 19 times | Joined on Oct 2007
#3
I'll take a look, thanks !
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#4
OK, I have it running, here is my shell script:
Code:
#!/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

#BT MAC of PC/phone
BTADDR='00:xx:xx:xx:xx:xx'
#bluetooth name of PC/phone, not important, just for infoprints
BTNAME="PC"
#desired IP address of your tablet
IP=192.168.2.2
#default gateway - IP address of PC/phone
GW=192.168.2.1 
#DNS server
NS=10.6.101.1
# remote PAN role, one of NAP, GN
PAN_ROLE=GN 

infoprint(){
DBUS_SESSION_BUS_ADDRESS='unix:path=/tmp/session_bus_socket' dbus-send --session --print-reply --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint "string:$*" &
}

dbus_method(){
local dest=$1
shift
DBUS_REPLY=$(dbus-send 2>&1 --system --type=method_call --print-reply --dest="$dest" $* )
}

dbus_result(){
echo $DBUS_REPLY | cut -d ' ' -f 7 | tr -d \"
}

find_connection(){
#find or create connection
if dbus_method org.bluez /org/bluez org.bluez.Manager.ActivateService string:network ; then
    NET_BUS=$(dbus_result)
#    echo destination $NET_BUS
    if dbus_method "${NET_BUS}" /org/bluez/network org.bluez.network.Manager.FindConnection string:"${BTADDR}" ; then
        CONN=$(dbus_result)
    else
        if dbus_method "${NET_BUS}" /org/bluez/network org.bluez.network.Manager.CreateConnection string:"${BTADDR}" string:"$PAN_ROLE" ; then
        CONN=$(dbus_result)
        fi
    fi
fi
}


bnep_start(){
#find_connection
if [ "$CONN" != "" ] ; then
echo connection $CONN
if dbus_method "${NET_BUS}" ${CONN} org.bluez.network.Connection.Connect ; then
    BNEPDEV=$(dbus_result)
    echo connected to $BNEPDEV
    ifconfig $BNEPDEV $IP up
    if route -n | grep -q '^0.0.0.0' ; then
        echo "default gateway already set, skipping GW and DNS setting"
    else
        route add default gw $GW
        echo "nameserver $NS" >/tmp/resolv.conf.lo
    fi
    [ -t 1 ] || infoprint "Connected to $BTNAME"
fi
fi
}

bnep_stop(){
#find_connection
if [ "$CONN" != "" ] ; then
echo connection $CONN
if dbus_method "${NET_BUS}" ${CONN} org.bluez.network.Connection.Disconnect ; then
echo "OK, bringing down"
echo -n '' >/tmp/resolv.conf.lo
[ -t 1 ] || infoprint "$BTNAME disconnected"
fi
fi
}

echo "Searching for $BTADDR ..."
[ -t 1 ] || infoprint "Searching for $BTADDR"
find_connection
if [ "$CONN" = "" ] ; then
    echo $DBUS_REPLY
    echo "Setting up connection to $BTADDR failed"
    [ -t 1 ] || infoprint "Connection to $BTADDR failed"
    exit
fi

COMMAND=$1
if [ "$COMMAND" = "" ] ; then
    dbus_method "${NET_BUS}" ${CONN} org.bluez.network.Connection.IsConnected
    if [ "$(dbus_result)" = "true" ] ; then
        COMMAND=stop
    else
        COMMAND=start
    fi
fi

case $COMMAND in
    start)      bnep_start ;;
    stop)       bnep_stop ;;
esac
Just change BTADDR, BTNAME, IP, GW and NS to your values.
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.

Last edited by fanoush; 2007-12-04 at 08:55. Reason: descriptions for variables
 

The Following 4 Users Say Thank You to fanoush For This Useful Post:
Posts: 1,097 | Thanked: 650 times | Joined on Nov 2007
#5
Wow - at last a concrete definitive example - will try it as soon as I reach home.
Just a quick clarification ..
what is GW (gateway) and NS (NS Lookup) values supposed to be ? From where am I going to get those values ?


Many thanks to you for the example script in advance.
 
Posts: 1,097 | Thanked: 650 times | Joined on Nov 2007
#6
Thnaks firstly for your script fanoush.
I copied the sh script (after changing the MAC address and other vales) to the N810 - as pan_start.sh - and ran it with sudo as 'sudo ./pan_start.sh start'

It came back with no error.
But with my bluetooth alrerady on on the Blackjack phone and internet sharing having being started - I still cant get any connection.

How am I supposed to check wether the script cerated the necessary PAND settings ?

Any help would be appreciated.
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#7
Well, this is only part of the puzzle. It is just meant as replacement for same one for OS2007. For further details see this old thread
http://www.internettablettalk.com/fo...2174#post52174

I will edit the script and add description of those variables.
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.
 

The Following User Says Thank You to fanoush For This Useful Post:
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#8
I haven't tried this but if you use DHCP on PC/phone end, you may replace ifconfig,route and dns setup by
Code:
udhcpc -i $BNEPDEV
The missing part is dummy IAP to satisfy Maemo connection manager and applications. Search this forum for DUMMY IAP. Without this network works only from command line and apps not ported to use Maemo network connections.

Also you can set it to run from menu, example for setting up menu shortcut is in the old thread already mentioned above.
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.

Last edited by fanoush; 2007-12-04 at 09:03.
 
Posts: 1,097 | Thanked: 650 times | Joined on Nov 2007
#9
Allright - some major clarification -
I am using a N810 - and I see that all these scripts and PAND and dbus- bnep stuff was working for people with N800 - which I believe came with the Bluetooth Network modules.

On my 810 - when I try any of these command - with dbus - I dont get anything working - it is because as I presume , the PAND and Bluez modules are not tehre at all for the N810?

Any idea if they can be loaded seperately and from where ?
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#10
Originally Posted by nilchak View Post
Allright - some major clarification -
I am using a N810
As for this BT PAN stuff N800 with OS2008 and N810 is same.
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.
 
Reply


 
Forum Jump


All times are GMT. The time now is 08:05.