BlackBerry Torch device with Linux

BlackBerry

Introduction

Here, you find a documentation about using BlackBerry with Linux. In particular, I use the BlackBerry Torch 9800.
This BlackBerry device replaces my old Storm.

If you have any questions, we can join me in using this blog.

Hardware

CPU 624 MHz Marvell PXA940
Memory 512 MB Flash (flash memory)
4 GB onboard memory
Expandable memory – support for microSD card
Camera 5 Mega Pixels with flash and autofocus
Display 3.25 in (8.3 cm) TFT-LCD with 360 X 480 pixel resolution and able to display 624 MHz Marvell PXA940 colors.
Battery DX-1 Li-ion battery (5.5 hours of GSM talk time, 6 hours of CDMA talk time, or 360 hours of standby).
Size 4.43″ / 111mm (Length)
2.42″ / 62mm (Width)
0.55″ / 14.6mm (Depth)
161g (Weight)
Others Built-in GPS, Bluetooth 2.1 + EDR, Wireless LAN, 3.5mm stereo headset capable

BlackBerry Package

I have received my new BlackBerry before the Christmas 2010. The presentation is very sober.

There isn’t surprise ; it’s a correct quality. It’s a professionnal product.

Using BlackBerry with Linux

Debian unstable

I used to work with a Debian distribution, so I choose a Debian and in particular a Sid Debian (or unstable)

Normally, it should be exactly the same proceed with the others distributions.

At first, I need to synchronize my BlackBerry with my Desktop software (address book, calendar, memos, tasks…).
I use Evolution. I want to be able to list, load and remove Java applications on my device. I want to be able to
use my device as a network modem.

So, I’m going to test our great tool “Barry” with this new device and most of the new BlackBerry OS.

BlackBerry tools

Barry is an Open Source application that will provide synchronization, backup, restore and program management
for BlackBerry devices. Barry is primarily developed on Linux, but is intended as a cross platform library and
application set, targeting Linux, BSD, 32/64bit, and big/little endian systems.

With the last release, it is possible to :

  • charge your Blackberry’s battery from your USB port
  • retrieve Address Book, Email, Calendar, Service Book, Memos, Tasks, PIN Messages, Saved Email, and Folders
  • export Address Book contacts in text, vCard or LDAP LDIF format
  • make full data backups and restores of your device using a GUI
  • synchronize contacts, calendar, memos and tasks items using the OpenSync framework
  • use the Blackberry as a modem
  • read the saved data

At first, we have to build the project :

[root@Dahlia /root]$ cd /usr/local/src/
[root@Dahlia src]$ mkdir blackberry
[root@Dahlia src]$ cd blackberry
[root@Dahlia blackberry]$ git clone git://repo.or.cz/barry.git barry
[root@Dahlia blackberry]$ cd barry
[root@Dahlia barry]$ ./buildgen.sh
[root@Dahlia barry]$ ./configure --enable-gui
[root@Dahlia barry]$ make
[root@Dahlia barry]$ make install 

To be able to use barry with a user account, you have to edit the udev configuration to get the good permissions when you plug your Blackberry.

[root@Dahlia /root]$ cd /usr/local/src/blackberry/barry
[root@Dahlia barry]$ cp udev/10-blackberry.rules udev/99-blackberry-perms.rules /etc/udev/rules.d/
[root@Dahlia barry]$ /etc/init.d/udev restart

After barry installation, you can use the barry tools :

