BlackBerry on Linux

BlackBerry device

Introduction  

Here, you find a documentation about using BlackBerry with Linux. In particular, I use the BlackBerry Storm 9530.

This document isn't still finished.

If you have any questions, we can join me :
progweb -AT- free.fr

Hardware  
CPU 624 MHz MSM7600 CPU from Qualcomm
Memory 128 MB Flash (flash memory)
1 GB onboard memory
Expandable memory - support for microSD card
Camera 3.2 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 65,536 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"/112.5mm (Length)
2.45"/62.2mm (Width)
0.55"/13.95mm (Depth)
5.5 oz/155g (Weight)
Others Built-in GPS, 3.5mm stereo headset capable
BlackBerry Package  

   

I have received my new BlackBerry before the Christmas 2008. 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.

I describe how I use my blackberry with Linux.

BlackBerry tools  

I use the last release of Barry project. 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

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: 0x806ea00. PIN: 12345678, Description: RIM BlackBerry Device
Using device (PIN): 12345678
Database database:
    Database: 0x0 'WTLS Options' (records: 1)
    Database: 0x1 'Message List Options' (records: 1)
    Database: 0x2 'CustomWordsCollection' (records: 12)
    Database: 0x3 'Key Store Options' (records: 1)
    Database: 0x4 'Address Book - All' (records: 96)
    Database: 0x5 'AutoText Data Version' (records: 1)
    Database: 0x6 'Map Locations' (records: 2)
    Database: 0x7 'Theme Settings' (records: 1)
    Database: 0x8 'Random Pool' (records: 1)
    Database: 0x9 'Purged Messages' (records: 0)
    Database: 0xa 'Phone Options' (records: 1)
    Database: 0xb 'Policy' (records: 1)
    Database: 0xc 'Browser Options' (records: 1)
    Database: 0xd 'Spell Check Options' (records: 1)
    Database: 0xe 'Calendar Options' (records: 1)
    Database: 0xf 'Sounds' (records: 18)
    Database: 0x10 'Location Based Services' (records: 0)
    Database: 0x11 'SlideshowToGoPrefs' (records: 1)
    Database: 0x12 'Trusted Key Store' (records: 47)
    Database: 0x13 'Suretype options' (records: 1)
    Database: 0x14 'Profiles Options' (records: 1)
    Database: 0x15 'Clock Options' (records: 1)
    Database: 0x16 'SheetToGoPrefs' (records: 1)
    Database: 0x17 'Handheld Configuration' (records: 0)
    Database: 0x18 'Folders' (records: 0)
    Database: 0x19 'PasswordKeeper Options' (records: 1)
    Database: 0x1a 'WAP Push Messages' (records: 0)
    Database: 0x1b 'Memos' (records: 0)
    Database: 0x1c 'Code Module Group Properties' (records: 44)
    Database: 0x1d 'DocsToGoCommonPrefs' (records: 1)
    Database: 0x1e 'MemoPad Options' (records: 1)
    Database: 0x1f 'Quick Contacts' (records: 0)
    Database: 0x20 'Input Learning Data' (records: 4)
    Database: 0x21 'Smart Card Options' (records: 1)
    Database: 0x22 'Browser Data Cache' (records: 10)
    Database: 0x23 'Memory Cleaner Options' (records: 1)
    Database: 0x24 'Application Permissions' (records: 31)
    Database: 0x25 'PIN Messages' (records: 0)
    Database: 0x26 'Tasks' (records: 0)
    Database: 0x27 'Attachment Options' (records: 1)
    Database: 0x28 'Browser Push Options' (records: 1)
    Database: 0x29 'Device Options' (records: 0)
    Database: 0x2a 'Browser Urls' (records: 1)
    Database: 0x2b 'Certificate Options' (records: 0)
    Database: 0x2c 'Calendar' (records: 3)
    Database: 0x2d 'Attachment Data' (records: 0)
    Database: 0x2e 'WordToGoPrefs' (records: 1)
    Database: 0x2f 'TLS Options' (records: 1)
    Database: 0x30 'Browser Channels' (records: 0)
    Database: 0x31 'Compatibility Settings' (records: 1)
    Database: 0x32 'Categories' (records: 2)
    Database: 0x33 'Browser Messages' (records: 0)
    Database: 0x34 'Saved Email Messages' (records: 0)
    Database: 0x35 'Options' (records: 12)
    Database: 0x36 'Service Book' (records: 12)
    Database: 0x37 'Input Method Switcher Option' (records: 1)
    Database: 0x38 'Searches' (records: 6)
    Database: 0x39 'RMS Databases' (records: 6)
    Database: 0x3a 'Phone Call Logs' (records: 31)
    Database: 0x3b 'Messages' (records: 2)
    Database: 0x3c 'Folder Id' (records: 1)
    Database: 0x3d 'Content Store' (records: 0)
    Database: 0x3e 'AutoText' (records: 312)
    Database: 0x3f 'MMS Messages' (records: 1)
    Database: 0x40 'BlackBerry Messenger' (records: 1)
    Database: 0x41 'VideoRecorder Options' (records: 1)
    Database: 0x42 'Tasks Options' (records: 1)
    Database: 0x43 'Calendar - All' (records: 3)
    Database: 0x44 'SMS Messages' (records: 13)
    Database: 0x45 'Alarm Options' (records: 1)
    Database: 0x46 'Voice Activated Dialing Options' (records: 1)
    Database: 0x47 'PasswordKeeper' (records: 0)
    Database: 0x48 'Handheld Key Store' (records: 47)
    Database: 0x49 'Camera Options' (records: 1)
    Database: 0x4a 'File Explorer Options' (records: 1)
    Database: 0x4b 'MMS Options' (records: 1)
    Database: 0x4c 'Bluetooth Options' (records: 1)
    Database: 0x4d 'Handheld Agent' (records: 290)
    Database: 0x4e 'Default Service Selector' (records: 3)
    Database: 0x4f 'Browser Folders' (records: 2)
    Database: 0x50 'Firewall Options' (records: 1)
    Database: 0x51 'KeyStoreManager' (records: 1)
    Database: 0x52 'Map Settings' (records: 1)
    Database: 0x53 'Alarms' (records: 0)
    Database: 0x54 'Diagnostic App Options' (records: 1)
    Database: 0x55 'PGP Key Store' (records: 0)
    Database: 0x56 'Address Book Options' (records: 1)
    Database: 0x57 'Address Book' (records: 96)
    Database: 0x58 'Time Zones' (records: 88)
    Database: 0x59 'Browser Bookmarks' (records: 2)

