Bluetooth tethering armooo1.5 - moded JF1.5

armooo

Member
Mar 1, 2009
5
0
0
This is a set of changes to JF1.5 ADP image to enable pan bluetooth tethering. The pan service will be available whenever bluetooth it turned on as you would expect from most other phones.

It includes all the normal changes from JF1.5

Changes

armooo1.50.1

Added support for multiple clients (updated pand_up.sh, pand_down.sh).
Added logging.
Added /system/xbin/pand.start. Works around what looks like an init bug with long lines.
Updated /system/init.rc to use pand.start and logwrapper.

armooo1.50

The pand service was added to /system/init.rc .
The library bluedroid (/system/lib/libbluedroid.so) was updated to start and stop the pand service.
Pan support scripts were added to /system/xbin (pand_up.sh, pand_down.sh).
Added dnsmasq to /system/xbin.

Changes for JFv1.50 ADP1.5 Build Environment
armooo1.5 ADP1.5
 
Last edited:

armooo

Member
Mar 1, 2009
5
0
0
twistedumbrella
You should be to manualy install the files in armooo1.50.tar.gz. It will need pand, iptables, awk and a kernel with netfilter/iptables. All of which were in the JF image I am not sure about the others.

andonnguyen
I was able to upgrade from JF1.5 ADP to this image without wiping. As long as you are not trying to use wifitether and the bluetooth tethering at the same time is should not be a problem. Stopping wifitether or disconnecting a bluetooth connection will disable ip forwarding and remove iptables rules which could cause problems.
 

emms007

Senior Member
Mar 19, 2008
132
5
0
Thanks it's working perfectly on Dude's build.

I prefer this over network as Ubuntu laptop don't like ad-hoc network and I never managed to connect.

I wonder if someone one if this PAN thing can provide connection to multiple computer simultaneously or is it just one?

Thanks again! good job
 

twistedumbrella

Recognized Developer
Sep 3, 2007
8,943
9,383
0
abandonedcart.gitlab.io
twistedumbrella
You should be to manualy install the files in armooo1.50.tar.gz. It will need pand, iptables, awk and a kernel with netfilter/iptables. All of which were in the JF image I am not sure about the others.

andonnguyen
I was able to upgrade from JF1.5 ADP to this image without wiping. As long as you are not trying to use wifitether and the bluetooth tethering at the same time is should not be a problem. Stopping wifitether or disconnecting a bluetooth connection will disable ip forwarding and remove iptables rules which could cause problems.
Tried moving the files over and got stuck in a boot loop. Couldn't get the init.rc to work. Didn't try just loading the rest of the files. Wasn't sure if that would work. I'll have to give it a try. Thanks.
 

armooo

Member
Mar 1, 2009
5
0
0
Tried moving the files over and got stuck in a boot loop. Couldn't get the init.rc to work. Didn't try just loading the rest of the files. Wasn't sure if that would work. I'll have to give it a try. Thanks.
The image you are using may have different loopback mounts in /system/init.rc you should only need to copy the pand service.
 

victortung

Member
Sep 19, 2008
20
0
0
Does anyone know how to use it?
After I updated the firmware, and launch pand_up.sh
an error show on next line:
error: SIOCSIFNETMASK (No such device)

I tried to pair with my MBP, it will show PAN network, but no IP address shows up
 

twistedumbrella

Recognized Developer
Sep 3, 2007
8,943
9,383
0
abandonedcart.gitlab.io
The image you are using may have different loopback mounts in /system/init.rc you should only need to copy the pand service.
Yeah, I am using a different apps2sd method and general startup than the JF. My image is based on 5.0.2H but I wasn't sure if the service would run without having that. I will try it without. I am sure it'll still work just wasn't sure how efficiently. Thanks again.
 

emms007

Senior Member
Mar 19, 2008
132
5
0
Thanks for the update!

In case someone is having issues installing this, here is a little how-to I've been using with Dude's latest rom.

using extracted armooo1.50.1_ADP1.5.zip as YOUR_armoo1.5_adap1.5_DIRECTORY

adb remount
adb push YOUR_armoo1.5_adap1.5_DIRECTORY/system/init.rc /system/init.rc
adb push YOUR_armoo1.5_adap1.5_DIRECTORY/system/lib/libbluedroid.so /system/lib/libbluedroid.so
adb shell umount /system/xbin
adb push YOUR_armoo1.5_adap1.5_DIRECTORY/system/xbin/xbin.cramfs /system/xbin/xbin.cramfs
adb shell reboot
 

emms007

Senior Member
Mar 19, 2008
132
5
0
It's simply internet sharing through bluetooth.
Key advantage is that there is not extra app/layer, it's included in Android as bluetooth is on.
 