[root@Dahlia /root]$ bidentify
12345678, RIM BlackBerry Device
[root@Dahlia /root]$ btool -t
Blackberry devices found:
Device ID: 0x25a6360. PIN: 12345678, Description: RIM BlackBerry Device
Using device (PIN): 12345678
Database database:
    Database: 0x0 'PasswordKeeper Options' (records: 1)
    Database: 0x1 'PasswordKeeper' (records: 1)
    Database: 0x2 'VideoRecorder Options' (records: 1)
    Database: 0x3 'Camera Options' (records: 1)
    Database: 0x4 'Alarm Options' (records: 1)
    Database: 0x5 'Enhanced Gmail Plug-in' (records: 1)
    Database: 0x6 'Clock Options' (records: 1)
    Database: 0x7 'Alarms' (records: 0)
    Database: 0x8 'Tasks' (records: 3)
    Database: 0x9 'Browser Push Options' (records: 1)
    Database: 0xa 'Attachment Data' (records: 12)
    Database: 0xb 'Attachment Options' (records: 1)
    Database: 0xc 'MMS Messages' (records: 5)
    Database: 0xd 'MMS Options' (records: 1)
    Database: 0xe 'Tasks Options' (records: 1)
    Database: 0xf 'Secure Email Decision Maker' (records: 1)
    Database: 0x10 'Purged Messages' (records: 287)
    Database: 0x11 'Folders' (records: 6)
    Database: 0x12 'Folder Id' (records: 1)
    Database: 0x13 'SMS Messages' (records: 191)
    Database: 0x14 'Saved Email Messages' (records: 0)
    Database: 0x15 'PIN Messages' (records: 7)
    Database: 0x16 'Messages' (records: 622)
    Database: 0x17 'Mailbox Icon Management Options' (records: 1)
    Database: 0x18 'Phone Call Logs' (records: 56)
    Database: 0x19 'Phone History' (records: 34)
    Database: 0x1a 'Searches' (records: 22)
    Database: 0x1b 'Spell Check Options' (records: 1)
    Database: 0x1c 'Phone Options' (records: 1)
    Database: 0x1d 'Text Messages' (records: 31)
    Database: 0x1e 'Input Learning Data' (records: 49)
    Database: 0x1f 'WAP Push Messages' (records: 0)
    Database: 0x20 'Browser Options' (records: 1)
    Database: 0x21 'Browser Cache' (records: 5)
    Database: 0x22 'Browser Channels' (records: 0)
    Database: 0x23 'Browser Messages' (records: 0)
    Database: 0x24 'Browser Folders' (records: 2)
    Database: 0x25 'External Bookmarks' (records: 0)
    Database: 0x26 'Browser Bookmarks' (records: 13)
    Database: 0x27 'Recipient Cache' (records: 1)
    Database: 0x28 'Bluetooth Options' (records: 1)
    Database: 0x29 'Attachment Data - Calendar' (records: 0)
    Database: 0x2a 'Calendar Options' (records: 1)
    Database: 0x2b 'Memory Cleaner Options' (records: 1)
    Database: 0x2c 'Mobile Network Options' (records: 1)
    Database: 0x2d 'Memos' (records: 5)
    Database: 0x2e 'Shortcut Settings' (records: 1)
    Database: 0x2f 'EntryPoint Settings' (records: 86)
    Database: 0x30 'Theme Settings' (records: 1)
    Database: 0x31 'Profiles Options' (records: 1)
    Database: 0x32 'Recent Contacts' (records: 9)
    Database: 0x33 'Voice Activated Dialing Options' (records: 1)
    Database: 0x34 'Address Book Options' (records: 1)
    Database: 0x35 'Sounds' (records: 19)
    Database: 0x36 'Address Book - Last Used Hints' (records: 1)
    Database: 0x37 'Categories' (records: 2)
    Database: 0x38 'Message List Options' (records: 1)
    Database: 0x39 'MemoPad Options' (records: 1)
    Database: 0x3a 'Input Method Switcher Option' (records: 1)
    Database: 0x3b 'WLAN Profiles' (records: 6)
    Database: 0x3c 'Application Permissions' (records: 244)
    Database: 0x3d 'Default Content Handlers' (records: 0)
    Database: 0x3e 'Suretype options' (records: 1)
    Database: 0x3f 'Predictive Multitap options' (records: 1)
    Database: 0x40 'SpellCheckable options' (records: 1)
    Database: 0x41 'Content Store' (records: 0)
    Database: 0x42 'Default Service Selector' (records: 3)
    Database: 0x43 'Service Book' (records: 17)
    Database: 0x44 'Code Module Group Properties' (records: 78)
    Database: 0x45 'Time Zones' (records: 91)
    Database: 0x46 'Full-predictive options' (records: 1)
    Database: 0x47 'Input Method Options' (records: 21)
    Database: 0x48 'Configuration Channel' (records: 5)
    Database: 0x49 'Random Pool' (records: 1)
    Database: 0x4a 'Smart Card Options' (records: 1)
    Database: 0x4b 'Certificate Options' (records: 0)
    Database: 0x4c 'TLS Options' (records: 1)
    Database: 0x4d 'Firewall Options' (records: 1)
    Database: 0x4e 'Key Store Options' (records: 1)
    Database: 0x4f 'KeyStoreManager' (records: 1)
    Database: 0x50 'PGP Key Store' (records: 0)
    Database: 0x51 'Handheld Key Store' (records: 137)
    Database: 0x52 'Trusted Key Store' (records: 98)
    Database: 0x53 'AutoText Data Version' (records: 1)
    Database: 0x54 'AutoText' (records: 356)
    Database: 0x55 'RMS Databases' (records: 12)
    Database: 0x56 'Handheld Configuration' (records: 0)
    Database: 0x57 'Options' (records: 21)
    Database: 0x58 'Device Options' (records: 0)
    Database: 0x59 'Policy' (records: 1)
    Database: 0x5a 'CustomWordsCollection' (records: 840)
    Database: 0x5b 'Input System Properties' (records: 1)
    Database: 0x5c 'Location Based Services' (records: 0)
    Database: 0x5d 'Maps' (records: 3)
    Database: 0x5e 'Map Global Options' (records: 1)
    Database: 0x5f 'Map Locations' (records: 1)
    Database: 0x60 'Map Settings' (records: 1)
    Database: 0x61 'Diagnostic App Options' (records: 1)
    Database: 0x62 'File Explorer Options' (records: 1)
    Database: 0x63 'File Explorer Network Favorites' (records: 0)
    Database: 0x64 'File Explorer Network History' (records: 0)
    Database: 0x65 'Messenger Options (WLM)' (records: 1)
    Database: 0x66 'Messenger Options (AIM)' (records: 1)
    Database: 0x67 'Messenger Options (GoogleTalk)' (records: 1)
    Database: 0x68 'SQLite Keys' (records: 1)
    Database: 0x69 'TCP/IP Options' (records: 1)
    Database: 0x6a 'Quick Contacts' (records: 0)
    Database: 0x6b 'Messenger Options (Yahoo!)' (records: 1)
    Database: 0x6c 'BlackBerry Messenger' (records: 1)
    Database: 0x6d 'BIS Account Data' (records: 1)
    Database: 0x6e 'Bloomberg Settings' (records: 6)
    Database: 0x6f 'BBGroups' (records: 14)
    Database: 0x70 'DocsToGoCommonPrefs' (records: 1)
    Database: 0x71 'SlideshowToGoPrefs' (records: 1)
    Database: 0x72 'WordToGoPrefs' (records: 1)
    Database: 0x73 'SheetToGoPrefs' (records: 1)
    Database: 0x74 'Handheld Agent' (records: 629)
    Database: 0x75 'Address Book' (records: 151)
    Database: 0x79 'Calendar' (records: 60)
    Database: 0x7c 'Address Book - All' (records: 151)
    Database: 0x7d 'PIM Folder List - All' (records: 0)
    Database: 0x7e 'Secure Credentials - All' (records: 0)
    Database: 0x7f 'Calendar - All' (records: 69)
    Database: 0x59 'Browser Bookmarks' (records: 2)

If you use ZSH shell, I have written small scripts for ZSH autocompletion.

[root@Dahlia /root]$ cd /usr/local/src/blackberry/barry
[root@Dahlia barry]$ mkdir ~/.zsh/comp.d/
[root@Dahlia barry]$ cp zsh/_bjavaloader zsh/_btool ~/.zsh/comp.d/

and to set ZSH :

[root@Dahlia /root]$ cat ~/.zshenv
# ---- language-env DON'T MODIFY THIS LINE!
# settings for french speaking users

# set LANG
export LANG=fr_FR.UTF-8
# ---- language-env end DON'T MODIFY THIS LINE!

# Zsh completions
export FPATH=$FPATH:$HOME/.zsh/comp.d

Barry application permits you to make backup and restore.

[root@Dahlia /root]$ barrybackup

BlackBerry synchronization

With the RIM tools, you can only synchronize your device with your computer in using a USB cable. You can’t synchronize over a Bluetooth session.

To sync your Blackberry with Evolution, you can use OpenSync 0.22 release and the command line tool msynctool.

[root@Dahlia /root]$ cd /usr/local/src/blackberry/barry
[root@Dahlia barry]$ cd opensync-plugin
[root@Dahlia opensync-plugin]$ ./configure
[root@Dahlia opensync-plugin]$ make
[root@Dahlia opensync-plugin]$ make install

