BlackBerryForums.com : Your Number One BlackBerry Community   NextAction! for BlackBerry   

»Sponsored Links




Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,045
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default HowTo: Use bcharge to charge your BB under linux - 02-19-2007, 12:17 PM

Barry Homepage:
Net Direct :: Open Solutions

SourceForge Project Downloads:
SourceForge.net: Files

'bcharge' is a utility that's part of the Barry project - which aims to be a complete desktop toolset for interfacing your BlackBerry with linux. The purpose of the bcharge tool is to detect when a BB has been plugged in and then alter the current to the USB port - it will increase the default 100mA flow up to 500mA, which is what the BlackBerry is expecting. This is exactly what the Windows driver does.

The 0.1 version currently available (2007-02-19) will work with any BlackBerry older than the Pearl 8100; for the 8100 (and presumably the 8800, unreleased at this time) you'll need to get the latest version of the code from CVS (only "bcharge.cc" is needed); the product ID internally has changed from '0x0001' to '0x0006' in this newer handset. The latest CVS version will recognize both older and newer devices, but the newer CVS code includes some special action to take when "seeing" an 8100 device.

CVS link for post-0.1 bcharge.cc:
SourceForge.net Repository - [barry] Index of /barry/tools

Compiling the code is beyond the scope of this HowTo, but it's extremely simple and uses all the standard linux-isms (autoconf, g++, etc.) -- if you can compile any generic application you should be able to compile bcharge; because this code interfaces with USB ports, make sure you have the 'libusb-devel' (exact name depends on your distro) installed so it'll find the headers and link libraries. There may already be installable packages available download as well (.deb/.rpm) - your need to compile may vary.

There are two parts to 'bcharge' - the main binary itself and a "udev" script. You can use the tool without doing anything, just plug in your BlackBerry to any USB port and type ./bcharge (substitute the path if needed). This will scan all the USB devices plugged in, find your BB handset, and adjust the current flow. It's that simple.

But, to automate the process you can copy a script from CVS (or the official downloads) to your /etc/udev/rules.d/ directory (location may vary depending on distro) to have everything done for you. First, copy the compiled binary (bcharge) to /usr/sbin/ and make sure it's at least mode 0755 (executable), owned by root (for security's sake). Now copy one of the scripts from here:

SourceForge.net Repository - [barry] Index of /barry/udev

...to the udev rules directory mentioned above. Obviously if you're using Debian (and maybe Ubuntu?) use the one called "Debian".

NOTE: if you have a newer Pearl device you will need to update the ProductID in this script. Replace this code:

Code:
SYSFS{idProduct}=="0001"
...with this code:

Code:
SYSFS{idProduct}=="0006"
It should make perfect sense why you're doing this. You could also just copy/paste the line to a new line and add both products at once -- the choice is yours. Maybe you have both an older and newer BB device and need it both ways.

Reboot. I say again, Reboot. 'udev' rules don't seem to work quite right unless they're loaded at startup (when udev runs), so just save yourself some hassle and sacrifice your uptime with a reboot. Now plug in your BB device and it should initially flash on the handset the error message about insifficient charge, but then the message will go away in 1sec (or so) when bcharge runs and performs the adjustment.

You can use the 'lsusb' tool to verify the current has been changed - run 'lsusb -v | less' as root, find the RIM BlackBerry section and it'll show the current USB port power flow. It should say 500mA and not 100mA.

edit: blogged.
bcharge: charge your BlackBerry under linux « rivviepop phantom

Last edited by rivviepop : 02-19-2007 at 01:11 PM. Reason: adding link
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
blakeatl Offline
BlackBerry Extraordinaire
 
blakeatl's Avatar
 
Posts: 1,476
Join Date: Oct 2006
Location: Atlanta area
Model: 8100
Carrier: T-mobile
Default 02-19-2007, 02:50 PM

Very nice. I hope the option for the Pearl comes soon.


BlackBerry 8100 v.4.2.1.94
T-Mobile

Free Stuff From Retailers
http://flbop.com/
   
