BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 12-22-2006, 07:54 PM   #1
rivviepop
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Posts: 2,166
Default Linux USB charging?

Please Login to Remove!

I have a laptop at home, dual boot with WinXP and Linux. When in WinXP with the Pearl plugged into USB, the phone charges as you'd expect since the Desktop software is installed. When I boot back to Linux though, the phone complains about insufficient juice to charge or a missing driver (duh).

Anyone know the trick to get this thing charging over USB with your generic Linux machine? On my main workstation here at work I get the same BB message, but I know the USB ports on this beast can do it (other USB-charging phones work just fine).

Thanks! Of course I'm at work, the battery is dying and my charger is at home. *sigh*
Offline  
Old 12-23-2006, 01:53 AM   #2
StarKnight83
Thumbs Must Hurt
 
Join Date: Mar 2006
Model: 8100
Carrier: t-mobile
Posts: 54
Default

AFAIK the usb port in passive mode (which it most likely is in) only delivers 100mAh, to put it into its high/active mode there might be a command to send to the kernel to drive it high but I dont know the usb code so not much help beyond that
Offline  
Old 12-23-2006, 12:43 PM   #3
rivviepop
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Posts: 2,166
Default

Hi,

Yeah - some googling and help on another forum and a little poking at "lsusb -v" tells me that the way this device is built, when it plugs in it announces to the PC that it draws 100mA only. Then, some sort of communication (nobody's debugged it yet) happens between the Windows driver and the device; the device then switches into 500mA draw mode, announces it to the PC and the juice flows.

OSX users have the same problem -- what has to happen is that someone (I may attempt ) has to use snoop to debug the USB port during plugin and watch the query/response flow between the two ends (or get specs from RIM). Then we can fake the funk in non-Windows systems to tell the device to crank up the heat.
Offline  
Old 01-01-2007, 12:38 PM   #4
titetanium
Thumbs Must Hurt
 
Join Date: Apr 2005
Model: 8320
PIN: Up
Carrier: t-mobile
Posts: 188
Lightbulb

Do a google search or search on sourceforge.net for barry. That utility uses libusb to change the charging rate from 100mA to 500mA. There are packages in .deb, rpm, and tgz formats. Happy charging without rebooting!
Offline  
Old 01-01-2007, 02:37 PM   #5
rivviepop
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Posts: 2,166
Default

Quote:
Originally Posted by titetanium
Do a google search or search on sourceforge.net for barry. That utility uses libusb to change the charging rate from 100mA to 500mA. There are packages in .deb, rpm, and tgz formats. Happy charging without rebooting!
Thanks! They just released 0.1 of "bcharge" on the 29th:

SourceForge.net: Barry's bcharge version 1.0 released

It doesn't work out-of-the-box with the Pearl, since the idProduct is different; I made a quick patch and it's at least now trying to work:

Code:
$ bcharge 
Scanning for Blackberry devices...
Found...attempting to adjust charge setting.
1 device adjusted.
Here's the small patch for anyone interested:

Code:
--- barry-0.1/10-blackberry.rules.orig  2007-01-01 11:23:09.000000000 -0800
+++ barry-0.1/10-blackberry.rules       2007-01-01 11:23:37.000000000 -0800
@@ -1,3 +1,3 @@
 # Blackberry devices
 #
-BUS=="usb", ACTION=="add", SYSFS{idVendor}=="0fca", SYSFS{idProduct}=="0001", SYMLINK+="bb-%k", RUN="/usr/sbin/bcharge"
+BUS=="usb", ACTION=="add", SYSFS{idVendor}=="0fca", SYSFS{idProduct}=="0006", SYMLINK+="bb-%k", RUN="/usr/sbin/bcharge"
--- barry-0.1/bcharge.cc.orig   2007-01-01 11:23:26.000000000 -0800
+++ barry-0.1/bcharge.cc        2007-01-01 11:23:52.000000000 -0800
@@ -26,7 +26,7 @@
 #include <unistd.h>
 
 #define VENDOR_RIM             0x0fca
-#define PRODUCT_RIM_BLACKBERRY 0x0001
+#define PRODUCT_RIM_BLACKBERRY 0x0006
 
 #define BLACKBERRY_INTERFACE           0
 #define BLACKBERRY_CONFIGURATION       1
Houston, we have contact.
Offline  
Old 01-01-2007, 11:05 PM   #6
titetanium
Thumbs Must Hurt
 
Join Date: Apr 2005
Model: 8320
PIN: Up
Carrier: t-mobile
Posts: 188
Default

I had already built my version of barry before posting and made a deb for it. It works fine with my 7130c. Now, if I can find a way to have the DM functionality on linux like Pocketmac for the Mac, then I'm all set. I would be able to finally get rid of dual-booting into windows and reclaim the space for virtual machines in its place.
Offline  
Old 01-02-2007, 01:52 PM   #7
blakeatl
BlackBerry Extraordinaire
 
blakeatl's Avatar
 
Join Date: Oct 2006
Location: Atlanta area
Model: 8100
OS: 4.5.0.102
Carrier: T-mobile
Posts: 1,686
Default

I will be printing this page out as soon as I finish posting. I am one more step away from Windoze and one more step towards Ubuntu Edgy.
__________________
Build Your Business Even If You Are On A Budget.
Magnetic Sponsoring
Offline  
Old 01-02-2007, 02:32 PM   #8
rivviepop
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Posts: 2,166
Default

Quote:
Originally Posted by titetanium
Now, if I can find a way to have the DM functionality on linux like Pocketmac for the Mac, then I'm all set.
What features of the DM are you looking for, if I might ask? I've created a few workarounds and am developing my own non-Windows usage, curious to hear what others have done. I personally use SyncML to keep contacts and calendar online (http://mobical.net), and installed the Nexthaus SyncML plugin for the Blackberry, it's working as advertised.

I do my installs OTA from my own webserver (JAD-based), wrote a quick script to generate missing JAD files from jarballs (see >>here<<), the next step is to write a script that converts an ALX to a JAD, allowing OTA .cod installs as well.
Offline  
Old 01-03-2007, 01:14 AM   #9
titetanium
Thumbs Must Hurt
 
Join Date: Apr 2005
Model: 8320
PIN: Up
Carrier: t-mobile
Posts: 188
Default

Pretty much the ability to back up my blackberry to a file like DM does. That's a huge deal to me. and some files dont install ota correctly. So I end up booting into windows, just for those. Ugh. I really don't like booting into windows if I can't help it.
Offline  
Old 01-04-2007, 11:04 PM   #10
metsfan
Thumbs Must Hurt
 
metsfan's Avatar
 
Join Date: Jan 2007
Model: 8100
Carrier: T-Mobile
Posts: 141
Default

Great, this worked for me! I have to attach the Pearl, get the error message, run bcharge, and then disconnect and reconnect it, and it charges. Also, it works as a USB mass storage device for me so I can browse the microSD card.
__________________
Get AutoLock, SoftReset, and ColorPearl for the BlackBerry! Like my software? Donate!

Last edited by metsfan; 01-26-2007 at 06:27 PM..
Offline  
Old 01-06-2007, 10:29 PM   #11
rivviepop
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Posts: 2,166
Default

Hey guys -- been working a little with Chris (barry/bcharge author) feeding him USB snoop logs and such. He gave me a one-line addition to the patch (as well as a new bcharge.cc that support Pearl *and* non-Pearl) which makes it work on first plug-in; you no longer need to plug it in, unplug, then plug again. With this fix it'll flash that initial "non enough power" message on your Pearl but then go away after a second (i.e. after bcharge fires up and adjusts the power flow).

Code:
diff -uNr barry-0.1-orig/10-blackberry.rules barry-0.1/10-blackberry.rules
--- barry-0.1-orig/10-blackberry.rules  2006-12-21 11:59:46.000000000 -0800
+++ barry-0.1/10-blackberry.rules       2007-01-06 18:46:19.000000000 -0800
@@ -1,3 +1,3 @@
 # Blackberry devices
 #
-BUS=="usb", ACTION=="add", SYSFS{idVendor}=="0fca", SYSFS{idProduct}=="0001", SYMLINK+="bb-%k", RUN="/usr/sbin/bcharge"
+BUS=="usb", ACTION=="add", SYSFS{idVendor}=="0fca", SYSFS{idProduct}=="0006", SYMLINK+="bb-%k", RUN="/usr/sbin/bcharge"
diff -uNr barry-0.1-orig/bcharge.cc barry-0.1/bcharge.cc
--- barry-0.1-orig/bcharge.cc   2006-12-21 11:40:31.000000000 -0800
+++ barry-0.1/bcharge.cc        2007-01-06 18:47:27.000000000 -0800
@@ -4,6 +4,15 @@
 ///            to 500mA.  Cycles through all devices attached to USB,
 ///            attempting to set all matching Blackberry devices to charge.
 ///
+///            This file is part of the Barry project:
+///
+///            http://www.netdirect.ca/software/packages/barry/index.php
+///            http://sourceforge.net/projects/barry
+///
+///            Compile with the following command (needs libusb):
+///
+///            g++ -o bcharge bcharge.cc -lusb
+///
 
 /*
     Copyright (C) 2006, Net Direct Inc. (http://www.netdirect.ca/)
@@ -27,6 +36,7 @@
 
 #define VENDOR_RIM             0x0fca
 #define PRODUCT_RIM_BLACKBERRY 0x0001
+#define PRODUCT_RIM_PEARL      0x0006
 
 #define BLACKBERRY_INTERFACE           0
 #define BLACKBERRY_CONFIGURATION       1
@@ -48,6 +58,7 @@
        sleep(3);
 
        // cleanup
+       usb_reset(handle);
        usb_close(handle);
 }
 
@@ -70,7 +81,8 @@
                for (dev = bus->devices; dev; dev = dev->next) {
                        // Is this a blackberry?
                        if( dev->descriptor.idVendor == VENDOR_RIM &&
-                           dev->descriptor.idProduct == PRODUCT_RIM_BLACKBERRY ) {
+                           (dev->descriptor.idProduct == PRODUCT_RIM_BLACKBERRY ||
+                            dev->descriptor.idProduct == PRODUCT_RIM_PEARL) ) {
                                printf("Found...");
                                if( dev->config &&
                                    dev->descriptor.bNumConfigurations >= 1 &&
The magic line in this case is that call to usb_reset(). According to Chris:

Quote:
Originally Posted by Chris Frey
On Blackberries I've tested, it resets itself automatically when the
special commands are given. Even udev detects this and runs bcharge again,
which is why I had to put in the 500mA check, or it would run forever.

Looks like the Pearl waits to be reset, which is more sane behaviour
in my opinion.
Offline  
Old 01-06-2007, 10:32 PM   #12
rivviepop
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Posts: 2,166
Default

Quote:
Originally Posted by titetanium
Pretty much the ability to back up my blackberry to a file like DM does. That's a huge deal to me. and some files dont install ota correctly. So I end up booting into windows, just for those. Ugh. I really don't like booting into windows if I can't help it.
I ran an entire device Backup (in real WindowsXP) while under the USBsnoop, then sent the resultant (huge) logfile to the author; he said it'll take awhile but he's going to digest the info and try and get the Pearl working.

I'm sure they could use some help if you want to email and offer up some logs or something.... (see the SourceForge project page) The more of us helping them out, the better tool we'll get.
Offline  
Old 01-15-2007, 01:39 AM   #13
metsfan
Thumbs Must Hurt
 
metsfan's Avatar
 
Join Date: Jan 2007
Model: 8100
Carrier: T-Mobile
Posts: 141
Default

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.
Code:
sudo mv /usr/bin/pmount-hal /usr/bin/pmount-hal-bin
Create a new file, /usr/bin/pmount-hal
Code:
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:
Code:
sudo chmod a+x /usr/bin/pmount-hal
For this to work, you may have to set the suid bit on bcharge:
Code:
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..
Offline  
Old 01-15-2007, 04:59 PM   #14
rivviepop
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Posts: 2,166
Default

metsfan - what distro are you using? The barry project bcharge tarball includes a udev script that works perfectly on my Fedora Core system; it launches bcharge when the Pearl is plugged in and does it's thing. I did have to reboot though for it to be recognized - I'm not very familiar with udev to know how to do a runtime reload (or even if it's possible).

My bcharge RPM is at home to look for certain, but I think it goes into /etc/udev/rules.d/ and was a simple 1-liner; note my patch above patches that udev rule to support the Pearl (product = 0x0006). It works regardless of mass storage mode setting, as it's based on the RIM product simply showing up on the bus (lsusb -v).
__________________
[ Linux & BlackBerry ] http://www.blackberryforums.com/linux-users-corner/
Offline  
Old 01-15-2007, 05:04 PM   #15
metsfan
Thumbs Must Hurt
 
metsfan's Avatar
 
Join Date: Jan 2007
Model: 8100
Carrier: T-Mobile
Posts: 141
Default

Hmm.. yeah, of course. I had no idea what that file is when I first installed cause I hadn't looked into udev first... and then I forgot about it when I started looking into how to actually get this done. I made the change to the file, but never put it where it needed to be. I'm using Ubuntu 6.10, I'll give it a try. Also, the path to the binary in the udev file doesn't match the location the default install puts bcharge.

Edit: this worked, using the .Debian rules file included with barry.
__________________
Get AutoLock, SoftReset, and ColorPearl for the BlackBerry! Like my software? Donate!

Last edited by metsfan; 01-26-2007 at 06:24 PM..
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Original New DEC Digital DCJ11-AE 57-19400-09 Vintage CPU x 1pc picture

Original New DEC Digital DCJ11-AE 57-19400-09 Vintage CPU x 1pc

$100.00



DEC DIGITAL VINTAGE RA8X Control Panel picture

DEC DIGITAL VINTAGE RA8X Control Panel

$30.00



Vintage Journal Beautiful Garden Flower Embossed Leather-Antique Handmade Dec... picture

Vintage Journal Beautiful Garden Flower Embossed Leather-Antique Handmade Dec...

$29.04



DEC / AMI 304E 21-15542-01 vintage ceramic IC - KTF11 Chip *NEW* 40278101  picture

DEC / AMI 304E 21-15542-01 vintage ceramic IC - KTF11 Chip *NEW* 40278101

$50.00



Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16) picture

Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16)

$189.99



Niedermaier vintage Mannequins Visual Display Props Dec. 1991 Catalogue picture

Niedermaier vintage Mannequins Visual Display Props Dec. 1991 Catalogue

$141.00







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.