As far as I’m concerned, I’m used to use the 0.4x release :

[root@Dahlia /root]$ cd /usr/local/src/blackberry/barry
[root@Dahlia barry]$ cd opensync-plugin-0.4x
[root@Dahlia opensync-plugin-0.4x]$ ./configure
[root@Dahlia opensync-plugin-0.4x]$ make
[root@Dahlia opensync-plugin-0.4x]$ make install

Now, Contacts, Calendar, Memos and Tasks items are currently supported in the Barry Opensync plugin.

To use the plugin opensync. First, check your plugin installation :

[root@Dahlia /root]$ osynctool --listplugins
Available plugins:
evo2-sync
syncml-http-server
syncml-http-client
syncml-obex-client
barry-sync

Now, we can create our group and set the usefull plugin.

[root@Dahlia /root]$ osynctool --addgroup BlackBerry
[root@Dahlia /root]$ osynctool --addmember BlackBerry evo2-sync
[root@Dahlia /root]$ osynctool --addmember BlackBerry barry-sync

You can check and read the member ID returned by the command.

[root@Dahlia /root]$ osynctool --showgroup BlackBerry
Group: BlackBerry
Member 1: evo2-sync
Member 2: barry-sync

Configure your plugins :

[root@Dahlia /root]$ osynctool --configure BlackBerry 1
<?xml version="1.0"?>
<config version="1.0">
 <Resources>
 <Resource>
 <Enabled>1</Enabled>
 <Formats>
 <Format>
 <Config>VCARD_EXTENSION=Evolution</Config>
 <Name>vcard30</Name>
 </Format>
 <Format>
 <Config>VCARD_EXTENSION=Evolution</Config>
 <Name>vcard21</Name>
 </Format>
 </Formats>
 <ObjType>contact</ObjType>
 <Url>file:///home/nicolas/.evolution/addressbook/local/system</Url>
 </Resource>
 <Resource>
 <Enabled>1</Enabled>
 <Formats>
 <Format>
 <Name>vevent20</Name>
 </Format>
 </Formats>
 <ObjType>event</ObjType>
 <Url>file:///home/nicolas/.evolution/calendar/local/system</Url>
 </Resource>
 <Resource>
 <Enabled>1</Enabled>
 <Formats>
 <Format>
 <Name>vtodo20</Name>
 </Format>
 </Formats>
 <ObjType>todo</ObjType>
 <Url>file:///home/nicolas/.evolution/tasks/local/system</Url>
 </Resource>
 <Resource>
 <Enabled>1</Enabled>
 <Formats>
 <Format>
 <Name>vjournal</Name>
 </Format>
 </Formats>
 <ObjType>note</ObjType>
 <Url>file:///home/nicolas/.evolution/memos/local/system</Url>
 </Resource>
 </Resources>
