Jumat, 28 Desember 2007

Matrix GPRS via Bluetooth

Tulisan ini hampir sama dengan yang Amad bikin di : Makassar Slackers hanya saja yang ini versi bluetoothnya :D.

Slack 12 sudah ada init script untuk device bluetooth, pada bagian ini khusus untuk dial-up networking.

Kondisi yang saya gunakan :
Kartu Matrix
Laptop + bluetooth enable
HP yang ada Bluetoothnya :D

Aktifkan bluetooth di HP dan juga di laptop, selanjutnya aktifkan script bluetooth di /etc/rc/rc.bluetooth

# chmod 755 /etc/rc.d/rc/bluetooth
#/etc/rc.d/rc.bluetooth start


Dari cli gunakan perintah hcitool scan untuk mencari device bluetooth :

arman@oridecon:~$ hcitool scan
Scanning ...
00:1E:45:81:71:D4 Arman@K800i


Selanjutnya adalah menset rfcomm device yang digunakan untuk dial. Gunakan perintah sdptool

$ sdptool browse 00:1E:45:81:71:D4


Perhatikan hasil berikut :

Service Name: Dial-up Networking
Service RecHandle: 0x10002
Service Class ID List:
"Dialup Networking" (0x1103)
"Generic Networking" (0x1201)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100


Edit file /etc/bluetooth/rfcomm.conf menjadi seperti ini :

rfcomm0 {
# # Automatically bind the device at startup
bind yes;
#
# # Bluetooth address of the device
device 00:1E:45:81:71:D4;
#
# # RFCOMM channel for the connection
channel 2;
#
# # Description of the connection
comment "Example Bluetooth device";
}


Sesuaikan dengan hasil dari sdptoolnya.

Buat direktori /etc/ppp/peers

# mkdir -p /etc/ppp/peers

buat file berikut di direktory /etc/ppp/peers:
gprs
gprs-connect-chat
gprs-disconnect-chat

isinya masing - masing :

lcp-echo-failure 0
lcp-echo-interval 0
nodetach
debug
show-password

# Connect script:
# scripts to initialize the GPRS modem and start the connection,
# wvdial command is for Orange SPV while other phones should work with chat
connect /etc/ppp/peers/gprs-connect-chat
#connect "/usr/bin/wvdial --chat --config /etc/ppp/peers/gprs-wvdial.conf radiolinja_usb_orange_spv"

# Disconnect script:
# AT commands used to 'hangup' the GPRS connection.
disconnect /etc/ppp/peers/gprs-disconnect-chat

# Serial device to which the GPRS phone is connected:
# /dev/ttyS0 for serial port (COM1 in Windows),
# /dev/ircomm0 for IrDA,
# /dev/ttyUB0 for Bluetooth (Bluez with rfcomm running) and
# /dev/ttyUSB0 for USB
#/dev/ttyS0 # serial port one
#/dev/ttyS1 # serial port two
#/dev/ircomm0 # IrDA serial port one
/dev/rfcomm0 # Bluetooth serial port one
#/dev/ttyUSB0 # USB serial device, for example Orange SPV

# Serial port line speed
115200 # fast enough
#57600 # perhaps usefull with IrDA as some phones don't like
# speeds higher than this

# Hardware flow control:
# Use hardware flow control with cable, Bluetooth and USB but not with IrDA.
crtscts # serial cable, Bluetooth and USB, on some occations with IrDA too
#nocrtscts # IrDA

local
:10.0.0.1
noipdefault
ipcp-accept-local
defaultroute
usepeerdns
novj
nobsdcomp
novjccomp
nopcomp
noaccomp
noauth



File gprs-connect-chat :

#!/bin/sh
exec chat \
TIMEOUT 5 \
ECHO ON \
ABORT '\nBUSY\r' \
ABORT '\nERROR\r' \
ABORT '\nNO ANSWER\r' \
ABORT '\nNO CARRIER\r' \
ABORT '\nNO DIALTONE\r' \
ABORT '\nRINGING\r\n\r\nRINGING\r' \
'' \rAT \
TIMEOUT 12 \
SAY "Press CTRL-C to close the connection at any stage!" \
SAY "\ndefining PDP context...\n" \
OK ATH \
OK ATE1 \
OK 'AT+CGDCONT=1,"IP","satelindogprs.com","",0,0' \
OK ATD*99***1# \
TIMEOUT 22 \
SAY "\nwaiting for connect...\n" \
CONNECT "" \
SAY "\nConnected." \
SAY "\nIf the following ppp negotiations fail,\n" \
SAY "try restarting the phone.\n"


File gprs-disconnect-chat:

#!/bin/sh
# send break
exec /usr/sbin/chat -V -s -S \
ABORT "BUSY" \
ABORT "ERROR" \
ABORT "NO DIALTONE" \
SAY "\nSending break to the modem\n" \
"" "\K" \
"" "\K" \
"" "\K" \
"" "+++ATH" \
"" "+++ATH" \
"" "+++ATH" \
SAY "\nPDP context detached\n"


Jangan lupa untuk memberikan flag executable :
# chmod 755 /etc/ppp/peers/*

Selanjutnya tinggal ketikkan :
pppd call gprs
jika keluar hasil seperti ini :

Script /etc/ppp/ip-up started (pid 6008)
Script /etc/ppp/ip-up finished (pid 6008), status = 0x0

berarti anda sudah terkoneksi ke internet dan silahkan browsing.

Referensi :
http://linux.or.id/node/81
http://ryosaeba.wordpress.com/2007/05/12/pairing-bluetooth-modem-di-feisty-fawn/


Regards,

Arman Idris
arman[at]makassar-slackers[dot]org

Tidak ada komentar: