* [Bluez-users] bluetooth tethering to at&t phone issues
@ 2008-08-10 23:23 Jared Kidd
2008-08-11 9:09 ` Brad Midgley
0 siblings, 1 reply; 7+ messages in thread
From: Jared Kidd @ 2008-08-10 23:23 UTC (permalink / raw)
To: bluez-users
[-- Attachment #1.1: Type: text/plain, Size: 2106 bytes --]
I have been tethering internet through my at&t cell phone for over a year
using bluetooth PAN (old daemon way as I can't find ANY documentation on how
to do it the new way). Recently it started acting a little flaky. any
streaming videos would stop after the first few seconds, emerge sync would
either take forever to get started or stop halfway, and downloading any
larger files would fail. I recently renewed my contract and got a new phone
(blackjack ii), thinking it was the old phone as it would get very hot. The
issue persists and has gotten worse to the point that it is unusable. Now,
browsing/email still works fine. Streaming videos and it seems any sustained
download fails. If I attempt to start an emerge sync it will seem to halt
ALL internet traffic, same thing with other high traffic things - ALL
internet traffic halts. and I either have to wait a few minutes or reboot
the phone and connect all over again to get it working again.
I have noticed that when this all stops working, I can still ping the phones
ip address just fine, I just can't get anywhere past it. So it seems the
bluetooth connection between the phone and computer still works just fine.
I then started thinking that it may be some blocking technique at&t has
implemented to stop people from torrenting/downloading lots of stuff on
their 3g network and am about to cancel the internet plan as it is unusable.
Then a coworker of mine told me he has no problems with tethering at all.
Youtube works, downloading works, and he can even torrent.
So I decided to do something I hardly ever do - boot into windows XP and
connect through my phone the same exact way. And guess what.....IT WORKS
FINE!
Can anyone offer any explaination? I'll have to try my wifes ubuntu box and
see if it has the same issues as mine. It just seems very odd that it works
fine in windows but not in linux, and that in linux when internet stops
working I can still ping my phone.
Is it possible that at&t has some way to see if I am using a non-windows OS
and then screw up the connection? Or could it be a bluetooth PAN issue in
linux?
[-- Attachment #1.2: Type: text/html, Size: 2236 bytes --]
[-- Attachment #2: Type: text/plain, Size: 363 bytes --]
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Bluez-users] bluetooth tethering to at&t phone issues
2008-08-10 23:23 [Bluez-users] bluetooth tethering to at&t phone issues Jared Kidd
@ 2008-08-11 9:09 ` Brad Midgley
2008-08-11 21:24 ` [Bluez-users] Inquiry result with RSSI (From Newbie) thanit sara
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Brad Midgley @ 2008-08-11 9:09 UTC (permalink / raw)
To: BlueZ users
Jared
> to do it the new way). Recently it started acting a little flaky. any
> streaming videos would stop after the first few seconds, emerge sync would
> either take forever to get started or stop halfway, and downloading any
> larger files would fail.
I've noticed some issues like that and it seemed like it might be
something happening on the att network. I have been updating my system
to the latest ubuntu, so it's possible there was a subtle regression
somewhere.
I haven't done a lot of testing, but I haven't noticed the issue when
using dun on my n810. (I have a tilt that I used the
soft-reset-after-hard-reset trick on so dun didn't get disabled)
--
Brad
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bluez-users] Inquiry result with RSSI (From Newbie)
2008-08-11 9:09 ` Brad Midgley
@ 2008-08-11 21:24 ` thanit sara
2008-08-11 21:46 ` thanit sara
2008-08-14 9:58 ` [Bluez-users] bluetooth tethering to at&t phone issues Xamindar
2 siblings, 0 replies; 7+ messages in thread
From: thanit sara @ 2008-08-11 21:24 UTC (permalink / raw)
To: BlueZ users
Dear all,
Question from newbie. I am trying to send out the inquiry result format with RSSI.
This is what I have done.
My steps are
1.)open the BT device (open socket)
2.)set up event filters
3.)set the inquiry mode to be result format with RSSI
"int set_Inquiring = hci_send_cmd(sock, OGF_HOST_CTL, OCF_WRITE_INQUIRY_MODE, WRITE_INQUIRY_MODE_RP_SIZE, &cpp);//set inquiry mode"
4.)send out an inquiry
"int Inquiring = hci_send_cmd(sock, OGF_LINK_CTL,OCF_INQUIRY , INQUIRY_CP_SIZE, &cp);//do inquiry"
5.)try to read the rssi from "inquiry_info_with_rssi read_rssi"
6.)close socket
Below is my code. Please advice me. Am I missing something here.
/**************************************************************************************************
//Open BT device
//to retrieve the BT id of the local BT adaptor
local_BT_id = hci_get_route(NULL); //NULL option = get teh first available BT adaptor
//check for error
if (local_BT_id < 0)
{
// printf(stderr, "error code %d: %s\n",errno, strerror(errno));
perror("Fail to get BT adaptor id");
exit(1);
}
//to open the socket of the local BT device
sock = hci_open_dev( local_BT_id );
// check for error
if (local_BT_id < 0 || sock < 0)
{
perror("Fail to open device socket");
exit(1);
}
//*****************************************************
//Set up an event filter looking after the inquiry related events
struct hci_filter InqFilter;
hci_filter_clear(&InqFilter);
hci_filter_set_ptype(HCI_EVENT_PKT, &InqFilter);
hci_filter_set_event(EVT_INQUIRY_RESULT, &InqFilter);
hci_filter_set_event(EVT_INQUIRY_RESULT, &InqFilter);
hci_filter_set_event(EVT_INQUIRY_RESULT_WITH_RSSI, &InqFilter);
hci_filter_set_event(EVT_INQUIRY_RESULT_WITH_RSSI, &InqFilter);
hci_filter_set_event(EVT_INQUIRY_COMPLETE, &InqFilter);
if (setsockopt(sock, SOL_HCI, HCI_FILTER, &InqFilter, sizeof(InqFilter)) < 0)
{
perror("Fail to setup filter!");
exit(1);
}
//*****************************************************
//inquiry with the RSSI result
inquiry_info_with_rssi read_rssi;
write_inquiry_mode_cp cpp;
cpp.mode = 0x01;
int set_Inquiring = hci_send_cmd(sock, OGF_HOST_CTL, OCF_WRITE_INQUIRY_MODE, WRITE_INQUIRY_MODE_RP_SIZE, &cpp);//set inquiry mode
inquiry_cp cp;
cp.lap[0] =0x33;
cp.lap[1] =0x8b;
cp.lap[2] =0x9e;
cp.length = 4; //=4*1.28second = 5seconds
cp.num_rsp =0;
int Inquiring = hci_send_cmd(sock, OGF_LINK_CTL,OCF_INQUIRY , INQUIRY_CP_SIZE, &cp);//do inquiry
if (Inquiring < 0)
{
printf("starting to inquire: %d\n",Inquiring);
exit(1);
}
else
printf ("Done inquiry with RSSI!\n");
printf("rssi value = %d \n", read_rssi.rssi); //Try to print the RSSI value here.
close( sock );//close socket
return 0;
}
/***********************************************************************
Beside my hcidump shows no event result format with RSSI.
< HCI Command: Write Inquiry Mode (0x03|0x0045) plen 1
01
> HCI Event: Command Complete (0x0e) plen 4
01 45 0C 00
< HCI Command: Inquiry (0x01|0x0001) plen 5
33 8B 9E 04 00
> HCI Event: Command Status (0x0f) plen 4
12 01 01 04
/********************************************************************
Your kindness is greatly appreciated. I use Fedora9, with BlueZ version 3.32. (I tried command hciconfig hci0 inqmode 1 and it works fine, so I think the problem might not be from my usb dongle.)
Best regards,
Sara
_________________________________________________________________
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Bluez-users] Inquiry result with RSSI (From Newbie)
2008-08-11 9:09 ` Brad Midgley
2008-08-11 21:24 ` [Bluez-users] Inquiry result with RSSI (From Newbie) thanit sara
@ 2008-08-11 21:46 ` thanit sara
2008-08-14 9:58 ` [Bluez-users] bluetooth tethering to at&t phone issues Xamindar
2 siblings, 0 replies; 7+ messages in thread
From: thanit sara @ 2008-08-11 21:46 UTC (permalink / raw)
To: BlueZ users
My hcidump seems to be running now, but still cannot read the rssi value. Anyone please tell me where can I read the RSSI from the inquiry result.
----------------------------------------
> From: sara200t@uregina.ca
> To: bluez-users@lists.sourceforge.net
> Subject: Inquiry result with RSSI (From Newbie)
> Date: Mon, 11 Aug 2008 16:24:17 -0500
>
>
> Dear all,
>
> Question from newbie. I am trying to send out the inquiry result format with RSSI.
> This is what I have done.
> My steps are
> 1.)open the BT device (open socket)
> 2.)set up event filters
> 3.)set the inquiry mode to be result format with RSSI
> "int set_Inquiring = hci_send_cmd(sock, OGF_HOST_CTL, OCF_WRITE_INQUIRY_MODE, WRITE_INQUIRY_MODE_RP_SIZE, &cpp);//set inquiry mode"
> 4.)send out an inquiry
> "int Inquiring = hci_send_cmd(sock, OGF_LINK_CTL,OCF_INQUIRY , INQUIRY_CP_SIZE, &cp);//do inquiry"
> 5.)try to read the rssi from "inquiry_info_with_rssi read_rssi"
> 6.)close socket
>
> Below is my code. Please advice me. Am I missing something here.
> /**************************************************************************************************
> //Open BT device
> //to retrieve the BT id of the local BT adaptor
> local_BT_id = hci_get_route(NULL); //NULL option = get teh first available BT adaptor
> //check for error
> if (local_BT_id < 0)
> {
> // printf(stderr, "error code %d: %s\n",errno, strerror(errno));
> perror("Fail to get BT adaptor id");
> exit(1);
> }
>
> //to open the socket of the local BT device
> sock = hci_open_dev( local_BT_id );
> // check for error
> if (local_BT_id < 0 || sock < 0)
> {
> perror("Fail to open device socket");
> exit(1);
> }
> //*****************************************************
> //Set up an event filter looking after the inquiry related events
> struct hci_filter InqFilter;
> hci_filter_clear(&InqFilter);
> hci_filter_set_ptype(HCI_EVENT_PKT, &InqFilter);
> hci_filter_set_event(EVT_INQUIRY_RESULT, &InqFilter);
> hci_filter_set_event(EVT_INQUIRY_RESULT, &InqFilter);
> hci_filter_set_event(EVT_INQUIRY_RESULT_WITH_RSSI, &InqFilter);
> hci_filter_set_event(EVT_INQUIRY_RESULT_WITH_RSSI, &InqFilter);
> hci_filter_set_event(EVT_INQUIRY_COMPLETE, &InqFilter);
> if (setsockopt(sock, SOL_HCI, HCI_FILTER, &InqFilter, sizeof(InqFilter)) < 0)
> {
> perror("Fail to setup filter!");
> exit(1);
> }
>
> //*****************************************************
> //inquiry with the RSSI result
> inquiry_info_with_rssi read_rssi;
>
> write_inquiry_mode_cp cpp;
> cpp.mode = 0x01;
> int set_Inquiring = hci_send_cmd(sock, OGF_HOST_CTL, OCF_WRITE_INQUIRY_MODE, WRITE_INQUIRY_MODE_RP_SIZE, &cpp);//set inquiry mode
>
> inquiry_cp cp;
> cp.lap[0] =0x33;
> cp.lap[1] =0x8b;
> cp.lap[2] =0x9e;
> cp.length = 4; //=4*1.28second = 5seconds
> cp.num_rsp =0;
>
> int Inquiring = hci_send_cmd(sock, OGF_LINK_CTL,OCF_INQUIRY , INQUIRY_CP_SIZE, &cp);//do inquiry
> if (Inquiring < 0)
> {
>
> printf("starting to inquire: %d\n",Inquiring);
> exit(1);
> }
> else
> printf ("Done inquiry with RSSI!\n");
>
> printf("rssi value = %d \n", read_rssi.rssi); //Try to print the RSSI value here.
> close( sock );//close socket
> return 0;
> }
> /***********************************************************************
>
>
> Beside my hcidump shows no event result format with RSSI.
>
> < HCI Command: Write Inquiry Mode (0x03|0x0045) plen 1
> 01
>> HCI Event: Command Complete (0x0e) plen 4
> 01 45 0C 00
> < HCI Command: Inquiry (0x01|0x0001) plen 5
> 33 8B 9E 04 00
>> HCI Event: Command Status (0x0f) plen 4
> 12 01 01 04
> /********************************************************************
>
> Your kindness is greatly appreciated. I use Fedora9, with BlueZ version 3.32. (I tried command hciconfig hci0 inqmode 1 and it works fine, so I think the problem might not be from my usb dongle.)
>
> Best regards,
> Sara
>
> _________________________________________________________________
>
_________________________________________________________________
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Bluez-users] bluetooth tethering to at&t phone issues
2008-08-11 9:09 ` Brad Midgley
2008-08-11 21:24 ` [Bluez-users] Inquiry result with RSSI (From Newbie) thanit sara
2008-08-11 21:46 ` thanit sara
@ 2008-08-14 9:58 ` Xamindar
2008-08-15 18:14 ` Xamindar
2 siblings, 1 reply; 7+ messages in thread
From: Xamindar @ 2008-08-14 9:58 UTC (permalink / raw)
To: BlueZ users
Brad Midgley wrote:
> Jared
>
>> to do it the new way). Recently it started acting a little flaky. any
>> streaming videos would stop after the first few seconds, emerge sync would
>> either take forever to get started or stop halfway, and downloading any
>> larger files would fail.
>
> I've noticed some issues like that and it seemed like it might be
> something happening on the att network. I have been updating my system
> to the latest ubuntu, so it's possible there was a subtle regression
> somewhere.
>
> I haven't done a lot of testing, but I haven't noticed the issue when
> using dun on my n810. (I have a tilt that I used the
> soft-reset-after-hard-reset trick on so dun didn't get disabled)
>
Do you think maybe this could be the phones issue? I'll have to test a
different phone to see if it still happens. I noticed when the internet
stops working the phone also can't access the internet for a while
afterward. I either wait a while or reboot the phone and it's back again.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Bluez-users] bluetooth tethering to at&t phone issues
2008-08-14 9:58 ` [Bluez-users] bluetooth tethering to at&t phone issues Xamindar
@ 2008-08-15 18:14 ` Xamindar
2008-08-19 4:02 ` jayjwa
0 siblings, 1 reply; 7+ messages in thread
From: Xamindar @ 2008-08-15 18:14 UTC (permalink / raw)
To: BlueZ users
Does anyone know how to set up bluetooth pan the *new* way? As in not
using the old daemon? I searched the blues wiki and found that I need to
create a /etc/bluetooth/network.conf file but it fails to explain what
to do after that. All else I could find was dbus info on setting it up
which suggests there should he a program or script out there to do this.
Does anyone know? Or is this a closely guarded secret that only the
bluez devs know about?
Xamindar wrote:
>
>
> Brad Midgley wrote:
>> Jared
>>
>>> to do it the new way). Recently it started acting a little flaky. any
>>> streaming videos would stop after the first few seconds, emerge sync
>>> would
>>> either take forever to get started or stop halfway, and downloading any
>>> larger files would fail.
>>
>> I've noticed some issues like that and it seemed like it might be
>> something happening on the att network. I have been updating my system
>> to the latest ubuntu, so it's possible there was a subtle regression
>> somewhere.
>>
>> I haven't done a lot of testing, but I haven't noticed the issue when
>> using dun on my n810. (I have a tilt that I used the
>> soft-reset-after-hard-reset trick on so dun didn't get disabled)
>>
>
> Do you think maybe this could be the phones issue? I'll have to test a
> different phone to see if it still happens. I noticed when the internet
> stops working the phone also can't access the internet for a while
> afterward. I either wait a while or reboot the phone and it's back again.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Bluez-users] bluetooth tethering to at&t phone issues
2008-08-15 18:14 ` Xamindar
@ 2008-08-19 4:02 ` jayjwa
0 siblings, 0 replies; 7+ messages in thread
From: jayjwa @ 2008-08-19 4:02 UTC (permalink / raw)
To: BlueZ users
[-- Attachment #1: Type: TEXT/PLAIN, Size: 3043 bytes --]
On Fri, 15 Aug 2008, Xamindar wrote:
-> Does anyone know how to set up bluetooth pan the *new* way? As in not using
-> the old daemon? I searched the blues wiki and found that I need to create a
-> /etc/bluetooth/network.conf file but it fails to explain what to do after
-> that. All else I could find was dbus info on setting it up which suggests
-> there should he a program or script out there to do this. Does anyone know?
With pand? I'm not aware of an old daemon, just the current 'pand' that is
still in the sources. The subject of this message talks of tethering, which is
with rfcomm & pppd or dund calling pppd itself. I started to play around with
the file called ppporc, too, but still not sure what it does exactly. Anyway,
with pand you need to know the side of the connection you are on, and if the
serving side, whether you want to do NAP or GN. I did write scripts for this,
local - not meant for other systems but you can get an idea of from them. Hope
this is what you meant, if not, maybe others can make use of the scripts at
least.
(See files attached, 1-4)
An odd thing is, when I use --role NAP, I get the interface created under the
[GN] block of the network.conf file. Yet the sdp record also says "NAP". The
/etc/bluetooth/nap-service I start by hand; not sure if it would auto-exec if
another pand client was looking for a NAP service.
network.conf
[General]
Disable=
DisableSecurity=false
Interface=hci0
[PANU Role]
Interface=bnep%d
Script=/etc/bluetooth/panu-client
[GN Role]
Interface=pan0
Script=/etc/bluetooth/nap-service
[NAP Role]
Interface=pan1
Script=/etc/bluetooth/nap-service
You'll need the bridge-utils for brctl, they're on sourceforge.net
(http://bridge.sourceforge.net/). Some of the syntax is likely Zsh-specific,
probably [ ${status} = "0" ] is. If re-writing for other shells you'll need a
way to get the error codes of commands. I don't use these scripts a whole lot,
so likely there are bugs; I leave the debugging to whomever. I saw an
"RTnetlink answers: File exists" error today, but it's harmless. You'll also
need something to handle pairing.
10: pan0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UNKNOWN
link/ether e2:1a:fc:f3:45:9f brd ff:ff:ff:ff:ff:ff
inet 192.168.20.1/24 brd 192.168.20.255 scope global pan0
Service Name: Network Access Point
Service Description: BlueZ PAN Service
Service Provider: BlueZ PAN
Service RecHandle: 0x10005
Service Class ID List:
"Network Access Point" (0x1116)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 15
"BNEP" (0x000f)
Version: 0x0100
SEQ16: 800 806
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Network Access Point" (0x1116)
Version: 0x0100
Remove the bridge later:
ip link set pan0 down
brctl delbr pan0
-> Or is this a closely guarded secret that only the bluez devs know about?
Yes. And now that you know, you can't be allowed to leave here alive. ;)
[-- Attachment #2: ifup-pan0 --]
[-- Type: TEXT/PLAIN, Size: 1174 bytes --]
#!/bin/zsh
##
## Automatically add bnep's (that's PANU clients to you)
## to the pan0 bridge. This script will get called by pand
## with args:
##
## 0= script name 1 = device (like bnepN) and arg2 = connection BT address
##
## Assumed:
## 1. bluetooth running
## 2. pan0 bridge is addressed and routed correctly
## (done in panu-client script)
## 3. pan0 should be up, but we can "up" it again without harm
# Announce
echo "[+] Adding client $2 to bridge pan0 via device $1 ."
# pan0 exists when bluetooth subsystem starts automagically
# we only need add clients to it and make sure it's configured right
# STP? If you have other bridges as well, you might want to turn on STP here.
brctl addif pan0 $1
ip link set $1 up
# Log our status
if [ ${status} = "0" ]; then
# OK, no errors
echo "[+] Added $2 to pan0 via $1"
logger -p daemon.info -t pand -- "Added $2 to pan0 via $1"
else
# Errors. Usually this is because bnep0 has something wrong with it
echo "[-] Error adding client $2 to pan0 on $1"
logger -p daemon.error -t pand -- "Error adding client $2 to pan0 on $1"
# Indicate exit-with-failure
exit 1
fi
[-- Attachment #3: panu-client --]
[-- Type: TEXT/PLAIN, Size: 2106 bytes --]
#!/bin/zsh
##
##
## Script to connect this machine via bluetooth
## as a PANU client to another system running the
## PAN (NAP/GN) service. It will create a bridge
## and add interfaces to it.
##
## Needed tools:
## iproute2
## bridge-utils
## bluez-utils/libs
##
## Note: Some shell constructs might be Zsh specific.
## I deny the existance of bash.
# Call the pand daemon to search bluetooth airspace for a PAN
# running the NAP service. Record PID. Encrypt/secure probably
# requires passkey/auth agents to be running on both sides and
# both pand's to have those parameters selected.
pand --search --autozap --role PANU --service NAP --pidfile /var/run/pand.pid --devup /etc/bluetooth/ifup-pan0 --devdown /etc/bluetooth/ifdown-pan0
if [ ${status} -eq "0" ]; then
# We found the service
echo '[+] NAP service located and connection made. '
echo ' Proceeding with network-layer configuration.'
# Create an empty bridge. The switch --devup /etc/bluetooth/ifup-pan0
# will add the actual interfaces into the bridge.
# If pan0 already has had this address added before, you'll get a
# RTNETLINK answers: file exists error, which is harmless in this case.
ip addr add 192.168.20.2/24 broadcast + dev pan0
ip link set pan0 up
# Activate STP? This will make initial connections take a bit longer.
# Probably only needed when you are dealing with more than one bridge
# together.
#brctl stp pan0 on
# Default route? If there's not one, add it.
# Another option is to always replace it, but that might not be
# desirable in many instances.
if ! ip route show | grep -q "default"; then
echo '[+] No default route listed on this system. '
echo ' Will try to assign pan0 as default.'
ip route add default dev pan0
fi
else
# No NAP service, no connection, etc. No luck.
echo '[-] No NAP service, failed BT connection, or plain-out'
echo ' failed for some reason or another. '
# Indicate failure on exit
exit 1
fi
[-- Attachment #4: ifdown-pan0 --]
[-- Type: TEXT/PLAIN, Size: 703 bytes --]
#!/bin/zsh
##
## Remove interfaces from the pan0 bridge.
## Args:
## 0= script name 1 = device (like bnepN) and arg2 = connection BT address
##
# Announce
echo "[+] Removing client $2 from bridge pan0 at device $1 ."
brctl delif pan0 $1
ip link set $1 down
# Log our status
if [ ${status} = "0" ]; then
# OK, no errors
echo "[+] Removed $2 from pan0 at $1"
logger -p daemon.info -t pand -- "Removed $2 from pan0 at $1"
else
# Errors. Usually this is because bnep0 has something wrong with it
echo "[-] Error removing client $2 from pan0 on $1"
logger -p daemon.error -t pand -- "Error removing client $2 from pan0 on $1"
# Indicate exit-with-failure
exit 1
fi
[-- Attachment #5: nap-service --]
[-- Type: TEXT/PLAIN, Size: 1684 bytes --]
#!/bin/zsh
##
## Script to set up a PAN NAP service and get it ready
## to take connecting clients.
##
## Assumed:
## 1. pan bridges exist (added by bluetooth subsystem currently)
## 2. pan bridges will use pan0 = 192.168.20.0/24 subnet
##
# The bluetooth address of the system's adapter (hci0)
hci_device="00:0A:3A:7C:BE:A5"
# Announce
echo '[+] Initializing Bluetooth Network Access Point service.'
# Now exec the actual daemon. Make sure, if running this script several
# times, there is only one NAP service. I found that when pand exits
# sometimes, it did not clear out the NAP service from SDP. You may
# need to delete them by hand, by their Service Record:
# Service RecHandle: 0x10001
# sdptool del 0x10001
# would delete the service registered with 0x10001 as its RecHandle.
pand --device $hci_device --listen --role NAP --master --pidfile /var/run/pand.pid --devup /etc/bluetooth/ifup-pan0 --devdown /etc/bluetooth/ifdown-pan0
if [ ${status} -eq "0" ]; then
# Command successful. Proceed.
echo '[+] Connected. NAP service started. '
# Make sure pan0 is forwarding traffic for our clients
sysctl -w net.ipv4.conf.pan0.forwarding=1
# Add an address and broadcast to pan0
ip addr add 192.168.20.2/24 broadcast + dev pan0
# Mark it dynamic, because it is taking/removing clients on the fly
ip link set pan0 dynamic on
# Use STP on pan0?
#brctl stp pan0 on
# Up it. This should add the route for it too
# (192.168.20.0/24 dev pan0 proto kernel scope link src 192.168.20.10)
ip link set pan0 up
else
# Failed to get pand set up.
echo '[-] Failed to set up NAP service.'
exit 1
fi
[-- Attachment #6: Type: text/plain, Size: 363 bytes --]
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
[-- Attachment #7: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-08-19 4:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-10 23:23 [Bluez-users] bluetooth tethering to at&t phone issues Jared Kidd
2008-08-11 9:09 ` Brad Midgley
2008-08-11 21:24 ` [Bluez-users] Inquiry result with RSSI (From Newbie) thanit sara
2008-08-11 21:46 ` thanit sara
2008-08-14 9:58 ` [Bluez-users] bluetooth tethering to at&t phone issues Xamindar
2008-08-15 18:14 ` Xamindar
2008-08-19 4:02 ` jayjwa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox