|
|
2007-12-13
, 17:31
|
|
Posts: 9 |
Thanked: 0 times |
Joined on Nov 2007
|
#12
|
|
|
2007-12-13
, 19:53
|
|
Posts: 21 |
Thanked: 7 times |
Joined on Sep 2007
@ California
|
#13
|
|
|
2007-12-13
, 20:15
|
|
Posts: 9 |
Thanked: 0 times |
Joined on Nov 2007
|
#14
|
|
|
2007-12-13
, 21:18
|
|
Posts: 21 |
Thanked: 7 times |
Joined on Sep 2007
@ California
|
#15
|
|
|
2007-12-21
, 12:14
|
|
Posts: 37 |
Thanked: 2 times |
Joined on Dec 2007
|
#16
|
|
|
2007-12-21
, 20:36
|
|
Posts: 21 |
Thanked: 7 times |
Joined on Sep 2007
@ California
|
#17
|
|
|
2007-12-21
, 20:42
|
|
Posts: 37 |
Thanked: 2 times |
Joined on Dec 2007
|
#18
|
|
|
2007-12-22
, 22:51
|
|
Posts: 29 |
Thanked: 0 times |
Joined on Sep 2007
|
#19
|
|
|
2007-12-24
, 17:45
|
|
Posts: 21 |
Thanked: 7 times |
Joined on Sep 2007
@ California
|
#20
|
#!/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
yeah man, connecting automatically was my first thought.. but i couldnt get any answers, no one has really messed with this stuff from my estimation.. and maemo prefers to have the user actually select the access point they want.. go figure.. heh.. the os2008 version i make will probably be a little more in depth..
regular access points are no problem to connect to through programming, but i couldnt find any good way of it even noticing that the dummy access point was connect-to-able though, only ones it can scan for and find.. i dunno..
if you can, try to get multiple bluetooth devices in your general area, and see if it sets precedence for your Dash.. it should be ok.. but i really haven't tested that much
...
cheers