[Xastir] Portable operation of T42 to internet via BT and smartphone

Richard Polivka, N6NKO r.polivka at sbcglobal.net
Thu Jan 31 21:07:00 EST 2008


Here is a process that I am sure can be adapted for connecting to the 
internet with you laptop using BT. This works for me on my IBM T42, 
Fedora 8, Cingular 8525 smartphone, and bluetooth. I suggest that you 
get an unlimited data plan or the cellphone carrier will eat your bones 
for an appetizer.

-------------------------------

Process to connect to internet using IBM Thinkpad T42, Fedora 8 KDE, and 
Cingular/AT&T 8525 (HTC) smartphone running WM6

Documents used:

http://www.gentoo.org/doc/en/bluetooth-guide.xml
http://www.thinkwiki.org/wiki/How_to_setup_Bluetooth
Linux kernel source tree (>=2.6.22) under Documentation/thinkpad_acpi.txt
http://www.linuxdevcenter.com/pub/a/linux/2006/09/21/rediscovering-bluetooth.html?page=last

Make sure that all the bluetooth programs are installed: 
kdebluetooth-libs, bluez-libs, kdebluetooth, bluez-utils, kmobiletools, 
bluez-hcidump, bluez-libs-devel, kdebluetooth-devel, and dependencies.

Set up bluetooth operation per the thinkpad-acpi.txt documentation. The 
default acpi-mask does not allow for Fn-F5 to turn on/off bluetooth.

Put these files in make life easier using a root shell:

/etc/acpi/actions/bluetooth.sh (permissions 755):

#!/bin/bash
#
# Bluetooth on/off control
#
if [ -e /tmp/bluetooth ]
then
echo enable > /proc/acpi/ibm/bluetooth
touch /tmp/bluetooth
else
echo disable > /proc/acpi/ibm/bluetooth
rm /tmp/bluetooth
fi

/etc/acpi/events/bluetooth.conf (permissions 744):

#
# Bluetooth control
#

event=ibm/hotkey HKEY 00000080 00001005
action=/etc/acpi/actions/bluetooth.sh

I also forced /sys/devices/platform/thinkpad_acpi/hotkey_mask equal to 
/sys/devices/platform/thinkpad_acpi/hotkey_bios_mask. This allows fn-F5 
to toggle bluetooth on/off and has the added benefit of turning off the 
gray button display box in the center of the screen when you hit a 
hotkey. The setup is done by editing /etc/rc.d/init.d/acpid under the 
"start", "restart", and "condrestart" section with the following line:

cat /sys/devices/platform/thinkpad_acpi/hotkey_bios_mask > 
/sys/devices/platform/thinkpad_acpi/hotkey_mask

This line is inserted before the ";;" line in each of the above 
mentioned sections.

I also created a read-only file /etc/bluetooth/pin with my pin number. I 
also edited /etc/bluetooth/hcid.conf "passkey" to be the same number as 
in /etc/bluetooth/pin.

After the above changes, you can restart acpid to update its operation.

Start kbluetooth. Turn on bluetooth on the Thinkpad and on the 
smartphone. Don't forget to make the smartphone discoverable and the 
laptop discoverable.

In the same root shell, do an "hcitool scan" to find the hardware id of 
the smartphone. For the rest of this document, we will call the hardware 
ID of the smartphone xx:xx:xx:xx:xx:xx. We will need this ID number 
later to do the pairing.

Now on the smartphone, go to "Internet Sharing" and set it up for 
"Bluetooth PAN" and "MEdia Net". Hit "connect" and let the phone 
register itself to the cellular network. When the phone indicates that 
the network connection is complete, you can continue on.

Now enter the command "sdptool add NAP". This allows the service to be 
used. The following command "pand --role PANU --service NAP --connect 
xx:xx:xx:xx:xx:xx" will do a couple of things: 1) Allow for pairing, and 
2) set up the data connection. You will be asked for the PIN numbers on 
both the smartphone and laptop. Enter the appropriate numbers and this 
will complete the pairing. Both the smartphone and the laptop should 
remember the pairing for future use. Once the pairing is done, turn off 
discovery on both the laptop and the smartphone as it will not be 
necessary unless you break the pairing.

After completing the pairing, you need to give the created interface an 
address. I use "ifconfig bnep0 192.168.1.1". Now that the laptop is 
given an address, we need to get the rest of the needed routing 
information. Issue the command "dhclient bnep0" and that should get you 
on the air and running when the command prompt returns.

To disconnect the connection, just go to "Internet Sharing" and 
disconnect. The pairing will drop and you will be disconnected from the 
internet.

A warning to the wise - You had better have the unlimited internet 
package or expect a huge bill. You can also power the smartphone from 
the laptop via USB by making sure that START > SETTINGS > USB to PC has 
the advanced network functionality option not selected. This will save 
the battery in the smartphone.

This process may work for other combinations but the process should be 
pretty much the same.

Good Luck and happy surfing.

------------------------------------------------------

Richard, N6NKO



More information about the Xastir mailing list