lilithpro

Senior Member
Oct 11, 2008
89
0
0
Hi!

I tried to include this in JF 1.43 RC9.

Integrated the xbin stuff in xbin.cramfs and the bnep.ko module in modules.cramfs.

Didnt know how to get the module auto-loaded, so added the insmod command to pand.start.

The module is loaded correctly, however the pand service is not added.

running pand.start manually yields some kind of success, the pan service is visible and connectable to, but not allowing to get any kind of transfer, no ip

any advice would be great. i would prefer staying with 1.43 until jf comes out with his 1.5 RC9 version, but i also really would like to get this running to not have to use wifi tethering anymore...

thanks in advance
 

armooo

Member
Mar 1, 2009
5
0
0
Hi!

I tried to include this in JF 1.43 RC9.

Integrated the xbin stuff in xbin.cramfs and the bnep.ko module in modules.cramfs.

Didnt know how to get the module auto-loaded, so added the insmod command to pand.start.

The module is loaded correctly, however the pand service is not added.

running pand.start manually yields some kind of success, the pan service is visible and connectable to, but not allowing to get any kind of transfer, no ip

any advice would be great. i would prefer staying with 1.43 until jf comes out with his 1.5 RC9 version, but i also really would like to get this running to not have to use wifi tethering anymore...

thanks in advance
Sorry, but it looks like part of 1.5 was changing to use libbluedroid.so. So it is not going to start automatically for you. You should be able to get some debugging info from logcat. While you are trying to connect you may also want to try iptables, ifconfig and ps.

iptables -L should show
Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT 0 -- 192.168.5.0/24 anywhere
ACCEPT 0 -- anywhere anywhere state RELATED,ESTABLISHED

ifconfig bnep0 should show
bnep0: ip 192.168.5.254 mask 255.255.255.0 flags [up broadcast running multicast]

ps should have two pand and a dnsmasq

logcat should output

I/pand.start( 341): pand[348]: New connection from 00:22:69:C7:71:A2 at bnep0
I/pan ( 354): Starting BT pand for bnep0 192.168.5.0/24
 

lilithpro

Senior Member
Oct 11, 2008
89
0
0
After just installing JF1.51 EU, i replaced xbin.cramfs and copied init.rc to /system and the lib to /system/lib and everything is working great. My speed is actually a hint better than with wifi tether (0.36M vs 0.39M on a 3G 384kBit line).

Great thing there...
 

Dimath

Senior Member
Nov 5, 2008
77
1
0
Los Angeles
I would really appreciate it If someone could post how to connect to the phone on linux using console. Thanks.

PS: I am using JF1.5_ADP build. If I change libbluedroid.so and run the pand service (pand.start), should it be enough for it to work? Am I missing something?
 
Last edited:

Dimath

Senior Member
Nov 5, 2008
77
1
0
Los Angeles
I would really appreciate it If someone could post how to connect to the phone on linux using console. Thanks.

PS: I am using JF1.5_ADP build. If I change libbluedroid.so and run the pand service (pand.start), should it be enough for it to work? Am I missing something?
I believe nobody cares, so I answer to myself ;)
The problem was pretty much a firewall which blocks pings. So stupid. Anyway.

So, the way to do it without flashing, start from JF 1.5. ADB shell commands. Copy the libbluedriod.so into /system/lib/ (not sure if even need). Copy pand_up.sh and pand_down.sh to some G1 directory "your_dir". To start pand, run in terminal:
pand -n --listen --role NAP --devup "your_dir"/pand_up.sh --devdown "your_dir"/pand_down.sh

On linux pc (tried on Mandriva linux) find the G1 device id:
Code:
hcitool scan
(also can be found somewhere in the phone settings)
Connect to the device by
Code:
pand -c "device_id"
Start interface:
Code:
ifconfig bnep0 up
Get ip, gate etc (using dhcp):
Code:
dhclient bnep0
It works.
 

lilithpro

Senior Member
Oct 11, 2008
89
0
0
armooo:

You should really promote this more and have the rom cookers include it in their creations. In fact, the #1 reason for not switching my current rom (jf1.51) to any rogers, ion etc is because i use it really often and it works just flawlessly...
 

student.driver

Senior Member
Feb 3, 2009
400
8
0
I am using this with Ubuntu 9.04 (with Blueman), and for some reason it disconnects from the PAN service on the phone after a couple uses. Once this happens, I have to reboot the phone and it works again. Any ideas as to what's happening? I have tried cycling the Bluetooth service on the handset, and rebooting the laptop, but neither of those make a difference. When this occurs, I can stay connected for 15 seconds up to about 4 minutes before it dies, and the syslog in Ubuntu reads bnep0 disconnected.