</config>
[root@Dahlia /root]$ osynctool --configure BlackBerry 2
<?xml version="1.0"?>
<config version="1.0">
 <AdvancedOptions>
 <AdvancedOption>
 <DisplayName>PIN number</DisplayName>
 <MaxOccurs>2147483647</MaxOccurs>
 <Max>2147483647</Max>
 <Name>PinCode</Name>
 <Type>string</Type>
 <Value>0x12345678</Value>
 </AdvancedOption>
 <AdvancedOption>
 <DisplayName>Debug mode</DisplayName>
 <MaxOccurs>2147483647</MaxOccurs>
 <Max>2147483647</Max>
 <Name>Debug</Name>
 <Type>bool</Type>
 <Value>0</Value>
 </AdvancedOption>
 </AdvancedOptions>
 <Authentication>
 <Username></Username>
 <Password></Password>
 </Authentication>
 <Resources>
 <Resource>
 <Enabled>1</Enabled>
 <Formats>
 <Format>
 <Name>vcard30</Name>
 </Format>
 </Formats>
 <Name>Contacts</Name>
 <ObjType>contact</ObjType>
 </Resource>
 <Resource>
 <Enabled>1</Enabled>
 <Formats>
 <Format>
 <Name>vevent20</Name>
 </Format>
 </Formats>
 <Name>Event</Name>
 <ObjType>event</ObjType>
 </Resource>
 </Resources>
</config>
[root@Dahlia /root]$ osynctool --discover BlackBerry 1
[root@Dahlia /root]$ osynctool --discover BlackBerry 2

Now, you are ready to sync your device with Evolution :

[root@Dahlia /root]$ osynctool --sync BlackBerry

BlackBerry Multimedia

This part describres the steps needed to encode an image, video or audio files so as to be able to read with a BlackBerry device.

To convert a video for my BlackBerry device, I have written a little script using ffmpeg.

[root@Dahlia root]$ cat > vid2bb.sh
#!/bin/sh

FILE=$1

RES=480x360

ffmpeg -y -i "$FILE" \
    -f mp4 \
    -s $RES \
    -acodec libfaac -async 4800 \
    -dts_delta_threshold 1 \
    -vcodec libxvid \
    -aspect 4:3 \
    -qscale 10 \
    "${FILE%.*}_bb.avi"

BlackBerry Java Loader

This part describes the steps needed to install a Java application on your BlackBerry device.

JavaLoader is provided with the Barry project. JavaLoader features permit you to install/remove applications on your device, list all the installed applications, make screenshot…

[root@Dahlia root]$ bjavaloader -h
bjavaloader - Command line USB Blackberry Java Loader
        Copyright 2008-2009, Nicolas VIVIEN.
        Copyright 2005-2010, Net Direct Inc. (http://www.netdirect.ca/)
        Using: Barry library version 0.17 (little endian)

   -A        Save all modules found
   -a        Wipe applications only
   -i        Wipe filesystem only
   -f        Force erase, if module is in use
   -h        This help
   -s        List sibling in module list
   -p pin    PIN of device to talk with
             If only one device is plugged in, this flag is optional
   -P pass   Simplistic method to specify device password
   -v        Dump protocol data during operation

commands

   dir [-s]
      Lists modules on the handheld

   deviceinfo
      Provides information on the handheld

   load <.cod file> ...
      Loads modules onto the handheld

   save [-A]  ...
      Retrieves modules from the handheld and writes to .cod file
      Note: will overwrite existing files!

   wipe [-a | -i]
      Wipes the handheld
      Use Caution: Wiping filesystem will remove all data
                   such as messages, contacts, etc.
                   Wiping applications will remove all .cod files
                   on the device, including OS .cod files.

   resettofactory
      Reset IT policy to factory defaults
      Use Caution: Resetting IT policy to factory defaults will
                   also perform a filesystem wipe which will remove
                   all data such as messages, contacts, etc.

   erase [-f]  ...
      Erase module from handheld

   eventlog
      Retrieves the handheld event log

   cleareventlog
      Clears the handheld event log

   logstacktraces
      Dump the stack traces for all threads to the event log

   screenshot <.bmp file>
      Make a screenshot of handheld

   settime [yyyy-mm-dd HH:MM:SS]
      Sets the time on the handheld to the current time
      Or the time specified as an argument to settime
      If given as argument, current system timezone is assumed

By sample, to load a new application :

[root@Dahlia root]$ bjavaloader load HelloWorldDemo.cod

To take a screen capture :

[root@Dahlia root]$ bjavaloader screenshot screen.bmp
This entry was posted in BlackBerry, Debian, Linux and tagged , , , . Bookmark the permalink.

13 Responses to BlackBerry Torch device with Linux

Leave a Reply to lepaul Cancel reply

Your email address will not be published. Required fields are marked *