Tethering With Blackberry Pearl On Linux



If you have questions/and or suggestions about this article, you can contact me at:


If you are going to use this, you should save this page now, to your laptop, cause when you are gonna need it, you probably won’t have a connection smile

This whole setup is sort of screwy, but hey it works !

Tethering will cost you a lot of money unless you have an unlimited data plan. Some phone companies, forbid it unless you ahve a special plan, some other allow it but won’t support it, some just plain disallow it.

I believe tethering should be allowed, but you should use that only as needed when on the road, users who use GB of data on a tether connection annoy me because 1) sooner or later they will be blocked anyway, 2) if too many people do that, phone companies might block tethering unless you buy an Expensive plan !
You are not helping anybody if you do this, be reasonable and enjoy tethering when you really need it, ex: in a crunch on the road.

Introduction


OK, i spent a LOT of time getting this dammed thing to work, but i did it !
First let me talk about the few options i tried:
  • Barry: this project on source forge provides a synchronization and they started modem support but it does not work yet.
  • XmBlackberry: This is the project that DOES work, however the site is very ’bare bone’ and almost no documentation exists. On top of that the latest time they made a release was over a year ago and that did not work. I was able to make it work with the live CVS version, though it was a pain to compile and get going.

I only managed to get tethering to work using BOTH Barry(to recognize the device properly) and XmBlackberry(modem support), so we will install both

I used Ubuntu Feisty Fawn for this doc, though same idea should work on other linux distros.
My device is a Blackberry Pearl (8100)
My Carrier is TMobile.

This works with the USB cable and not Bluetooth, i prefer the USB cable anyhow, it's faster and less chance to loose/forget my phone if tied to the laptop smile

Installing XmBlackberry from sources


The main issues i had here are:
  • XmBlackberry only works with the pearl with the CVS version.
  • The CVS version of XMBlackBerry will only compile with openmotif2.3 (2.2) won’t work
  • Debian does not have a packaged version of openmotif2.3 (the libmotif3 package is openmotif2.2)

If you use motif2.2 you will get errors like this:
undefined reference to ’XmVaCreatePushButton’

So as a result of all that the first step is to install openmotif2.3 from sources.

Prerequisites



If you have never compiled anything from sources before you will need at least to install those first (compiler)
sudo apt-get install libc6-dev g++ gcc make build-essential

To compile/install all those things i had to install the following packages first (not sure if i really needed ALL of those though)
sudo apt-get install libtool autoconf automake cvs libglib2.0-dev libxml2-dev libssl-dev libopensync0-dev libxt-dev x11proto-print-dev libxmu-dev libxft-dev libfreetype6-dev libXp-dev flex byacc libgd2-xpm-dev


Openmotif would not compile because libfreetype-dev installed files not where openmotif expected them (freetype & freetype2 dir), to compile i add to do this:

not sure if that is a safe thing to do(probably OK), so you might want to revert this after (move back) after compiling openmotif.
cd /usr/include/
sudo mv freetype freetype-back
sudo mv freetype2/freetype/ .

I also had to do this, to get XmBlackberry to run later:
sudo ln -s /usr/X11R6/lib/libXm.so.4 /usr/X11R6/lib/libXm.so.3


Installing OpenMotif 2.3



if you have motif3 you might need to remove it first. Honestly i’m not sure if it’s a good idea, so don’t do this unless you have to.
sudo apt-get remove libmotif3 libmotif-dev motif-clients

Installing motif2.3:
cd ~
wget ftp://ftp.ics.com/openmotif/2.3/2.3.0/openmotif-2.3.0.tar.gz
tar xzvf openmotif-2.3.0.tar.gz
cd openmotif-2.3.0/
./configure
make
sudo make install 


Installing XmBlackberry



XmBlackberry needs Xlt installed (from source)

Installing libXlt


cd ~
cvs -d :pserver:anonymous@xlt.cvs.sourceforge.net:/cvsroot/xlt co Xlt
cd Xlt
./CVSMake
./configure --prefix=/usr
make
sudo make install


XmBlackBerry


Get XmBlackberry source code

cd ~
cvs -d:pserver:anonymous@xmblackberry.cvs.sourceforge.net:/cvsroot/xmblackberry co XmBlackBerry


Inside xmBlackberry folder get libusb source code.
cd XmBlackBerry/
cvs -d :pserver:anonymous@libusb.cvs.sourceforge.net:/cvsroot/libusb co libusb


Compile/Install XMBlackberry
./CVSMake
./configure --enable-maintainer-mode --disable-shared
make
sudo make install


Install libusb as it will be needed by Barry
cd libusb
sudo make install


OpenSync


Install openSync (part of XmBlackberry)
cd ..
cd opensync
make
sudo make install


Installing Barry



cd ~
cvs -d:pserver:anonymous@barry.cvs.sourceforge.net:/cvsroot/barry login 
cvs -z3 -d:pserver:anonymous@barry.cvs.sourceforge.net:/cvsroot/barry co -P barry
cd barry
sh buildgen.sh
./configure --prefix=/usr
make
sudo make install


