Monday 25 August 2008

Using a cellphone GPRS/EDGE/UMTS Internet connection through Bluetooth under Gentoo Linux

Before you start, make sure that:



  • you can browse the Internet from your cellphone (take note of the connection profile you use)

  • you have a working Bluetooth connection between your phone and the PC

  • the devices are paired for connecting without asking for confirmation

  • you have bluez-utils emerged with USE="old-daemons"

Configure a RFCOMM connection with the phone:



  • in /etc/conf.d/bluetooth set RFCOMM_ENABLE=true

  • use sdptool search DUN to find the device's Bluetooth hardware address and the channel on which the cellphone listens for RFCOMM, the scan will take some time

  • in /etc/bluetooth/rfcomm.conf add a new connection with the address and channel you just found:

#
# RFCOMM configuration file.
#

rfcomm0 {
# Automatically bind the device at startup
bind yes;

# Bluetooth address of the device
device XX:XX:XX:XX:XX:XX;

# RFCOMM channel for the connection
channel 4;

# Description of the connection
comment "Cellphone GPRS/UMTS DUN";
}

  • execute /etc/init.d/bluetooth restart, you should now have a /dev/rfcomm0 device available, and cat /dev/rfcomm0 should cause the PC to connect to the cellphone (cat will output nothing, just kill it with Crtl+C when you verify the connection works).


Kernel requirements: besides what is needed for Bluetooth, enable all options under Device Drivers / Network device support / PPP (point-to-point protocol) support. This only adds 16KB to the kernel size. Recompile, install, reboot with your new kernel (or if you really don't want to reboot, compile PPP as a module and modprobe it).


Emerge ppp with USE="dhcp". Create a network service with ln -s /etc/init.d/net /etc/init.d/net.ppp0. Configure it by creating /etc/conf.d/net.ppp0 with the following contents:


### GPRS/EDGE/UMTS configuration ###
config_ppp0=( "ppp" )
link_ppp0="/dev/rfcomm0"

pppd_ppp0=(
"noauth"
"debug"
"local"

"defaultroute"
"usepeerdns"

"lcp-echo-interval 15"
"lcp-echo-failure 3"

"lock"

"115200"
"crtscts"
)

chat_ppp0="
ABORT BUSY
ABORT ERROR
ABORT 'NO ANSWER'
ABORT 'NO CARRIER'
ABORT 'NO DIALTONE'
ABORT 'Invalid Login'
ABORT 'Login incorrect'
'' AT
TIMEOUT 5
OK 'ATH'
OK 'ATE1'
OK 'AT+CGDCONT=1,\"IP\",\"internet\"'
OK 'ATD*99#'
TIMEOUT 60
CONNECT ''
TIMEOUT 5
~--''
"
### end GPRS/EDGE/UMTS configuration ###

You'll need to replace "internet" with the name of the connection profile you use for your data transfer (this should be provided by your cellular operator - "internet" is what Plus GSM uses in Poland). Start the connection with /etc/init.d/net.ppp0 start and everything should work.


Software used:



  • sys-kernel/gentoo-sources-2.6.25-r7

  • sys-apps/openrc-0.2.5

  • sys-apps/baselayout-2.0.0

  • net-wireless/bluez-libs -3.36

  • net-wireless/bluez-utils-3.36 with USE="old-daemons"

  • net-dialup/ppp-2.4.4-r15 with USE="dhcp"


Hardware used:



  • Nokia N95 8GB

  • HP Pavilion built-in Bluetooth adapter


How-To based on articles: