Wednesday, 11 June 2008

the one i'm supposed to post something interesting

click to enlarge

Monday, 12 May 2008

the one with slackware linux and dialing gprs/3g network via bluetooth phone

There's time when you carry around your laptop and do wireless scanning but *darn it* as not a single (free) access point is nowhere to be found. I need to send this bloody email to my client immediately or I wont have anything to eat for weeks. Then I realise that I have my Sony Ericsson M600i mobile phone which is indicating that it has a good GPRS/3G signal. So here goes the steps to dial the M600i's modem via bluetooth.

First configure the file /etc/bluetooth/hcid.conf. This file represents your laptop.

== content of /etc/bluetooth/hcid.conf ==
options {
autoinit yes;
security user;
pairing multi;
passkey "4321"; # change to whatever the PIN
}
device {
name "karousel"; # the device name
class 0x000100;
iscan enable;
pscan enable;
lm accept;
lp rswitch,hold,sniff,park;
}

You'd need to enable bluetooth service on both devices (the laptop and the phone obviously). Then start the bluetooth network service in your slackware machine by running:
# chmod a+x /etc/rc.d/rc.bluetooth
# /etc/rc.d/rc.bluetooth start

Check that your bluetooth device is listed:
# hciconfig
hci0: Type: USB
BD Address: 00:16:CF:E8:4D:5A ACL MTU: 1017:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:8151888 acl:270883 sco:0 events:2218 errors:0
TX bytes:635484 acl:6392 sco:0 commands:30 errors:0

Scan for other bluetooth devices around:
# hcitool scan
00:16:B8:96:9B:66 kiara

Cool a phone has been found, and it has 00:16:B8:96:9B:66 as the network address. Now since we want only the dial-up networking (DUN) service from the phone, we've got to find which channel the DUN is being served:
# sdptool search DUN
Inquiring ...
Searching for DUN on 00:16:B8:96:9B:66 ...
Service Name: Dial-up Networking
Service Description: Symbian OS,UIQ phone
Service Provider: Sony Ericsson
Service RecHandle: 0x10006
Service Class ID List:
"Dialup Networking" (0x1103)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 7
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100

We found out that kiara (00:16:B8:96:9B:66) serves DUN on channel 7. Open up /etc/bluetooth/rfcomm.conf with a text editor and fill up the value according to your phone information. This file represents your mobile device.

== content of /etc/bluetooth/rfcomm.conf ==
rfcomm0 {
bind yes;
device 00:16:B8:96:9B:66; # the phone network address
channel 7; # the channel that serves DUN
comment "Kiara SE-M600i DUN";
}

Now we need to create dialing scripts. These scripts deal with sending raw commands to communicate with the phone's modem via bluetooth. These scripts must be located in directory /etc/ppp/peers, so create this directory if it doesn't yet exist:
# mkdir -p /etc/ppp/peers
# touch /etc/ppp/peers/gprs3g{,.on,.off}

Content of the scripts:

== content of /etc/ppp/peers/gprs3g ==
lcp-echo-failure 0
lcp-echo-interval 0
nodetach
debug
show-password
connect /etc/ppp/peers/gprs3g.on
disconnect /etc/ppp/peers/gprs3g.off
/dev/rfcomm0 115200 crtscts
local
:10.0.0.1
noipdefault
ipcp-accept-local
defaultroute
usepeerdns
novj
nobsdcomp
novjccomp
nopcomp
noaccomp
#noauth # uncomment this line if no authentication is needed
user "indosat@durasi" # comment this line if no authentication is needed

== content of /etc/ppp/peers/gprs3g.on ==
exec /usr/sbin/chat -V -s -S \
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 15 \
OK ATH \
OK ATE1 \
OK 'AT+CGDCONT=1,"IP","indosatgprs","",0,0' \
OK ATD*99***1# \
TIMEOUT 25 \
CONNECT "" \
SAY "\n[ok] Connection established.\n" \

