Again, internet is good stuff. Without it, none of this would be this easy.
To do anything below, the phone must be rootable. G1 dev phone, or hacked G1 commercial. There is hacking info all over the web. Maybe someday I will come back and sort it up and place it here.
Enabling PAN on Android.
Android does not come with PAN enabled. The default Bluetooth profiles are Handsfree and Headset. When tried with "pand" command, error return says "Failed to open control socket: Protocol not supported". This means it needs bnep.ko module.
To enable PAN, I needed to build bnep.ko kernel module and insmod it on the device. Here is a very good tutorial. I pretty much followed it.
But it did work for me initially. When loading the ko module, it told me "insmod: init_module 'bnep.ko' failed (Exec format error)". Dmesg gets "bnep: version magic '2.6.27-01843-gfea26b0 preempt mod_unload modversions ARMv6 ' should be '2.6.25-01843-gfea26b0 preempt mod_unload ARMv6 '". Ahh! So the version of my kernel source is newer than the one in my phone. Then I went off to www.kernel.org and downloaded version 2.6.25, and repeated the same work, config, make modules, adb push bnep.ko, insmod. Dallah!
Then set up a pand NAP
# pand -s -r NAP
Now if I see NAP in my service list
# sdptool browse local
...
Service Name: Network Access Point
Service Description: BlueZ PAN Service
Service Provider: BlueZ PAN
Service RecHandle: 0x10002
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
A simple "pand -c " from my computer, I had 2 devices connected via PAN. Of course I had to assign them IP address manually. A little tricky with Android is that, ifconfig does not print anything. But I figured out that before they could ping each other, I had to explicitly
# ifconfig bnep0 up
SSH from PAN'ed Android phone
Natually, I wanted to try ssh once the 2 devices can see each other on the same subnet. But here is what I get
# ssh ktang@192.168.11.4
ssh: Warning: Reading the random source seems to have blocked.
If you experience problems, you probably need to find a better entropy source.
Internet never fails me. Here is some good info. Smart people everywhere. Briefly, this is the cure.
# ls /dev/random
/dev/random
# ls /dev/urandom
/dev/urandom
# mv /dev/random /dev/random.bk
# ln -s /dev/urandom /dev/random
# ssh ktang@192.168.11.4
ssh: Warning: failed creating //.ssh: Read-only file system
Host '192.168.11.4' is not in the trusted hosts file.
(fingerprint md5 ..................................)
Do you want to continue connecting? (y/n)
y
Password:
Last login: Sun Feb 22 02:08:36 2009 from tanglin
TangMac:~ ktang$
Made me happy!
Sunday, February 22, 2009
Subscribe to:
Post Comments (Atom)
1 comment:
Hello,
Nice tutorial. But the link you pointed to for process to install bnep.ko is broken.
Please let me know how you did it in android. Its very urgent.
Any help I would really appreciate it.
My id is shobhanks1987@gmail.com. Please help.
Post a Comment