If you use the barry GIT repository, I have written small scripts for ZSH autocompletion.

[root@Dahlia /root]$ cd /usr/local/src/blackberry/barry
[root@Dahlia barry]$ cp zsh/_bjavaloader zsh/_btool /usr/share/zsh/functions/Completion/Unix

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, using OpenSync version 0.22 and the command line tool msynctool. The OpenSync 0.22 branch is the last stable release.

[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

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

I have worked to port the opensync barry plugin with the opensync branch 0.4x. And I have added the memos and tasks support.

[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

To use the plugin opensync branch 0.4x. 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 MTP  

This part describes the steps needed to send a multimedia file to BlackBerry device.

[root@Dahlia root]$ mkdir -p /usr/local/src/mtp
[root@Dahlia root]$ cd /usr/local/src/mtp
[root@Dahlia mtp]$ cvs -d:pserver:anonymous@libmtp.cvs.sourceforge.net:/cvsroot/libmtp login
[root@Dahlia mtp]$ cvs -z3 -d:pserver:anonymous@libmtp.cvs.sourceforge.net:/cvsroot/libmtp co -P libmtp
[root@Dahlia mtp]$ cd libmtp
[root@Dahlia libmtp]$ ./configure
[root@Dahlia libmtp]$ make
[root@Dahlia libmtp]$ make install

If all is OK, you can check that your BlackBerry is detected as a MTP device.

WARNING, the mass-storage mode has to be disabled.

[root@Dahlia root]$ mtp-detect
Device 0 (VID=0fca and PID=8007) is a RIM BlackBerry Storm.
libmtp version: 1.0.1

Listing raw device(s)
   Found 1 device(s):
   RIM: BlackBerry Storm (0fca:8007) @ bus 0, dev 6
Attempting to connect device(s)
USB low-level info:
   Using kernel interface "usbfs"
   bcdUSB: 512
   bDeviceClass: 0
   bDeviceSubClass: 0
   bDeviceProtocol: 0
   idVendor: 0fca
   idProduct: 8007
   IN endpoint maxpacket: 512 bytes
   OUT endpoint maxpacket: 512 bytes
   Raw device info:
      Bus location: 0
      Device number: 6
      Device entry info:
         Vendor: RIM
         Vendor id: 0x0fca
         Product: BlackBerry Storm
         Vendor id: 0x8007
         Device flags: 0x04000003
Configuration 0, interface 1, altsetting 0:
   Interface description contains the string "MTP"
   Device recognized as MTP, no further probing.
Device info:
   Manufacturer: Research In Motion
   Model: 9500
   Device version: 100
   Serial number: 00000000-12345678-a000000d757cc0
   Vendor extension ID: 0x00000006
   Vendor extension description: microsoft.com: 1.0; microsoft.com/WMDRMPD: 10.1; microsoft.com/WMPPD: 11.0; vodafone.com/omadrmv2: 1.0;
   Detected object size: 64 bits
Supported operations:
   1001: get device info
   1002: Open session
   1003: Close session
   1004: Get storage IDs
   1005: Get storage info
   1006: Get number of objects
   1007: Get object handles
   1008: Get object info
   1009: Get object
   100a: Get thumbnail
   100b: Delete object
   100c: Send object info
   100d: Send object
   1014: Get device property description
   1015: Get device property value
   1016: Set device property value
   1017: Reset device property value
   101b: Get partial object
   9801: Get object properties supported
   9802: Get object property description
   9803: Get object property value
   9804: Set object property value
   9805: Get object property list
   9806: Set object property list
   9201: Report Added/Deleted Items
   9202: Report Acquired Items
   9810: Get object references
   9811: Set object references
   9101: Get secure time challenge
   9104: Get sync list
   9106: Get meter challenge
   9108: Clean data store
   9102: Get secure time response
   9103: Set license response
   9105: Send meter challenge query
   9107: Get meter response
   9109: Get license state
Events supported:
   0x4001
   0x4004
   0x4005
   0x4008
Device Properties Supported:
   0x5001: Battery Level
   0xd401: Synchronization Partner
   0xd402: Friendly Device Name
   0xd102: Device Certificate
   0xd404: Unknown property
Playable File (Object) Types and Object Properties Supported:
   b984: 3GP
      dc01: Storage ID UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc02: Object Format UINT16 data type ANY 16BIT VALUE form READ ONLY
      dc03: Protection Status UINT16 data type enumeration: 0, 1,  READ ONLY
      dc04: Object Size UINT64 data type READ ONLY
      dc07: Object File Name STRING data type GET/SET
      dc0b: Parent Object UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc41: Persistant Unique Object Identifier UINT128 data type READ ONLY
      dc44: Name STRING data type GET/SET
      dc4f: Non Consumable UINT8 data type enumeration: 0, 1,  GET/SET
      dc09: Date Modified STRING data type DATETIME FORM READ ONLY
      dc46: Artist STRING data type GET/SET
      dc8b: Track UINT16 data type ANY 16BIT VALUE form GET/SET
      dc8c: Genre STRING data type GET/SET
      dc91: Use Count UINT32 data type ANY 32BIT VALUE form GET/SET
      dc9a: Album Name STRING data type GET/SET
      dc9b: Album Artist STRING data type GET/SET
      de93: Sample Rate UINT32 data type range: MIN 8000, MAX 48000, STEP 50 READ ONLY
      de94: Number Of Channels UINT16 data type enumeration: 0, 1, 2,  READ ONLY
      de99: Audio WAVE Codec UINT32 data type enumeration: 0, 352, 353, 85,  READ ONLY
      de9a: Audio Bit Rate UINT32 data type range: MIN 1, MAX 1500000, STEP 1 READ ONLY
      dc89: Duration UINT32 data type range: MIN 0, MAX 10000000, STEP 1 READ ONLY
      dc9d: DRM Status UINT16 data type enumeration: 0, 1,  GET/SET
      db02: Unknown property array of UINT8 data type byte array:  GET/SET
      db01: Unknown property UINT8 data type enumeration: 0, 1,  GET/SET
   3009: MP3
      dc01: Storage ID UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc02: Object Format UINT16 data type ANY 16BIT VALUE form READ ONLY
      dc03: Protection Status UINT16 data type enumeration: 0, 1,  READ ONLY
      dc04: Object Size UINT64 data type READ ONLY
      dc07: Object File Name STRING data type GET/SET
      dc0b: Parent Object UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc41: Persistant Unique Object Identifier UINT128 data type READ ONLY
      dc44: Name STRING data type GET/SET
      dc4f: Non Consumable UINT8 data type enumeration: 0, 1,  GET/SET
      dc09: Date Modified STRING data type DATETIME FORM READ ONLY
      dc46: Artist STRING data type GET/SET
      dc8b: Track UINT16 data type ANY 16BIT VALUE form GET/SET
      dc8c: Genre STRING data type GET/SET
      dc91: Use Count UINT32 data type ANY 32BIT VALUE form GET/SET
      dc9a: Album Name STRING data type GET/SET
      dc9b: Album Artist STRING data type GET/SET
      de93: Sample Rate UINT32 data type range: MIN 8000, MAX 48000, STEP 50 READ ONLY
      de94: Number Of Channels UINT16 data type enumeration: 0, 1, 2,  READ ONLY
      de99: Audio WAVE Codec UINT32 data type enumeration: 0, 352, 353, 85,  READ ONLY
      de9a: Audio Bit Rate UINT32 data type range: MIN 1, MAX 1500000, STEP 1 READ ONLY
      dc89: Duration UINT32 data type range: MIN 0, MAX 10000000, STEP 1 READ ONLY
   b901: WMA
      dc01: Storage ID UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc02: Object Format UINT16 data type ANY 16BIT VALUE form READ ONLY
      dc03: Protection Status UINT16 data type enumeration: 0, 1,  READ ONLY
      dc04: Object Size UINT64 data type READ ONLY
      dc07: Object File Name STRING data type GET/SET
      dc0b: Parent Object UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc41: Persistant Unique Object Identifier UINT128 data type READ ONLY
      dc44: Name STRING data type GET/SET
      dc4f: Non Consumable UINT8 data type enumeration: 0, 1,  GET/SET
      dc09: Date Modified STRING data type DATETIME FORM READ ONLY
      dc46: Artist STRING data type GET/SET
      dc8b: Track UINT16 data type ANY 16BIT VALUE form GET/SET
      dc8c: Genre STRING data type GET/SET
      dc91: Use Count UINT32 data type ANY 32BIT VALUE form GET/SET
      dc9a: Album Name STRING data type GET/SET
      dc9b: Album Artist STRING data type GET/SET
      de93: Sample Rate UINT32 data type range: MIN 8000, MAX 48000, STEP 50 READ ONLY
      de94: Number Of Channels UINT16 data type enumeration: 0, 1, 2,  READ ONLY
      de99: Audio WAVE Codec UINT32 data type enumeration: 0, 352, 353, 85,  READ ONLY
      de9a: Audio Bit Rate UINT32 data type range: MIN 1, MAX 1500000, STEP 1 READ ONLY
      dc89: Duration UINT32 data type range: MIN 0, MAX 10000000, STEP 1 READ ONLY
   3008: MS Wave
      dc01: Storage ID UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc02: Object Format UINT16 data type ANY 16BIT VALUE form READ ONLY
      dc03: Protection Status UINT16 data type enumeration: 0, 1,  READ ONLY
      dc04: Object Size UINT64 data type READ ONLY
      dc07: Object File Name STRING data type GET/SET
      dc0b: Parent Object UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc41: Persistant Unique Object Identifier UINT128 data type READ ONLY
      dc44: Name STRING data type GET/SET
      dc4f: Non Consumable UINT8 data type enumeration: 0, 1,  GET/SET
      dc09: Date Modified STRING data type DATETIME FORM READ ONLY
   ba05: Abstract Audio Video Playlist
      dc01: Storage ID UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc02: Object Format UINT16 data type ANY 16BIT VALUE form READ ONLY
      dc03: Protection Status UINT16 data type enumeration: 0, 1,  READ ONLY
      dc04: Object Size UINT64 data type READ ONLY
      dc07: Object File Name STRING data type GET/SET
      dc0b: Parent Object UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc41: Persistant Unique Object Identifier UINT128 data type READ ONLY
      dc44: Name STRING data type GET/SET
      dc4f: Non Consumable UINT8 data type enumeration: 0, 1,  GET/SET
      dc09: Date Modified STRING data type DATETIME FORM READ ONLY
   ba09: Abstract Audio Playlist
      dc01: Storage ID UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc02: Object Format UINT16 data type ANY 16BIT VALUE form READ ONLY
      dc03: Protection Status UINT16 data type enumeration: 0, 1,  READ ONLY
      dc04: Object Size UINT64 data type READ ONLY
      dc07: Object File Name STRING data type GET/SET
      dc0b: Parent Object UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc41: Persistant Unique Object Identifier UINT128 data type READ ONLY
      dc44: Name STRING data type GET/SET
      dc4f: Non Consumable UINT8 data type enumeration: 0, 1,  GET/SET
      dc09: Date Modified STRING data type DATETIME FORM READ ONLY
   ba10: WPL Playlist
      dc01: Storage ID UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc02: Object Format UINT16 data type ANY 16BIT VALUE form READ ONLY
      dc03: Protection Status UINT16 data type enumeration: 0, 1,  READ ONLY
      dc04: Object Size UINT64 data type READ ONLY
      dc07: Object File Name STRING data type GET/SET
      dc0b: Parent Object UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc41: Persistant Unique Object Identifier UINT128 data type READ ONLY
      dc44: Name STRING data type GET/SET
      dc4f: Non Consumable UINT8 data type enumeration: 0, 1,  GET/SET
      dc09: Date Modified STRING data type DATETIME FORM READ ONLY
   ba11: M3U Playlist
      dc01: Storage ID UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc02: Object Format UINT16 data type ANY 16BIT VALUE form READ ONLY
      dc03: Protection Status UINT16 data type enumeration: 0, 1,  READ ONLY
      dc04: Object Size UINT64 data type READ ONLY
      dc07: Object File Name STRING data type GET/SET
      dc0b: Parent Object UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc41: Persistant Unique Object Identifier UINT128 data type READ ONLY
      dc44: Name STRING data type GET/SET
      dc4f: Non Consumable UINT8 data type enumeration: 0, 1,  GET/SET
      dc09: Date Modified STRING data type DATETIME FORM READ ONLY
   ba82: XMLDocument
      dc01: Storage ID UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc02: Object Format UINT16 data type ANY 16BIT VALUE form READ ONLY
      dc03: Protection Status UINT16 data type enumeration: 0, 1,  READ ONLY
      dc04: Object Size UINT64 data type READ ONLY
      dc07: Object File Name STRING data type GET/SET
      dc0b: Parent Object UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc41: Persistant Unique Object Identifier UINT128 data type READ ONLY
      dc44: Name STRING data type GET/SET
      dc4f: Non Consumable UINT8 data type enumeration: 0, 1,  GET/SET
      dc09: Date Modified STRING data type DATETIME FORM READ ONLY
   3000: Undefined Type
      dc01: Storage ID UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc02: Object Format UINT16 data type ANY 16BIT VALUE form READ ONLY
      dc03: Protection Status UINT16 data type enumeration: 0, 1,  READ ONLY
      dc04: Object Size UINT64 data type READ ONLY
      dc07: Object File Name STRING data type GET/SET
      dc0b: Parent Object UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc41: Persistant Unique Object Identifier UINT128 data type READ ONLY
      dc44: Name STRING data type GET/SET
      dc4f: Non Consumable UINT8 data type enumeration: 0, 1,  GET/SET
      dc09: Date Modified STRING data type DATETIME FORM READ ONLY
   3001: Association/Directory
      dc01: Storage ID UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc02: Object Format UINT16 data type ANY 16BIT VALUE form READ ONLY
      dc03: Protection Status UINT16 data type enumeration: 0, 1,  READ ONLY
      dc04: Object Size UINT64 data type READ ONLY
      dc07: Object File Name STRING data type GET/SET
      dc0b: Parent Object UINT32 data type ANY 32BIT VALUE form READ ONLY
      dc41: Persistant Unique Object Identifier UINT128 data type READ ONLY
  Error 2: PTP Layer error 02fe: get_device_unicode_property(): failed to get unicode property.
Error 2: (Look this up in ptp.h for an explanation.)
    dc44: Name STRING data type GET/SET
      dc4f: Non Consumable UINT8 data type enumeration: 0, 1,  GET/SET
      dc09: Date Modified STRING data type DATETIME FORM READ ONLY
      dc05: Association Type UINT16 data type enumeration: 0, 1,  GET/SET
      dc06: Association Desc UINT32 data type ANY 32BIT VALUE form GET/SET
Storage Devices:
   StorageID: 0x00010001
      StorageType: 0x0003 fixed RAM storage
      FilesystemType: 0x0001 generic flat filesystem
      AccessCapability: 0x0000 read/write
      MaxCapacity: 910082048
      FreeSpaceInBytes: 910082048
      FreeSpaceInObjects: 0
      StorageDescription: Mémoire terminal
      VolumeIdentifier: 10001-12345678-a000000d757cc0
   StorageID: 0x00020001
      StorageType: 0x0004 removable RAM storage
      FilesystemType: 0x0001 generic flat filesystem
      AccessCapability: 0x0000 read/write
      MaxCapacity: 7766966272
      FreeSpaceInBytes: 7766966272
      FreeSpaceInObjects: 0
      StorageDescription: Carte Média
      VolumeIdentifier: 20001-12345678-a000000d757cc0
Special directories:
   Default music folder: 0x00000000
   Default playlist folder: 0x00000000
   Default picture folder: 0x00000000
   Default video folder: 0x00000000
   Default organizer folder: 0x00000000
   Default zencast folder: 0x00000000
   Default album folder: 0x00000000
   Default text folder: 0x00000000
MTP-specific device properties:
   Friendly name: (NULL)
   Synchronization partner: (NULL)
   Battery level 5 of 100 (5%)
libmtp supported (playable) filetypes:
   ISO MPEG-1 Audio Layer 3
   Microsoft Windows Media Audio
   RIFF WAVE file
   Abstract Playlist file
   XML file
Unable to acquire device certificate, perhaps this device does not support this

OK.

This command line gives several important informations. Indeed, we get the features list supported by our BlackBerry device, and most of, we have the ID of each mass-storage device. 0x00010001 for the internal memory and 0x00020001 for the memory card. So, 65537 and 131073 (in decimal base).

Now, we can list each directories with multimedia files. You notice that if a directory doesn't contain multimedia files, it doesn't display.

[root@Dahlia root]$ mtp-folders
Device 0 (VID=0fca and PID=8007) is a RIM BlackBerry Storm.
Attempting to connect device(s)
mtp-folders: Successfully connected
Error 2: PTP Layer error 02fe: Error getting friendlyname.
Error 2: (Look this up in ptp.h for an explanation.)
Friendly name: (NULL)
2097156 music
OK.

This command returns a "music" directory (with the ID 2097156).

We can also list the files whom the format is known by our BlackBerry.

[root@Dahlia root]$ mtp-files
Device 0 (VID=0fca and PID=8007) is a RIM BlackBerry Storm.
libmtp version: 1.0.1

mtp-files: Successfully connected
Listing File Information on Device with name: (NULL)
File ID: 2097157
   Filename: o_surdato_nnammurato.mp3
   File size 2707456 (0x0000000000295000) bytes
   Parent ID: 2097156
   Storage ID: 0x00020001
   Filetype: ISO MPEG-1 Audio Layer 3
File ID: 2097158
   Filename: a_marechiare.mp3
   File size 3117056 (0x00000000002F9000) bytes
   Parent ID: 2097156
   Storage ID: 0x00020001
   Filetype: ISO MPEG-1 Audio Layer 3
OK.

For each file, we have its ID, filename, size, ID of parent object (here "music" directory), ID of storage device (here memory card) and finally the file type.

We can easily use the commands line mtp-delfile, mtp-getfile...

The command mtp-sendfile (or better mtp-sendtr) permits you to send a file to our BlackBerry device.

[root@Dahlia root]$ mtp-sendtr -a "Andrea Bocelli" -l "Intanco" -s 131073 voglio_vivere_cos.mp3 "/Music/voglio_vivere_cos.mp3"

This command have several arguments : the artist name, the album name, ID of storage device, the local filename and the remote filename.

You can also use the playlist feature. After sending your files, get their ID thanks to the mtp-files command (or better mtp-tracks).

[root@Dahlia root]$ mtp-newplaylist -i 2097157 -i 2097158 -n "Andrea Bocelli - Incanto" -s 131073 -p 2097156

This command have several arguments : the ID list, the playlist name, ID of storage device and ID of parent object.

I'm working about the MTP Rhythmbox improvement.

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-2009, Net Direct Inc. (http://www.netdirect.ca/)
        Using: Barry library version 0.15 (little endian)

   -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 <module name> ...
      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] <module name> ...
      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

BlackBerry as a modem  

This part describes the steps needed to use your BlackBerry device as a modem to surf the net.

BlackBerry development using Linux

JDK Installation  

I use the JDK from SUN. With debian, it's quiet easy to use it.

[root@Dahlia root]$ aptitude install sun-java6-bin sun-java6-demo sun-java6-doc sun-java6-jdk sun-java6-jre sun-java6-plugin

JDE Installation  

Before install JDE on Linux, I have installed it on Windows. I haven't success install with WINE tools.

[root@Dahlia root]$ mkdir -p /opt/RIM
[root@Dahlia root]$ cp -R /mnt/win/Program\ Files/BlackBerry\ JDE\ 4.7.0/ /opt/RIM/sdk

Then, I need Java Toolkit from SUN (sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh).
I have installed this tool in /opt/RIM/WTK2.5.2.

[root@Dahlia root]$ sh sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh

http://java.sun.com/products/sjwtoolkit/download.html

Build COD application  

To be able to build COD application from the sources (JAVA files) and a project file (RAPC file), I have written a little script.

[root@Dahlia root]$ mkdir -p /opt/RIM/tools
[root@Dahlia root]$ cat > /opt/RIM/tools/build.sh
#!/bin/bash

SDK=/opt/RIM/sdk
PREVERIFY=/opt/RIM/WTK2.5.2/bin

PATH=$PATH:$PREVERIFY java -jar $SDK/bin/rapc.jar \
   import=$SDK/lib/net_rim_api.jar \
   codename=$1 \
   $1.rapc \
   *.java

Now, for the sample, I'm going to build the HelloWorld sample from the SDK.

[root@Dahlia root]$ mkdir project
[root@Dahlia root]$ cd project
[root@Dahlia project]$ cp -R /opt/RIM/sdk/samples/com/rim/samples/device/helloworlddemo .
[root@Dahlia project]$ cd helloworlddemo
[root@Dahlia helloworlddemo]$ cat > HelloWorldDemo.rapc
MIDlet-Name: HelloWorldDemo
MIDlet-Version: 0.9
MIDlet-Vendor: Research In Motion Ltd.
MIDlet-Jar-URL: HelloWorldDemo.jar
MIDlet-Jar-Size: 0
MicroEdition-Profile: MIDP-2.0
MicroEdition-Configuration: CLDC-1.1
MIDlet-1: Hello World Demo,img/helloworld_jde.png,
RIM-MIDlet-Flags-1: 0
[root@Dahlia helloworlddemo]$ /opt/RIM/tools/build.sh HelloWorldDemo

Build Midlet application  

With JDE, you can convert JAVA midlet to COD files.
To make this, I have written a little script.

[root@Dahlia root]$ mkdir -p /opt/RIM/tools
[root@Dahlia root]$ cat > /opt/RIM/tools/jar2cod.sh
#!/bin/bash

SDK=/opt/RIM/sdk
PREVERIFY=/opt/RIM/WTK2.5.2/bin

PATH=$PATH:$PREVERIFY java -jar $SDK/bin/rapc.jar \
   import=$SDK/lib/net_rim_api.jar \
   codename=$1 \
   -midlet \
   jad=$1.jad \
   $1.jar

Then...

[root@Dahlia root]$ /opt/RIM/tools/jar2cod.sh HelloWorldDemo

Signing Java applications  

The last step is using the signature tool from the JDE.

First, you have to register you RIM's developper to get your keys. You will receive three keys RBB, RCR and RRT :
- client-RBB-1234567890.csi
- client-RCR-1234567890.csi
- client-RRT-1234567890.csi

To use keys, you have to register with JDE tool. During the registration process, you have to be online. You have to enter your PIN code and a passphrase.
WARNING, you have to use the same PIN code and the same passphrase for each key.

[root@Dahlia root]$ cd /opt/RIM/sdk/bin
[root@Dahlia bin]$ chmod 644 sigtool.*
[root@Dahlia bin]$ java -jar SignatureTool.jar client-RBB-1234567890.csi
[root@Dahlia bin]$ java -jar SignatureTool.jar client-RCR-1234567890.csi
[root@Dahlia bin]$ java -jar SignatureTool.jar client-RRT-1234567890.csi

Now, you are ready and you can sign your applications.

[root@Dahlia root]$ cd /opt/RIM/sdk/bin
[root@Dahlia bin]$ java -jar SignatureTool.jar

Debug Java application  

It's possible to use your BlackBerry device to debug step by step your Java applicationser. I'm writting a tool to plug JDB client (or other) to the embedded JVM into your mobile phone.

This tool is still in current developpement. Some features can be used and are available in the last Barry releases.

We are going to use the previous HelloWorldDemo sample.

[root@Dahlia helloworlddemo]$ /opt/RIM/tools/build.sh HelloWorldDemo
[root@Dahlia helloworlddemo]$ ls
build.sh*             HelloWorldDemo.cso    HelloWorldDemo.jar    HelloWorldScreen.class
HelloWorldDemo.class  HelloWorldDemo.debug  HelloWorldDemo.java*  img/
HelloWorldDemo.cod    HelloWorldDemo.jad    HelloWorldDemo.rapc*  Makefile

Rapc has generated several files... whom some interresant. The HelloWorldDemo.cod file will be install on our BlackBerry device and the HelloWorldDemo.debug file will be used to debug.

[root@Dahlia helloworlddemo]$ bjavaloader load HelloWorldDemo.cod
loading HelloWorldDemo.cod... done.

To be able to debug, we have to run the bjdwp command in the same directory where is the HelloWorldDemo.debug file. If you wish to debug several applications, copy all your ".debug" files in a same directory.

[root@Dahlia helloworlddemo]$ bjdwp localhost 8000

Then, you can use a Java debugger (Eclipse, JDB or others) :

[root@Dahlia root]$ jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8000

The bjdwp tool generates several traces, whom the console message (the "System.out.println" output).