== content of /etc/ppp/peers/gprs3g.off ==
exec /usr/sbin/chat -V -s -S \
ABORT "BUSY" \
ABORT "ERROR" \
ABORT "NO DIALTONE" \
"" "\K" \
"" "\K" \
"" "\K" \
"" "+++ATH" \
"" "+++ATH" \
"" "+++ATH" \
SAY "\n[ok] Connection terminated.\n"

That's all folks. To connect to the DUN, just run this command:
# pppd call gprs3g

There might be some issue with the new DNS setting the first time you make a connection. A simple solution is just add the new DNS addresses to /etc/resolv.conf:
# cp /etc/resolv.conf /etc/resolv.conf-bak
# cat /etc/ppp/resolv.conf > /etc/resolv.conf

Labels: , , , , , ,

Saturday, 10 May 2008

the one with slackware linux and configuring its wireless settings

I have an Acer Aspire 5050 laptop. It has a built-in wireless network adapter called Broadcom 802.11g. Now, installing and configuring Broadcom driver in Slackware 12.1 is a bit pain in the ass. The shipped kernel modules did not work as expected. These are the steps necessary to get the little bugger to work:

Download ndiswrapper [link] package, then `slackbuild' it, and then `installpkg' it. (Thanks to Eric Hameleers for the slackbuild script).

Get Broadcom windows driver. You'd only need two files here: the bcmwl5.inf and the bcmwl5.sys one. You could fetch it from your preexisting windows driver (which could be found in C:\windows\system32\drivers) or Google for it.

Install the driver by issuing the command (put the inf and the sys in the same directory):
# ndiswrapper -i bcmwl5.inf

Check that the driver is installed correctly:
# ndiswrapper -l
bcmwl5 : driver installed
device (14E4:4318) present

Make sure that your wireless device is listed there (e.g. wlan0 in my system).
# iwconfig
wlan0 IEEE 802.11g ESSID:off/any
Mode:Managed Frequency:2.462 GHz Access Point: Not-Associated
Bit Rate:54 Mb/s Tx-Power:32 dBm
RTS thr:2347 B Fragment thr:2346 B
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

Now scan for other wireless devices within range (Note: replace wlan0 with your device name):
# iwlist wlan0 scanning
wlan0 Scan completed :
Cell 01 - Address: 00:14:BF:DC:13:B1
ESSID:"free-hotspot"
Protocol:IEEE 802.11g
Mode:Managed
Frequency:2.437 GHz (Channel 6)
Quality:56/100 Signal level:-60 dBm Noise level:-96 dBm
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
11 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
Extra:atim=0

Okay these two scenarios below can be used as examples:

Scenario 1: Connect to an open ad-hoc network called "karousel" with manual (a.k.a static) IP setting.
# iwconfig wlan0 essid "karousel" mode ad-hoc
# ifconfig wlan0 192.168.1.12 netmask 255.255.255.0 up

Scenario 2: Connect to a protected access point called "free-hotspot", with access key of "12345", and with auto (a.k.a DHCP) IP setting.
# iwconfig wlan0 essid "free-hotspot" mode managed key s:12345
# dhcpcd wlan0

I might add more scenarios/examples later in the future. Have fun!

Labels: , , , ,

the one where this content should be ignored

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur lobortis nulla id lorem. Quisque a purus id augue facilisis pharetra. Nulla est. Maecenas velit risus, mattis sit amet, elementum et, dapibus nec, lectus. Nunc sed mauris. Proin ullamcorper. Donec quis nisl at quam sodales sagittis. Vivamus hendrerit, nibh at vulputate semper, lectus arcu pharetra enim, in molestie nisl mauris faucibus urna. Nulla semper, pede et bibendum hendrerit, nisl sem porta nibh, eu mattis nibh lectus a nisl. Duis id lorem. Cras quis nibh. Cras eget enim.

Aliquam ut ante non nisl facilisis imperdiet. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce scelerisque cursus neque. Nulla venenatis erat ut dui lobortis egestas. Phasellus ipsum felis, molestie non, ornare eu, placerat non, odio. Aenean tortor. Morbi bibendum mauris a mauris. Sed nunc tellus, tristique malesuada, malesuada in, scelerisque nec, erat. Nullam quis nulla vel lectus lobortis placerat. Nam et metus eget dui euismod pharetra.