Reply With Quote
  (#3 (permalink)) Old
Glate Offline
New Member
 
Posts: 5
Join Date: Feb 2007
Model: 8100
Default 02-21-2007, 07:30 PM

Wicked. I've been looking for this for years... You are officially my hero. Now to see if there's a Gentoo ebuild..
   
Reply With Quote
  (#4 (permalink)) Old
LunkHead Offline
BBFAQ Sysop
 
LunkHead's Avatar
 
Posts: 8,364
Join Date: Jan 2005
Location: Prison
Model: 850
OS: 0.0.00001
PIN: How do I find mine?
Carrier: Post Office
Default 02-23-2007, 02:20 PM

Got it! Sweet!!!! Working as advertised!

@rivviepop

Any luck getting the MicroSD card in the BB recognized?????
   
Reply With Quote
  (#5 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,045
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 02-23-2007, 03:02 PM

Quote:
Originally Posted by LunkHead
Any luck getting the MicroSD card in the BB recognized?????
Mine works like a champ -- start a new thread on this, and post the applicable contents of /var/log/messages from your system when you plug in the device. We'll address it in that thread then...
   
Reply With Quote
  (#6 (permalink)) Old
LunkHead Offline
BBFAQ Sysop
 
LunkHead's Avatar
 
Posts: 8,364
Join Date: Jan 2005
Location: Prison
Model: 850
OS: 0.0.00001
PIN: How do I find mine?
Carrier: Post Office
Default 02-23-2007, 05:32 PM

This could also use a sticky! Mods? Thanks!
   
Reply With Quote
  (#7 (permalink)) Old
LunkHead Offline
BBFAQ Sysop
 
LunkHead's Avatar
 
Posts: 8,364
Join Date: Jan 2005
Location: Prison
Model: 850
OS: 0.0.00001
PIN: How do I find mine?
Carrier: Post Office
Default 02-25-2007, 03:12 PM

Here is the bcharge RPM(*)... I had to add the .zip at the end of the file to get the forums to take the upload... Just rename it by removing the .zip at the end of the filename...

(*)From RPM.Pbone.net

You will need to satisfy the following:
libusb-0.1.so.4
rpmlib <= 3.0.4-1
libstdc++.so.6
libgcc_s.so.1
libc.so.6
rtld(GNU_HASH)
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
config(bcharge) = 1.0-1
libstdc++.so.6
libc.so.6
libm.so.6

Last edited by LunkHead : 09-09-2007 at 12:13 PM.
   
Reply With Quote
  (#8 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,045
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 02-25-2007, 03:35 PM

Just a note (trying to tie these two threads together) -- the above RPM is old (I think?) and doesn't use the fancy new CVS code from the Barry project; I do have a RPM for FC6 that I'll give out personally (PM me), but I don't want to share it publically. I made my own tarball and called it "0.2", it's entirely unofficial code -- I don't wish to disrespect the Barry project by accident, hence not releasing it.

It's not hard to do yourself, though. I'll at least post my SPEC file here to get you started; it's an enhancement of the one from the Barry project, and is intended to use the latest bcharge.cc and a patched udev ruleset (see the Barry patches page if it's not in CVS yet) to support both old and new device IDs.

Code:
Summary: BlackBerry (tm) Desktop for Linux  - bcharge utility
Name: bcharge
License: GPL
Version: 0.2
Release: 1.cvs20070219
Group: Applications/Productivity
Source: bcharge-0.2.tar.gz
URL: http://www.netdirect.ca/downloads/barry
Vendor: Net Direct Inc.
BuildRoot: /var/tmp/%{name}-buildroot
Requires: libusb
BuildRequires: libusb-devel, gcc-c++

%description
Barry is a desktop tool for managing your BlackBerry (tm) device. (BlackBerry
is a registered trademark of Research in Motion Limited.)

This packages contains the USB charge utility, bcharge.

%prep
%setup

%build
g++ -Wall -g -o bcharge bcharge.cc -lusb

%install
%{__mkdir_p} %{buildroot}%{_sbindir} %{buildroot}%{_sysconfdir}/udev/rules.d
%{__cp} bcharge %{buildroot}%{_sbindir}
%{__cp} 10-blackberry.rules %{buildroot}%{_sysconfdir}/udev/rules.d

%clean
%{__rm} -rf %{buildroot}

%files
%attr(0755,root,root) %{_sbindir}/bcharge       
%attr(0644,root,root) %config %{_sysconfdir}/udev/rules.d/10-blackberry.rules
   
Reply With Quote
  (#9 (permalink)) Old
erroneus Offline
Knows Where the Search Button Is
 
erroneus's Avatar
 
Posts: 42
Join Date: Feb 2007
Location: Texas
Model: 8100
Carrier: T-Mobile
Default 02-26-2007, 10:05 AM

Let me just add an important note regarding the use of bbcharge.

With bbcharge active, I can use vmware+winxp and the blackberry software to perform the sync operations. Without it, I cannot. bbcharge is a necessary component to make it work.


Device: Blackberry 8100 v4.2.0.64
Carrier: T-Mobile USA
BES: 4.1.0.38
Desktop OS: Fedora 7 Linux, Windows XP (vmware)
   
Reply With Quote
  (#10 (permalink)) Old
LunkHead Offline
BBFAQ Sysop
 
LunkHead's Avatar
 
Posts: 8,364
Join Date: Jan 2005
Location: Prison
Model: 850
OS: 0.0.00001
PIN: How do I find mine?
Carrier: Post Office
Default 02-27-2007, 08:32 PM

Note: I do not have winxp....

BUT... You are able to do a complete sync with vmware after installing bcharge?

Kewl!
   
Reply With Quote
  (#11 (permalink)) Old
LunkHead Offline
BBFAQ Sysop
 
LunkHead's Avatar
 
Posts: 8,364
Join Date: Jan 2005
Location: Prison
Model: 850
OS: 0.0.00001
PIN: How do I find mine?
Carrier: Post Office
Default 02-27-2007, 10:04 PM

Quote:
Originally Posted by rivviepop
Just a note (trying to tie these two threads together) -- the above RPM is old (I think?) and doesn't use the fancy new CVS code from the Barry project;
You are correct Sir, it does not use the *new* cvs coding from barry....
   
Reply With Quote
  (#12 (permalink)) Old
godzilla8nj Offline
New Member
 
Posts: 4
Join Date: Oct 2006
Model: 8700
Carrier: T-Mobile
Default 02-28-2007, 03:57 PM

Hope this isn't off-topic, but are there any Ubuntu 6.10 users who have already compiled Barry who could give me a hand? I'm trying to get a tethered Blackberry as a modem and would hate to get too sidetracked learning how to compile for my distro. Thanks in advance for any assistance.
   
Reply With Quote
  (#13 (permalink)) Old
LunkHead Offline
BBFAQ Sysop
 
LunkHead's Avatar
 
Posts: 8,364
Join Date: Jan 2005
Location: Prison
Model: 850
OS: 0.0.00001
PIN: How do I find mine?
Carrier: Post Office
Default 02-28-2007, 04:54 PM

It's never a bad idea, and it's actually not hard, to do... I'd say read up on how to compile and give it a shot.... You get to learn and play with the BB at the same time!

How To Compile A Kernel - The Ubuntu Way | HowtoForge - Linux Howtos and Tutorials

Last edited by LunkHead : 02-28-2007 at 04:57 PM.
   
Reply With Quote
  (#14 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,045
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 03-01-2007, 11:54 PM

Ladies & Gents:

SourceForge.net: Detail: 1672178 - RPM spec file to build barry-bcharge

You can use that now to build a 'barry-bcharge' RPM (for Fedora/Red Hat) right out of the official tarball. The udev rule patch isn't in CVS, so you also have to download it as well (outlined in the above link).
   
Reply With Quote
  (#15 (permalink)) Old
jfanaian Offline
New Member
 
Posts: 13
Join Date: Mar 2007
Model: 8100
Default 03-28-2007, 01:18 PM

I'm trying to install bcharge for my Pearl 8100 but it keeps saying it isn't a perl when I run it. I found out (through lsusb) that my iProduct is actually 4 not 5. I tried changing the constant acordingly but it does not seem to modify the Max Power to 500mA instead of 100mA, even though there seem to be no error.

Here is the output I get after changing the constant to 4:
Code:
Scanning for Blackberry devices...
Found device #005...adjusting charge setting...adjusting Pearl mode to dual...done
   
Reply With Quote
  (#16 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,045
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 03-28-2007, 01:48 PM

Quote:
Originally Posted by jfanaian
I'm trying to install bcharge for my Pearl 8100 but it keeps saying it isn't a perl when I run it.
Yeah, it's a problem in the code - it adjusts your current to 500mA just fine, but then running it again says "no Pearl found".

See:
http://sourceforge.net/tracker/index...& atid=788906

and

http://sourceforge.net/mailarchive/f...me=barry-devel

HTH.
   
Reply With Quote
  (#17 (permalink)) Old
jfanaian Offline
New Member
 
Posts: 13
Join Date: Mar 2007
Model: 8100
Default 03-28-2007, 02:01 PM

Hrm... I tried looking at the patch and ti seems to have similar changes that the patch adds. I have the latest CVS version which already has a detection for 0x0004 which is what seemed to be in the patch so that didn't work, and I didn't find anything useful while reading through the mailing list archive. I sent an email to the mailing list and I will keep playing to see what the cause of this is.
Thanks
   
Reply With Quote
  (#18 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,045
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 03-28-2007, 02:07 PM

Quote:
Originally Posted by jfanaian
Hrm... I tried looking at the patch and ti seems to have similar changes that the patch adds. I have the latest CVS version which already has a detection for 0x0004 which is what seemed to be in the patch so that didn't work, and I didn't find anything useful while reading through the mailing list archive. I sent an email to the mailing list and I will keep playing to see what the cause of this is.
Basically, CVS is just plain broken. If you download the released 0.6 code then apply the patch, it will add the 0x0004 support and just work; Chris did a lot of re-working with the CVS code and it's actually worse than 0.6 code was; he said he might just undo everything he did in CVS, but I don't know.
   
Reply With Quote
  (#19 (permalink)) Old
jfanaian Offline
New Member
 
Posts: 13
Join Date: Mar 2007
Model: 8100
Default 03-28-2007, 02:13 PM

Ah! Alright I will do that then! Thanks for the tip... I will let you know how it works out.
   
Reply With Quote
  (#20 (permalink)) Old
jfanaian Offline
New Member
 
Posts: 13
Join Date: Mar 2007
Model: 8100
Default 03-28-2007, 02:21 PM

I tried using 0.6 with the patch and it seems to actually do some thinking in the execution unlike before. The only problem is that MaxPower is still 100mA :(

This is the output from running bcharge:
Code:
Scanning for Blackberry devices...
Found...attempting to adjust charge setting.
1 device adjusted.
This is what lsusb -v says under the pearl device section:
Code:
Bus 001 Device 011: ID 0fca:0006 Research In Motion, Ltd. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        16
  idVendor           0x0fca Research In Motion, Ltd.
  idProduct          0x0006 
  bcdDevice            1.06
  iManufacturer           1 
  iProduct                4 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9