|
Recently my trusty old BlackBerry 7280 (aka the GhettoBerry) decided
it had had enough and gave up the ghost. It may have been the massive
arc in the crappy European power adapter I was using a few weeks ago in
Brussels... In any case, the transmitter would only work sporadically
and for only a few minutes, which, when you're on the road, is very
annoying.
So I replaced it with a brand spanking new BlackBerry 9000 Bold. All
black and shiny. It has a bright shiny screen, camera, video, mp3 player,
even new games! But does it play well with Linux? Of course not. Can I
make it play well with Linux? Well, that's what this page is
about.
There are three things I want it to do:
- Work as a USB hard drive so I can copy media files back and forth
and, if necessary, use it to temporarily hold files from my laptop.
- Charge from the USB connection. I could never get the 7280 to do
this.
- Sync with my Zimbra contacts list. I'm not hopeful about this
one...
Bold as a USB drive
The first time I plugged in the Bold a drive icon popped up on my
desktop and Rhythmbox opened. "Cool," I thought, "in classic Ubuntu form
it just worked." But did it? When I started copying files to it things
went just plain wrong. The Bold popped up the "Enable Mass Storage Mode"
dialogue, I clicked "OK", waited, then it popped up again. No matter how
many times I clicked it it kept coming back. And nothing was transferring
to the device. This was disappointing.
In the syslog file I would see repeated "reset high speed USB device
using ehci_hcd and address #" messages. Upon further investigation I
learnt that this may be due to the setting for the maximum amount of data
that will be transferred to or from the device in a single command,
as set in
/sys/block/sdb/device/max_sectors once the device is connected.
The default setting is 240, which equates to 120KB. This value works for
most devices, but the Bold doesn't like it. I changed it to 128 (aka
64KB) using "echo 128 > /sys/block/sdb/device/max_sectors",
which is the default for Windows, and hey presto! It worked!
The next question was how to make this the default. Digging deeper
into it I learnt that the udev system is responsible for detecting hot
plugged devices now and it is controlled by scripts in /etc/udev/rules.d.
I added the following line to /etc/udev/rules.d/80-programs.rules to set
the default max_sectors value to 128 for all devices. It may result in a
slight performance hit, but functionality is more important to me at this
point. I may try playing with some benchmarks some day...
# Blackberry Bold is not happy with max_sectors=240 - JayM 20090317
SUBSYSTEM=="block", BUS=="usb", KERNEL=="sd*", ATTRS{idVendor}=="0fca", RUN+="/bin/sh -c 'echo 128 >
/sys/block/%k/device/max_sectors'"
Note: that's only two lines... the SUBSYSTEM command should be one
line. It's split for formatting...
Next time I plugged in the Bold and checked max_sectors it was set to
128 and everything worked as expected. Now I can copy files back and
forth without any issues.
My next issue was it launching rhythmbox every time I plugged it in.
I use rhythmbox for managing my music, but this device is not, to me,
a music device but rather a mass storage device. So I want it to just
act like I'd plugged in a USB Flash drive. Fixing this involved removing
the entries for defining the Bold as a portable audio player in the hal
database. Edit
/usr/share/hal/fdi/information/10freedesktop/10-usb-music-players.fdi,
search for <!-- RIM --> and comment out the matches to add to the
portable_audio_player keys:
<!-- RIM -->
<match key="@storage.originating_device:usb.vendor_id" int="0x0fca">
<!-- Blackberry 8100 (Pearl), 8000 (Curve), 9000 (Bold) -->
<!--
<match key="@storage.originating_device:usb.product_id" int_outof="0x4;0x6;0x8004">
<addset key="portable_audio_player.access_method.protocols" type="strlist">storage</addset>
<append key="portable_audio_player.input_formats" type="strlist">audio/mp4</append>
<append key="portable_audio_player.input_formats" type="strlist">audio/mpeg</append>
<append key="portable_audio_player.audio_folders" type="strlist">BlackBerry/music/</append>
<append key="portable_audio_player.audio_folders" type="strlist">BlackBerry/videos/</append>
</match>
<match key="@storage.originating_device:usb.product_id" int="0x8004">
<append key="portable_audio_player.audio_folders" type="strlist">home/user/music/</append>
<append key="portable_audio_player.audio_folders" type="strlist">home/user/videos/</append>
</match>
-->
</match>
Next time the Bold is plugged in it only showed up as a mass storage
device - exactly as I intended.
Charging the Blackberry
Actually, it looks like this is just working... I'll explore more and
find out...
Jay MacDonald March 2009
|