Running XmBlackberry



you will notice i run most of the following command with sudo, that is because otherwise it would fail, due i think to USB device permissions on Debian, ideally it would probably be best to fix those permissions rather than tun those thing under sudo.

PLUG YOUR BLACKBERRY NOW WITH THE USB CABLE.

There is an issue whereas the module usb_storage takes over the Blacberry device as soon as it is plugged in and thus XmBB can't use/see it.

We are gonna run Barry's bcharge, this has two uses here:
1) It will regrab the device from usb_storage
2) It will set the BB charging current to 500ma instead of 100ma, this will make the BB happy (no more warning) and allow it to dialog correctly with XmBB.

Because of a driver issue on the pearl we have to run bcharge twice, sounds odd, but is needed, as you will see on the second call the device will be found.

sudo bcharge
sudo bcharge -o


Now, the device should be found. Example: sudo btool -l
Blackberry devices found:
Device ID: 0x80xxxx. PIN: 241xxxx, Description: RIM 8100 Series Colour GPRS Handheld



you can had Barry to udev, so it automatically runs when the BB is connected.
cp /home/thibautc/barry/udev/*b* /etc/udev/rules.d/
I haven't tried this yet.

Now we are ready to run XmBlackberry.
sudo XmBlackberry

Once XmBlackBerry opens, click the Options Menu, this should dump something like this on the console:
XmBlackBerry.c:OptionPopupCallback(995) - GPRS modem device /dev/pts/0


If you see that, you are in business ! it found your GRPS modem !

Note “/dev/pts/0”, this is going to be your modem device.
If you have other device it might be another number rather than 0, note this.


Tethering & connecting to GPRS / EDGE


You will want to have XmBlackberry up to be able to use the BB modem, so if not already running, restart it now.

PPP scripts



I found multiple pp scripts online, but none of them worked as-is, by combining some i found something working for me:

You will need to create those two files:

if you don’t use t-mobile, you will have to adjust the ’AT+CGDCONT=1,“IP","wap.voicestream.com”’ line.
sudo vi /etc/chatscripts/blackberry
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED ABORT ERROR
SAY "Initializing\n"
'' ATZ
SAY "ATE\n"
OK 'AT+CGDCONT=1,"IP","wap.voicestream.com"'
OK 'AT'
OK 'ATDT*99***1#'
SAY "Dialing\n"


If XmBlackberry found your device somewhere else that /dev/pts/0 then adjust the file. T-Mobile use blank user and password, other carriers might want something else, adjust as needed.
sudo vi /etc/ppp/peers/blackberry
debug debug debug
nodetach
/dev/pts/0
115200
connect "/usr/sbin/chat -f /etc/chatscripts/blackberry"
nomultilink
defaultroute
noipdefault
ipcp-restart 7
ipcp-accept-local
ipcp-accept-remote
#need lcp-echo turned off, at least for t-mobile, otherwise c0onnectin
# disconnects after few mn of inactivity.
# thanks to 'loon' for this info
lcp-echo-interval 0
lcp-echo-failure 999
modem
noauth
nocrtscts
noipdefault
novj # refused anyway, no point in trying every time
usepeerdns
user ""
password ""



Once this is setup, you are ready to get connected ... Finally !

sudo pppd call blackberry

If all goes well you should get something like this:
sudo pppd call blackberry
Initializing
Dialing
Serial connection established.
using channel 15
Using interface ppp0
Connect: ppp0 <--> /dev/pts/0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x682edbe8> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x10 <asyncmap 0x0> <auth chap MD5>]
.....
sent [PAP AuthReq id=0x1 user="thibautc-laptop" password=<hidden>]
.....
PAP authentication succeeded
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
......
local  IP address 10.169.13.231
remote IP address 169.254.1.1
primary   DNS address 66.94.9.120
secondary DNS address 66.94.25.120
Script /etc/ppp/ip-up started (pid 20529)
Script /etc/ppp/ip-up finished (pid 20529), status = 0x0
........


Make sure all your other interfaces (wireless/ethernet) are down, and enjoy browsing the web using your BB modem !

I actually posted this page using my Tethered connection !!

Links


I used a compilation of other docs to get to this results, among others:

http://sourceforge.net/projects/barry/
http://sourceforge.net/projects/xmblackberry
http://www.netdirect.ca/software/packages/barry/hacking.php
http://www.blackberryforums.com/linux-users-corner/87609-7290-gprs-modem-over-usb-linux-success.html
http://www.blackberryforums.com/linux-users-corner/65653-howto-use-bcharge-charge-your-bb-under-linux.html
http://www.fibble.org/BlackBerry%208800
http://forums.fibble.org/viewtopic.php?t=29
http://www.blackberryforums.com/mac-users-corner/67792-8100-bt-modem-works-few-mins-then-disconnects.html
http://www.blackberryforums.com/general-8700-series-discussion/56147-8703e-modem-under-linux-works.html






Last modified: Mon Jun 02 12:12:55 EDT 2008 by Thibaut Colar

Post time:07/25/2008 00:48 By:Guest (Guest)
Title: Tethering a BlackBerry to Ubuntu 8.04 with Alltel.
I followed this tutorial, but I struggled for a while with the pppd scripts due to alltel not allowing APN.

So here’s how to get your tether working on Ubuntu if you have Alltel. I have an 8830 WE but this probably works with others as well.

1. Follow the above articles instructions until it gets to the section on PPP scripts.

2. Edit /etc/wvdial.conf to:

[Modem0]
Modem = /dev/pts/x(this number tends to change)
Baud = 115200
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
FlowControl = Hardware (CRTSCTS)
[Dialer blackberry]
Username = 10digitphone#@bb.alltel.net
Password = alltel
Phone = #777
Stupid Mode = 1
Inherits = Modem0

3. Connect your BB and run “sudo bcharge” in a terminal. If you get an error saying possible Kernel conflict thats ok.

4. Run “sudo XmBlackBerry" then when it finishes it should say "ip_modem.c:NewIpModem [...] ’/dev/pts/3’” That last digit may change each time you connect your BB so you’ll have to edit the /etc/wvdial.conf file accordingly before you run wvdial.

5. Open a seperate terminal and run “sudo wvdial blackberry” If it displays an IP address then you’re in business!

Any questions email me chainy1 at gmail

Post time:07/19/2008 19:03 By:slackcub (Guest) (Guest)
Title: GPRS modem device not available
ok, I figured out my last problem. It was because I had a smart card in the blackberry and bcharge wasn’t grabbing it. but now I get this on the console when I’m running XmBlackBerry:

GPRS modem device Not available

Post time:07/19/2008 18:53 By:slackcub (Guest) (Guest)
Title: can’t find device
when I run bcharge, I get this:

Scanning for Blackberry devices...
Found device #12...adjusting charge setting...adjusting Pearl mode to dualDetecting possible kernel driver conflict, trying to resolve...

usb_reset failed: could not reset: No such device
...done

I am running Slackware 11.0, with a Blackberry Pearl 8130, Sprint service. any help you could give me would be greatly appreciated!

Post time:05/30/2008 12:01 By:admin
Title: From The author
- To bzz: I fixed my weeky, so it does not use
“fancy” curley’s / quotes in the code block (that caused problems), it was not suppose to do that but there was a bug in my wiki.

- For: M4 not found, exiting
You need to install the m4 package for your distro, usually it’s part of build-essentials, or just run ’apt-get install m4’ on debain

- For: firefox goes in offline mode:
You probably still have another connection active and ffox is trying to use it . you will want to turn off or disable other connections, this can be done in network manager or something like ’ifconfig eth0 down’

Post time:05/15/2008 20:48 By:Guest (Guest)
Title: Great Idea!
I’m very much trying to get this working, it’s a wonderful idea! And the install process seems to work just fine so far but I just hit ’Installing libXlt“ and I get the message ”M4 not found, exiting.’ I’m afraid the script itself isn’t too clear on which .m4 it’s looking for. Do you have any suggestions? Thanks!

Post time:05/11/2008 15:02 By:Danny (Guest)
Title: Problem Using Internet Connection Once ppp0 Adaptor Established
Excellent tutorial. I have everything working including getting a ppp connection w/ remote and local ips.
I used an addendum to this tutorial for verizon phones:
http://www.blackberryforums.com/linux-users-corner/101715-how-verizon-8703e-usb-tethered-linux-ubuntu-7-10-a.html#post925339

Unfortunately when I try to use it Firefox goes into offline browsing mode.

Any hints on what I am missing?

Post time:04/16/2008 23:06 By:bzz (Guest)
Title: I forgot to add...
I LOVE YOU! I LOVE YOU! I LOVE YOU! I LOVE YOU! I LOVE YOU! I LOVE YOU! I LOVE YOU! I LOVE YOU! I LOVE YOU!

:)

Post time:04/16/2008 23:03 By:bzz (Guest)
Title: You ROCK!
I have the exact same setup as you, I ran into a few issues though..

1. Had an issue installing barry using the script, but I downloaded the package from SF.net, installed it and moved on.

2. It’s ’sudo XmBlackBerry’ just a small oversight :P

3. Last but not least: While copying the scripts, just remember to change the fancy double quotes to the generic " and the same goes with the single quotes ’. :) If you get errors with the scripts, check this first!!!

Post time:03/27/2008 20:59 By:coteyr (Guest)
Title: compile motif problem
if you get missing bitmap errors when compiling openmotif try ’sudo apt-get install xbitmaps’

Post time:03/23/2008 19:24 By:Craig T. (Guest)
Title: 8830
I have an 8830 and Sprint, and I am unable to get it working. I am able to get XmBlackBerry to see it, and it is showing on /dev/pts/1, but when I try to connect using pppd or wvdial, I don’t have any luck. Any help would be greatly appreciated.