View Single Post
Old 01-15-2007, 01:39 AM   #13 (permalink)
Thumbs Must Hurt
metsfan's Avatar
Join Date: Jan 2007
Model: 8100
Carrier: T-Mobile
Posts: 141
Post Thanks: 0
Thanked 0 Times in 0 Posts

I got annoyed having to run bcharge manually every time I connected my Pearl, so I hacked something up. Unfortunately, it really is a hack.

This will work if you use gnome-volume-manager to automount devices (most GNOME desktop systems use that these days). It should also work with any system that uses pmount-hal to mount devices, as gvm does.

Move /usr/bin/pmount-hal to a new file.
sudo mv /usr/bin/pmount-hal /usr/bin/pmount-hal-bin
Create a new file, /usr/bin/pmount-hal
sudo echo #!/bin/sh > /usr/bin/pmount-hal
sudo echo /usr/local/bin/bcharge >> /usr/bin/pmount-hal
sudo echo /usr/bin/pmount-hal-bin $1 $2 $3 $4 $5 $6 $7 $8 $9 >> /usr/bin/pmount-hal
Make the new script executable:
sudo chmod a+x /usr/bin/pmount-hal
For this to work, you may have to set the suid bit on bcharge:
sudo chmod +s /usr/local/bin/bcharge
This will run bcharge before mounting any removable device. If you connect anything other than a BlackBerry, it'll just not find anything and exit. This is an awful hack, but I couldn't find any way to execute a command before mount with gvm. I was able to do it with ivman, but I prefer to use gvm, if only to keep my system as close to a default install as possible.

Edit: Forgot to mention that for this to work, the Pearl needs to be set up to always go into mass storage mode when connected to a computer.
Get AutoLock, SoftReset, and ColorPearl for the BlackBerry! Like my software? Donate!

Last edited by metsfan : 01-26-2007 at 06:23 PM.